|
Cheat Engine The Official Site of Cheat Engine
|
View previous topic :: View next topic |
Author |
Message |
LoserNOob Guest
|
Posted: Mon Mar 06, 2017 3:07 pm Post subject: Converting aob injection template to c++ code, NOP |
|
|
Ok so I'm trying to convert an aob template to c++ code.
This is the script. ->
[ENABLE]
aobscan(INJECT,8B 84 18 0C 02 00 00) // should be unique
alloc(newmem,$1000)
label(code)
label(return)
newmem:
code:
// mov eax,[eax+ebx+0000020C]
jmp return
INJECT:
jmp newmem
nop
nop
return:
registersymbol(INJECT)
[DISABLE]
INJECT:
db 8B 84 18 0C 02 00 00
unregistersymbol(INJECT)
dealloc(newmem)
Now , this is my attempt at c++ to convert it.
#include <iostream>
#include <Windows.h>
using namespace std;
int main()
{
HWND hwnd = FindWindowA(NULL, "GraalOnline Classic - Mozilla Firefox");
if (hwnd == NULL)
{
cout << "Could not find window." << endl;
Sleep(5000);
exit(-1);
}
else
{
DWORD procID;
GetWindowThreadProcessId(hwnd, &procID);
HANDLE handle = OpenProcess(PROCESS_ALL_ACCESS, FALSE, procID);
if (procID == NULL)
{
cout << "Process was not found." << endl;
Sleep(5000);
exit(-1);
}
else {
WriteProcessMemory(handle, address, 0x90, 1, NULL);
}
}
Now the problem is the address. The address changes every single time and I have tried to find the base address using pointer scans but for some reason that has not worked out for me. Is it mandatory to give the address in order to NOP the bytes? In my case , it is 8B 84 18 0C 02 00 00.
|
|
Back to top |
|
|
LoserNOob Guest
|
Posted: Mon Mar 06, 2017 3:14 pm Post subject: |
|
|
Nvm, ima try something out.
|
|
Back to top |
|
|
LoserNOob Guest
|
Posted: Tue Mar 07, 2017 7:38 pm Post subject: |
|
|
All right , so I revised my code and now it looks like this ->
#include <iostream>
#include <Windows.h>
#include <WinDef.h>
using namespace std;
int main()
{
HWND hwnd = FindWindowA(NULL, "window");
if (hwnd == NULL)
{
cout << "Could not find window." << endl;
Sleep(5000);
exit(-1);
}
else
{
DWORD procID;
GetWindowThreadProcessId(hwnd, &procID);
HANDLE handle = OpenProcess(PROCESS_ALL_ACCESS, FALSE, procID);
if (procID == NULL)
{
cout << "Cannot find window" << endl;
Sleep(5000);
exit(-1);
}
else
{
if (GetAsyncKeyState(VK_SPACE))
{
BYTE nop[] = { 0x90 };
WriteProcessMemory(handle, (LPVOID*)(void *)0x0909A41F, &nop, 1, NULL);
}
if (GetAsyncKeyState(VK_INSERT))
{
cout << "aa" << endl;
}
}
}
return 0;
}
Problem is , the program exits like this right after I debug it-> .exe has exited with code 0 (0x0)
|
|
Back to top |
|
|
LoserNOob Guest
|
Posted: Tue Mar 07, 2017 7:54 pm Post subject: |
|
|
Nvm im so dumb.
|
|
Back to top |
|
|
|
|
You can post new topics in this forum You can reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum
|
|