1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164
|
#include <iostream>
#include <windows.h>
#include <string>
#include <ctime>
void WriteToMemory(HANDLE hProcHandle);
DWORD FindDmaAddy(int PointerLevel, HANDLE hProcHandle, DWORD offsets[], DWORD BaseAddress);
std::string Gamename = "AssaultCube";
LPCSTR LGameWindow = "AssaultCube";
std::string GameStatus;
bool GameAvail;
bool UpdateOnNextRun;
//Ammo vars
bool AmmoStatus;
BYTE AmmoValue[] = {0xA3,0x1C,0x0,0x0};
DWORD AmmoBaseAddress = {0x00508B74};
DWORD AmmoOffsets[] = {0x384,0x14,0x0};
//Health Vars
bool HealthStatus;
BYTE HealthValue[] = {0x39,0x5,0x0,0x0};
DWORD HealthBaseAddress = {0x0050E4F4};
DWORD HealthOffsets = {0xF8};
int main()
{
HWND hGameWindow = NULL;
int timesincelastupdate = clock();
int GameAvailTMR = clock();
int OnePressTMR = clock();
DWORD dwprocID = NULL;
HANDLE hProcHandle = NULL;
UpdateOnNextRun = true;
std::string sAmmoStatus = "OFF";
std::string sHealthStatus = "OFF";
while(!GetAsyncKeyState(VK_INSERT))
{
if(clock() - GameAvailTMR > 100)
{
GameAvailTMR = clock();
GameAvail = false;
hGameWindow = FindWindow(NULL, LGameWindow);
if(hGameWindow)
{
GetWindowThreadProcessId(hGameWindow, &dwprocID);
if(dwprocID != 0)
{
hProcHandle = OpenProcess(PROCESS_ALL_ACCESS, FALSE, dwprocID);
if(hProcHandle == INVALID_HANDLE_VALUE || hProcHandle == NULL)
{
GameStatus = "Failed to open process for valid handle!";
}
else
{
GameStatus = "Ready to hack!";
GameAvail = true;
};
}
else
{
GameStatus = "Failed to get process ID";
};
}
else
{
GameStatus = "Assault Cube not found!";
};
if(UpdateOnNextRun || clock() - timesincelastupdate > 5000)
{
system("cls");
std::cout << "------------------------------------------------" << std::endl;
std::cout << " Assault Cube Memory Hacker " << std::endl;
std::cout << "------------------------------------------------" << std::endl << std::endl;
std::cout << "Game Status: " << GameStatus << std::endl << std::endl;
std::cout << "[F1] Unlimited Ammo " << sAmmoStatus << " <" << std::endl;
std::cout << "[F2] Unlimited Health " << sHealthStatus << " <" << std::endl;
std::cout << "[Insert] Exit" << std::endl;
UpdateOnNextRun = false;
timesincelastupdate = clock();
}
if(GameAvail)
{
WriteToMemory(hProcHandle);
}
}
if (clock() - OnePressTMR > 400)
{
if(GameAvail)
{
if(GetAsyncKeyState(VK_F1))
{
OnePressTMR = clock();
AmmoStatus = !AmmoStatus;
UpdateOnNextRun = true;
if(AmmoStatus)sAmmoStatus = "ON";
else sAmmoStatus = "OFF";
}
if(GetAsyncKeyState(VK_F2))
{
OnePressTMR = clock();
HealthStatus = !HealthStatus;
UpdateOnNextRun = true;
if(AmmoStatus)sHealthStatus = "ON";
else sHealthStatus = "OFF";
}
}
}
CloseHandle(hProcHandle);
CloseHandle(hGameWindow);
}
return ERROR_SUCCESS;
}
DWORD FindDmaAddy(int PointerLevel, HANDLE hProcHandle, DWORD Offsets[], DWORD BaseAddress)
{
DWORD pointer = BaseAddress;
DWORD ptemp;
DWORD pointerAddr;
for(int i = 0; i < PointerLevel; i ++)
{
if(i == 0)
{
ReadProcessMemory(hProcHandle, (LPCVOID)pointer, &ptemp, 4, NULL);
}
pointerAddr = ptemp + Offsets[i];
ReadProcessMemory(hProcHandle, (LPCVOID)pointerAddr, &ptemp, 4, NULL);
}
return pointerAddr;
}
void WriteToMemory(HANDLE hProcHandle)
{
if(AmmoStatus)
{
DWORD AmmoAddressToWrite = FindDmaAddy(3, hProcHandle, AmmoOffsets, AmmoBaseAddress);
WriteProcessMemory( hProcHandle, (BYTE*)AmmoAddressToWrite, &AmmoValue, sizeof(AmmoValue), NULL);
}
if(HealthStatus)
{
DWORD HealthAddressToWrite = FindDmaAddy(1, hProcHandle, HealthOffsets, HealthBaseAddress);
WriteProcessMemory( hProcHandle, (BYTE*)HealthAddressToWrite, &HealthValue, sizeof(HealthValue), NULL);
}
}
|