Перейти к содержанию

black56rus

Стажёры
  • Постов

    10
  • Зарегистрирован

  • Посещение

Сообщения, опубликованные black56rus

  1. Полное имя процесса pointblank.exe.exe на конце два exe

    Видит его как PointBlank.exe

    С П А С И Б О !!!!!!!!

    Всё получилось !

    Keng как поднимать репу?

    Хочу тебе поднять.

    Keng ещё вопрос если можно.

    Как мне прописать нахождения сегнатуры для второй функции?

  2. Скампилилось нармально но по значению не чего не меняет.

    Хочу проверить Ставлю брейкпоинт он его не видет просто запускаеться форма.


    public Asm1()
    {
    InitializeComponent();
    GetProcess("pointblank.exe");
    //525927
    //var address = 0x006903B0;
    //var offsets = new byte[] { 0xC, 0x14, 0x0, 0x18 };
    //ReadBytes(address, offsets);
    FindSignature();
    }
    # region Импорт))
    [DllImport("kernel32.dll")]
    public static extern IntPtr OpenProcess(int dwDesiredAccess, bool bInheritHandle, int dwProcessId);
    [DllImport("kernel32.dll", SetLastError = true)]
    [return: MarshalAs(UnmanagedType.Bool)]
    static extern bool CloseHandle(IntPtr hObject);
    [DllImport("kernel32.dll", SetLastError = true)]
    static extern bool WriteProcessMemory(IntPtr hProcess, IntPtr lpBaseAddress, byte[] lpBuffer, uint nSize, out UIntPtr lpNumberOfBytesWritten);
    [DllImport("user32.dll", CharSet = CharSet.Auto)]
    static extern IntPtr SendMessage(IntPtr hWnd, int Msg, int wParam, int lParam);

    [DllImportAttribute("user32.dll")]
    public static extern bool ReleaseCapture();
    [DllImport("kernel32.dll", SetLastError = true)]
    static extern bool ReadProcessMemory(
    IntPtr hProcess,
    IntPtr lpBaseAddress,
    [Out] byte[] lpBuffer,
    int dwSize,
    out int lpNumberOfBytesRead
    );
    [DllImport("kernel32.dll", SetLastError = true)]
    static extern IntPtr VirtualAlloc(IntPtr lpAddress, UIntPtr dwSize,
    AllocationType flAllocationType, MemoryProtection flProtect);
    [DllImport("kernel32.dll", SetLastError = true)]
    static extern bool VirtualFree(IntPtr lpAddress, UIntPtr dwSize,
    uint dwFreeType);
    [Flags()]
    public enum AllocationType : uint
    {
    COMMIT = 0x1000,
    RESERVE = 0x2000,
    RESET = 0x80000,
    LARGE_PAGES = 0x20000000,
    PHYSICAL = 0x400000,
    TOP_DOWN = 0x100000,
    WRITE_WATCH = 0x200000
    }
    [Flags()]
    public enum MemoryProtection : uint
    {
    EXECUTE = 0x10,
    EXECUTE_READ = 0x20,
    EXECUTE_READWRITE = 0x40,
    EXECUTE_WRITECOPY = 0x80,
    NOACCESS = 0x01,
    READONLY = 0x02,
    READWRITE = 0x04,
    WRITECOPY = 0x08,
    GUARD_Modifierflag = 0x100,
    NOCACHE_Modifierflag = 0x200,
    WRITECOMBINE_Modifierflag = 0x400
    }
    [DllImport("kernel32.dll", SetLastError = true)]
    static extern IntPtr CreateToolhelp32Snapshot(SnapshotFlags dwFlags, uint th32ProcessID);
    [Flags]
    public enum SnapshotFlags : uint
    {
    HeapList = 0x00000001,
    Process = 0x00000002,
    Thread = 0x00000004,
    Module = 0x00000008,
    Module32 = 0x00000010,
    All = (HeapList | Process | Thread | Module),
    Inherit = 0x80000000,
    NoHeaps = 0x40000000
    }
    //[DllImport("kernel32.dll")]
    //static extern bool Module32First(IntPtr hSnapshot, ref MODULEENTRY32 lpme);
    #endregion
    public void GetProcess(string name)
    {
    var pList = Process.GetProcesses();
    if (pList.Count() != 0)
    {
    foreach (var process in pList)
    {
    if (process.ProcessName == name)
    {
    pID = process.Id;
    //MessageBox.Show("Process found!");
    return;
    }
    }
    }
    return;
    }
    public void WriteBytes(int address, byte[] bytes)
    {
    var dummy = new UIntPtr();
    if (pID != 0)
    {
    var handle = OpenProcess(0x001F0FFF, false, pID);
    WriteProcessMemory(handle, (IntPtr)address, bytes, (uint)bytes.Length, out dummy);
    CloseHandle(handle);
    }
    }
    public int FindSignature()
    {
    var moduleName = "NxCharacter.2.8.1.dll";
    var startAddress = 0;
    var sizeToAllocate = 0;
    var pattern = new int[] {137, 144, -1, -1, -1, -1, 139, 80, 16, 221, 4, 209, 139, 136, -1, -1, -1, -1};
    if (pID != 0)
    {
    foreach (var p in Process.GetProcesses())
    {
    if (p.Id ==pID)
    {
    foreach (ProcessModule m in p.Modules)
    {
    if (m.ModuleName == moduleName)
    {
    startAddress = (int)m.BaseAddress;
    sizeToAllocate = m.ModuleMemorySize;
    break;
    }
    }
    }
    }
    var handle = OpenProcess(0x001F0FFF, false, pID);
    if (handle != IntPtr.Zero)
    {
    byte[] buffer = new byte[sizeToAllocate];
    int bytesread;
    ReadProcessMemory(handle, (IntPtr)startAddress, buffer, sizeToAllocate, out bytesread);
    CloseHandle(handle);
    var counter = 0;
    if (pattern.Length <= buffer.Length)
    {
    for (var i = 0; i < buffer.Length; i++)
    {
    if (buffer[i] == pattern[0] | pattern[0] == -1)
    {
    for (var j = 0; j < pattern.Length; j++)
    {
    if (buffer[i + j] == pattern[j] | pattern[j] == -1)
    {
    counter++;
    if (counter == pattern.Length)
    {
    var result = i + startAddress;
    return (int)result;
    }
    }
    else
    {
    counter = 0;
    }
    }
    }
    }
    }
    }
    }
    return -1;
    }

    private void button1_Click(object sender, EventArgs e)
    {
    var myFoundAddress = FindSignature(); //Вызов возвратит тебе или -1 (если не нашёл), или адрес (если нашёл)
    if(myFoundAddress!=-1)//Проверяем, что адрес найден
    {
    //var handle = OpenProcess(All, false, pID);//Получаем хендл процесса с правами на запись в память
    //if(handle!=0)//Проверяем, что хэндл получен


    byte[] myValues = new byte[] { 0x90, 0x90, 0x90, 0x90, 0x90, 0x90 };
    var size = 6;
    var dummy = new UIntPtr();
    var handle = OpenProcess(0x1F0FFF, false, pID);
    WriteProcessMemory(handle, (IntPtr)myFoundAddress, myValues, (uint)size, out dummy);//Пишем 0)
    CloseHandle(handle); //Закрываем хэндл

    }
    }

  3. Привет! Примерно так:


    var myFoundAddress = FindSignature(); //Вызов возвратит тебе или -1 (если не нашёл), или адрес (если нашёл)
    if(myFoundAddress!=-1) { //Проверяем, что адрес найден
    var handle = OpenProcess(All, false, pID); //Получаем хендл процесса с правами на запись в память
    if(handle!=0) { //Проверяем, что хэндл получен
    WriteProcessMemory(handle, myFoundAddress, myValues, 0); //Пишем
    CloseHandle(handle); //Закрываем хэндл
    }
    }

    Псевдокод, но должно быть понятно. Для удобства можно чуть видоизменить метод сканирования - добавить в аргументы имя модуля и сигнатуру, типа того:

    public int FindSignature(string module, int[] signature)

    Keng как байты вставить ?

    { 0x90, 0x90, 0x90, 0x90, 0x90, 0x90 };


    WriteProcessMemory(handle, myFoundAddress, myValues, 0); //Пишем

  4. Здравствуйте!

    Я хотел обратиться с таким вопросам.

    Мы через сигнатуру нашли адрес, как теперь прописать своё значения в этот адрес?


    public int FindSignature()
    {
    var moduleName = "NxCharacter.2.8.1.dll";
    var startAddress = 0;
    var sizeToAllocate = 0;
    var pattern = new int[] {137, 144, -1, -1, -1, -1, 139, 80, 16, 221, 4, 209, 139, 136, -1, -1, -1, -1};
    if (pID != 0)
    {
    foreach (var p in Process.GetProcesses())
    {
    if (p.Id ==pID)
    {
    foreach (ProcessModule m in p.Modules)
    {
    if (m.ModuleName == moduleName)
    {
    startAddress = (int)m.BaseAddress;
    sizeToAllocate = m.ModuleMemorySize;
    break;
    }
    }
    }
    }
    var handle = OpenProcess(0x001F0FFF, false, pID);
    if (handle != IntPtr.Zero)
    {
    byte[] buffer = new byte[sizeToAllocate];
    int bytesread;
    ReadProcessMemory(handle, (IntPtr)startAddress, buffer, sizeToAllocate, out bytesread);
    CloseHandle(handle);
    var counter = 0;
    if (pattern.Length <= buffer.Length)
    {
    for (var i = 0; i < buffer.Length; i++)
    {
    if (buffer[i] == pattern[0] | pattern[0] == -1)
    {
    for (var j = 0; j < pattern.Length; j++)
    {
    if (buffer[i + j] == pattern[j] | pattern[j] == -1)
    {
    counter++;
    if (counter == pattern.Length)
    {
    var result = i + startAddress;
    return (int)result;
    }
    }
    else
    {
    counter = 0;
    }
    }
    }
    }
    }
    }
    }
    return -1;
    }

    Заранее благодарю за ответ!

×
×
  • Создать...

Важная информация

Находясь на нашем сайте, Вы автоматически соглашаетесь соблюдать наши Условия использования.