Загрузка...

C# Lessons / Autoinject for cheat.

Thread in C# created by AlinGod Dec 8, 2019. 335 views

The poll
Выкладывать темы/сорсы проектов старых?
  1. Да

    83.3%
    15
  2. Нет

    16.7%
    3
  1. AlinGod
    AlinGod Topic starter Dec 8, 2019 Banned 47 Jun 3, 2016
    Привет,интересно ли тебе чтоб я вылаживал сюда какие-то наработки по C#?
    Есть наработки разных проектов которыми я больше не занимаюсь.

    Вот пример не плохого автоинжектора для warface в консоли(переделать под winform не составит труда).
    Создаем класс: Inject.cs
    Code


    namespace KingHackPrivate
    {
    using System;
    using System.Diagnostics;
    using System.Runtime.InteropServices;
    using System.Threading;

    public class Inject.cs
    {
    [DllImport("kernel32.dll", SetLastError=true)]
    private static extern bool CloseHandle(IntPtr hHandle);
    [DllImport("kernel32")]
    public static extern IntPtr CreateRemoteThread(IntPtr hProcess, IntPtr lpThreadAttributes, uint dwStackSize, UIntPtr lpStartAddress, IntPtr lpParameter, uint dwCreationFlags, out UIntPtr lpThreadId);
    [DllImport("kernel32.dll", CharSet=CharSet.Auto)]
    public static extern IntPtr GetModuleHandle(string lpModuleName);
    [DllImport("kernel32.dll", CharSet=CharSet.Ansi, ExactSpelling=true)]
    public static extern UIntPtr GetProcAddress(IntPtr hModule, string procName);
    public static bool DDLL(Process process, string strDLLName)
    {
    IntPtr ptr2;
    uint num2;
    UIntPtr ptr5;
    IntPtr hProcess = OpenProcess(ProcessAccessFlags.All, false, process.Id);
    bool flag2 = 0 == 0;
    int num = strDLLName.Length + 1;
    IntPtr lpAddress = VirtualAllocEx(hProcess, IntPtr.Zero, (uint) num, 0x3000, 4);
    VirtualProtect(lpAddress, (uint) num, 4, out num2);
    WriteProcessMemory(hProcess, lpAddress, strDLLName, (UIntPtr) num, out ptr2);
    UIntPtr procAddress = GetProcAddress(GetModuleHandle("kernel32.dll"), "LoadLibraryA");
    flag2 = 0 == 0;
    IntPtr hHandle = CreateRemoteThread(hProcess, IntPtr.Zero, 0, procAddress, lpAddress, 0, out ptr5);
    flag2 = 0 == 0;
    Thread.Sleep(100);
    VirtualFreeEx(hProcess, lpAddress, (UIntPtr) 0, 0x8000);
    flag2 = 1 == 0;
    CloseHandle(hHandle);
    CloseHandle(hProcess);
    return true;
    }

    [DllImport("kernel32.dll")]
    private static extern IntPtr OpenProcess(ProcessAccessFlags dwDesiredAccess, [MarshalAs(UnmanagedType.Bool)] bool bInheritHandle, int dwProcessId);
    [DllImport("kernel32.dll", SetLastError=true, ExactSpelling=true)]
    private static extern IntPtr VirtualAllocEx(IntPtr hProcess, IntPtr lpAddress, uint dwSize, uint flAllocationType, uint flProtect);
    [DllImport("kernel32.dll", SetLastError=true, ExactSpelling=true)]
    private static extern bool VirtualFreeEx(IntPtr hProcess, IntPtr lpAddress, UIntPtr dwSize, uint dwFreeType);
    [DllImport("kernel32.dll", SetLastError=true)]
    private static extern bool VirtualProtect(IntPtr lpAddress, uint dwSize, uint flNewProtect, out uint lpflOldProtect);
    [DllImport("kernel32.dll")]
    private static extern bool WriteProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, string lpBuffer, UIntPtr nSize, out IntPtr lpNumberOfBytesWritten);

    [Flags]
    private enum ProcessAccessFlags : uint
    {
    All = 0x1fffff,
    CreateThread = 2,
    DupHandle = 0x40,
    QueryInformation = 0x400,
    SetInformation = 0x200,
    Synchronize = 0x100000,
    Terminate = 1,
    VMOperation = 8,
    VMRead = 0x10,
    VMWrite = 0x20
    }

    [Flags]
    public enum Protection : uint
    {
    PAGE_EXECUTE = 0x10,
    PAGE_EXECUTE_READ = 0x20,
    PAGE_EXECUTE_READWRITE = 0x40,
    PAGE_EXECUTE_WRITECOPY = 0x80,
    PAGE_GUARD = 0x100,
    PAGE_NOACCESS = 1,
    PAGE_NOCACHE = 0x200,
    PAGE_READONLY = 2,
    PAGE_READWRITE = 4,
    PAGE_WRITECOMBINE = 0x400,
    PAGE_WRITECOPY = 8
    }
    }
    }


    Теперь перейдем в сам код Program.cs
    Code

    internal class Program
    {
    private const int ICON_BIG = 1;
    private const int ICON_SMALL = 0;
    private const int SW_HIDE = 0;
    private const int WM_SETICON = 0x80;

    [DllImport("kernel32.dll", SetLastError=true)]
    private static extern IntPtr GetConsoleWindow();
    [DllImport("kernel32.dll", SetLastError=true)]
    private static extern IntPtr GetStdHandle(int dwType);
    private static void Main()
    {
    Console.WindowWidth = 0x3d;
    Console.WindowHeight = 20;
    Console.Title = "Автоинжектор"; // Название консоли
    IntPtr consoleWindow = GetConsoleWindow();
    PostMessage(consoleWindow, 0x80, 0, Resources.King.Handle);
    PostMessage(consoleWindow, 0x80, 1, Resources.King.Handle);
    Process[] processesByName = Process.GetProcessesByName("Game"); // Название игры
    if (processesByName.Length > 0)
    {
    Console.Beep();
    Console.ForegroundColor = ConsoleColor.Green;
    Console.WriteLine("-----------------------------------------------Игра Запущена!");
    ConsoleKeyInfo info = new ConsoleKeyInfo();
    do
    {
    Console.ForegroundColor = ConsoleColor.Red;
    WriteAt("+", 15, 3);
    WriteAt("|", 15, 4);
    WriteAt("|", 15, 5);
    WriteAt("|", 15, 6);
    WriteAt("+", 15, 7);
    WriteAt("---------------------------------+", 0x10, 3);
    WriteAt("---------------------------------+", 0x10, 7);
    WriteAt("-", 0x2f, 7);
    WriteAt("+", 0x31, 7);
    WriteAt("|", 0x31, 4);
    WriteAt("|", 0x31, 5);
    WriteAt("|", 0x31, 6);
    WriteAt("Запустить чит [Нажмите SPACE]", 0x12, 5);
    //------------------------------------------------
    Console.ForegroundColor = ConsoleColor.Cyan;
    WriteAt("+", 15, 9);
    WriteAt("|", 15, 10);
    WriteAt("|", 15, 11);
    WriteAt("|", 15, 12);
    WriteAt("+", 15, 14);
    WriteAt("|", 15, 13);
    WriteAt("---------------------------------+", 0x10, 9);
    WriteAt("---------------------------------+", 0x10, 14);
    //WriteAt("-", 0x1f, 7);
    // WriteAt("+", 0x31, 7);
    WriteAt("|", 0x31, 10);
    WriteAt("|", 0x31, 11);
    WriteAt("|", 0x31, 12);
    WriteAt("|", 0x31, 13);
    WriteAt("АвтоИнжектор для игры WarFace", 0x12, 10);
    WriteAt("Сreated:#King Team:SystemBot", 0x11, 11);
    WriteAt("Купить приват Skype: ***", 0x11, 12);
    WriteAt("Пример: LOLZTEAM.ORG", 0x11, 13);
    //---------------------------------------


    while (!Console.KeyAvailable)
    {
    Thread.Sleep(250);
    }
    info = Console.ReadKey(true);
    }
    while (info.Key != ConsoleKey.Spacebar);
    string path = Environment.GetFolderPath(Environment.SpecialFolder.InternetCache) + "mdll.dll"; //патч длл
    FileStream stream = new FileStream(path, FileMode.Create);
    stream.Write(Resources.mdll, 0, Resources.mdll.Length);
    stream.Close();
    if (File.Exists(path))
    {
    Inject.DDLL(processesByName[0], path);
    }
    else
    {
    Console.WriteLine("\n\n\n DLL не найден!");
    Thread.Sleep(0x41a);
    Environment.Exit(0);
    }
    WriteAt(@"/-------/Успешно!\-------/", 15, 9);
    Thread.Sleep(0x41a);
    Console.Clear();
    Console.ForegroundColor = ConsoleColor.Green;
    Console.WriteLine("------------------------------------------------------Exiting");
    Console.ForegroundColor = ConsoleColor.Red;
    Console.WriteLine("\n\n\n Закрытие через 3 (сек)");
    Thread.Sleep(900);
    Console.Clear();
    Console.ForegroundColor = ConsoleColor.Green;
    Console.WriteLine("------------------------------------------------------Exiting");
    Console.ForegroundColor = ConsoleColor.Red;
    Console.WriteLine("\n\n Закрытие через 2 (сек)");
    Thread.Sleep(900);
    Console.Clear();
    Console.ForegroundColor = ConsoleColor.Green;
    Console.WriteLine("------------------------------------------------------Exiting");
    Console.ForegroundColor = ConsoleColor.Red;
    Console.WriteLine("\n Закрытие через 1 (сек)");
    Thread.Sleep(900);
    Process.Start("http://h-hack.ru/");
    Process.Start("http://pbhack.ru/ph/36.html");
    Environment.Exit(0);
    Console.Read();
    }
    else
    {
    ShowWindow(consoleWindow, 0);
    MessageBox(IntPtr.Zero, "Запусти игру!", "Info", 0);
    //Если игра не запущена.
    }
    }

    [DllImport("user32.dll", CharSet=CharSet.Auto)]
    private static extern int MessageBox(IntPtr hWnd, string text, string caption, int options);
    [DllImport("user32.dll", SetLastError=true)]
    private static extern uint PostMessage(IntPtr hWnd, int uMsg, int wParam, IntPtr lParam);
    [DllImport("user32.dll")]
    private static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
    protected static void WriteAt(string s, int x, int y)
    {
    try
    {
    Console.SetCursorPosition(x, y);
    Console.Write(s);
    }
    catch (ArgumentOutOfRangeException exception)
    {
    Console.Clear();
    Console.WriteLine(exception.Message);
    }
    }
    }

     
Top
Loading...