Skip to content

Instantly share code, notes, and snippets.

@splitline
Created December 21, 2017 09:26
Show Gist options
  • Select an option

  • Save splitline/20f3ca260a71b2e0c77248cf42693745 to your computer and use it in GitHub Desktop.

Select an option

Save splitline/20f3ca260a71b2e0c77248cf42693745 to your computer and use it in GitHub Desktop.
#include <iostream>
#include <Windows.h>
using namespace std;
int _baseAddress = 0x5B15825C;
int main(){
DWORD pid;
HANDLE hProcess;
HWND hWnd = FindWindow(NULL, "NS-TOWER");
if(!hWnd) {
cout << "can't find the game" << endl;
getchar();
return 1;
}
GetWindowThreadProcessId(hWnd, &pid);
hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pid);
if(!hProcess) {
cout << "open process fail at code : " << GetLastError() << endl;
getchar();
return 1;
}
cout << "===========Start===========" << endl;
int baseAddress;
ReadProcessMemory(hProcess, (LPCVOID)(_baseAddress), (LPVOID)&baseAddress, 4, NULL );
int fullPower = 12;
int power;
while(1) {
ReadProcessMemory(hProcess, (LPCVOID)(baseAddress + 0x000011A8), (LPVOID)&power, 4, NULL );
if(power != fullPower) {
cout << "Your power is " << power << ", now change it to 12."<< endl;
WriteProcessMemory(hProcess, (LPVOID)(baseAddress + 0x000011A8), (LPCVOID)&fullPower, 4, NULL );
}
}
CloseHandle(hProcess);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment