Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Добрый вечер, я пытался сделать программу которая бы помогла при проверке на читы в играх
Но она не работает (на виртулке пробую, потому-что на основе все отключено). И она не запускается
Писал не я а ии (из-за того, что у меня нету опыта в программировании. Но есть +- представление что программа должна делать.)
Но она не работает (на виртулке пробую, потому-что на основе все отключено). И она не запускается
Писал не я а ии (из-за того, что у меня нету опыта в программировании. Но есть +- представление что программа должна делать.)
весь код C#:
using System;
using System.Diagnostics;
using System.IO;
using Microsoft.Win32;
using System.Runtime.InteropServices;
using System.Security.AccessControl;
using System.Threading;
using System.Security.Principal;
class ForensicCleaner
{
const int HOTKEY_ID_SHOW_HIDE = 1;
const int HOTKEY_ID_CLEANUP = 2;
const uint MOD_SHIFT = 0x0004;
const uint VK_F7 = 0x76; // F7
const uint VK_F5 = 0x74; // F5
[DllImport("user32.dll")]
public static extern bool RegisterHotKey(IntPtr hWnd, int id, uint fsModifiers, uint vk);
[DllImport("user32.dll")]
public static extern bool UnregisterHotKey(IntPtr hWnd, int id);
[DllImport("kernel32.dll")]
static extern IntPtr GetConsoleWindow();
[DllImport("user32.dll")]
static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
const int SW_HIDE = 0;
const int SW_SHOW = 5;
static bool consoleVisible = true;
static void Main(string[] args)
{
if (!IsRunningAsAdmin())
{
RelaunchAsAdmin();
return;
}
HideFromTaskManager();
Console.Title = "proverka 2";
IntPtr handle = GetConsoleWindow();
RegisterHotKey(handle, HOTKEY_ID_SHOW_HIDE, MOD_SHIFT, VK_F7);
RegisterHotKey(handle, HOTKEY_ID_CLEANUP, 0, VK_F5);
new Thread(HotkeyListener).Start();
// Показываем консоль сразу при запуске
ShowWindow(handle, SW_SHOW);
ShowMenu();
}
static bool IsRunningAsAdmin()
{
WindowsIdentity identity = WindowsIdentity.GetCurrent();
WindowsPrincipal principal = new WindowsPrincipal(identity);
return principal.IsInRole(WindowsBuiltInRole.Administrator);
}
static void RelaunchAsAdmin()
{
ProcessStartInfo psi = new ProcessStartInfo
{
FileName = Process.GetCurrentProcess().MainModule.FileName,
UseShellExecute = true,
Verb = "runas"
};
try
{
Process.Start(psi);
}
catch
{
Console.WriteLine("Не удалось получить права администратора.");
}
}
static void HideFromTaskManager()
{
try
{
Process current = Process.GetCurrentProcess();
current.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
}
catch { }
}
static void HotkeyListener()
{
while (true)
{
NativeMessage msg;
if (GetMessage(out msg, IntPtr.Zero, 0, 0))
{
if (msg.message == 0x0312) // WM_HOTKEY
{
if (msg.wParam == (IntPtr)HOTKEY_ID_SHOW_HIDE)
{
IntPtr console = GetConsoleWindow();
consoleVisible = !consoleVisible;
ShowWindow(console, consoleVisible ? SW_SHOW : SW_HIDE);
}
else if (msg.wParam == (IntPtr)HOTKEY_ID_CLEANUP)
{
CleanTraces();
}
}
}
}
}
static void ShowMenu()
{
Console.Clear();
Console.WriteLine("=== Forensic Cleaner ===");
Console.WriteLine("1 - Завершить процессы (ProcessHacker, SystemInformer и т.д.)");
Console.WriteLine("2 - Отключить реестр (определённые пути)");
Console.WriteLine("3 - Отключить службы и историю (Prefetch, Recent и т.д.)");
Console.WriteLine("4 - Отключить всё");
Console.WriteLine("5 - Восстановить всё");
Console.Write("Выбор: ");
var choice = Console.ReadLine();
switch (choice)
{
case "1": KillProcesses(); break;
case "2": LockRegistryKeys(); break;
case "3": DisableFeatures(); break;
case "4": KillProcesses(); LockRegistryKeys(); DisableFeatures(); break;
case "5": RestoreEverything(); break;
default: Console.WriteLine("Неверный выбор."); break;
}
Console.WriteLine("Готово. Нажмите любую клавишу...");
Console.ReadKey();
}
static void KillProcesses()
{
string[] targets = { "ProcessHacker", "SystemInformer", "ShellBagAnalyzer", "BrowserHistoryView", "" };
foreach (var proc in Process.GetProcesses())
{
foreach (var name in targets)
{
if (proc.ProcessName.Equals(name, StringComparison.OrdinalIgnoreCase))
{
try { proc.Kill(); Console.WriteLine($"Процесс завершён: {name}"); } catch { }
}
}
}
}
static void LockRegistryKeys()
{
string[] keysToLock = {
"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\TypedPaths",
"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\FeatureUsage\\AppSwitched",
"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\FeatureUsage\\ShowJumpView",
"Software\\Microsoft\\Windows NT\\CurrentVersion\\AppCompatFlags\\Compatibility Assistant\\Store",
"Software\\Classes\\Local Settings\\Software\\Microsoft\\Windows\\Shell\\BagMRU"
};
string currentUser = Environment.UserDomainName + "\\" + Environment.UserName;
foreach (string path in keysToLock)
{
try
{
using (RegistryKey key = Registry.CurrentUser.OpenSubKey(path, true))
{
if (key == null) continue;
RegistrySecurity security = new RegistrySecurity();
security.AddAccessRule(new RegistryAccessRule(currentUser,
RegistryRights.FullControl,
InheritanceFlags.None,
PropagationFlags.None,
AccessControlType.Deny));
key.SetAccessControl(security);
Console.WriteLine($"Заблокирован доступ к: {path}");
}
}
catch { }
}
}
static void DisableFeatures()
{
try
{
CleanTraces();
}
catch { }
}
static void CleanTraces()
{
try
{
// Prefetch
string prefetch = "C:\\Windows\\Prefetch";
foreach (var file in Directory.GetFiles(prefetch, "*.pf"))
{
if (file.ToLower().Contains("forensiccleaner")) File.Delete(file);
}
// Recent
string recent = Environment.GetFolderPath(Environment.SpecialFolder.Recent);
if (Directory.Exists(recent)) Directory.Delete(recent, true);
// AutomaticDestinations
string autoDest = Path.Combine(recent, "AutomaticDestinations");
if (Directory.Exists(autoDest)) Directory.Delete(autoDest, true);
// Win+R TypedPaths
Registry.CurrentUser.DeleteSubKeyTree("Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\TypedPaths", false);
}
catch { }
}
static void RestoreEverything()
{
Console.WriteLine("Функция восстановления требует ручной реализации: резервные .reg файлы, включение служб и т.д.");
}
// Структура для получения сообщений окна
[StructLayout(LayoutKind.Sequential)]
public struct NativeMessage
{
public IntPtr handle;
public uint message;
public IntPtr wParam;
public IntPtr lParam;
public uint time;
public System.Drawing.Point p;
}
[DllImport("user32.dll")]
public static extern bool GetMessage(out NativeMessage lpMsg, IntPtr hWnd, uint wMsgFilterMin, uint wMsgFilterMax);
}
Последнее редактирование: