Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "pch.h"
- #include <iostream>
- #include <Windows.h>
- #include <ctime>
- #include <string>
- #include <cmath>
- DWORD FindDmaAddy(int PointerLevel, HANDLE hProcHandle, DWORD Offsets[], DWORD BaseAddress);
- void WriteToMemory(HANDLE hProcHandle);
- using namespace std;
- std::string GameName = "AssaultCube";
- LPCSTR LGameWindow = "AssaultCube";
- std::string GameStatus;
- bool IsGameAvail;
- bool UpdateOnNextRun;
- //ammo variable
- bool AmmoStatus;
- BYTE AmmoValue[] = {0xA3, 0x1C, 0x0, 0x0};
- DWORD AmmoBaseAddress = {0x509B74};
- DWORD AmmoOffsets[] = {0x374, 0x14, 0x0};
- //health variable
- bool HealthStatus;
- BYTE HealthValue[] = { 0x39, 0x5, 0x0, 0x0 };
- DWORD HealthBaseAddress = {0x50f4f4};
- 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();
- IsGameAvail = 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 = "AssaultCube Ready To Hack";
- IsGameAvail = true;
- }
- }
- else GameStatus = "failed to get process id";
- }
- else {
- GameStatus = "Assault not found";
- }
- if (UpdateOnNextRun || clock() - timeSinceLastUpdate > 5000) {
- system("cls");
- cout << " ---------------------------------------------------- \n";
- cout << "| AssaultCube Memory Hack by Ori's hacking tutorials| \n";
- cout << " ---------------------------------------------------- \n";
- cout << "Game status: " << GameStatus << endl <<endl;
- cout << "[F1] Unlimited Ammo --> " << sAmmoStatus << " <--" << endl << endl;
- cout << "[F2] Unlimited Health --> " << sHealthStatus << " <--" << endl << endl;
- cout << "[INSERT] Exit" <<endl;
- UpdateOnNextRun = false;
- timeSinceLastUpdate = clock();
- }
- if (IsGameAvail) {
- //write to memory
- WriteToMemory(hProcHandle);
- }
- }
- if (clock() - onePressTMR > 400) {
- if (IsGameAvail) {
- //ammo
- if (GetAsyncKeyState(VK_F1)) {
- onePressTMR = clock();
- AmmoStatus = !AmmoStatus;
- UpdateOnNextRun = true;
- if (AmmoStatus)sAmmoStatus = "ON";
- else sAmmoStatus = "OFF";
- } // if press f1
- //health
- else if (GetAsyncKeyState(VK_F2)) {
- onePressTMR = clock();
- HealthStatus = !HealthStatus;
- UpdateOnNextRun = true;
- if (HealthStatus)sHealthStatus = "ON";
- else sHealthStatus = "OFF";
- } // if press F2
- else if (GetAsyncKeyState(VK_INSERT)) {
- return false;
- }
- } // is game avail
- }// if
- } // stop while
- //CloseHandle(hProcHandle);
- //CloseHandle(hGameWindow);
- return ERROR_SUCCESS;
- } // main
- DWORD FindDmaAddy(int PointerLevel, HANDLE hProcHandle, DWORD Offsets[], DWORD BaseAddress) {
- DWORD pointer = BaseAddress;
- DWORD pTemp;
- DWORD pointerAddr;
- for (int c = 0; c < PointerLevel; c++) {
- if (c == 0) {
- ReadProcessMemory(hProcHandle, (LPCVOID)pointer, &pTemp, sizeof(pTemp), NULL);
- }
- pointerAddr = pTemp + Offsets[c];
- ReadProcessMemory(hProcHandle, (LPCVOID)pointerAddr, &pTemp, sizeof(pTemp), NULL);
- }
- return pointerAddr;
- }
- void WriteToMemory(HANDLE hProcHandle) {
- DWORD AddressToWrite;
- if (AmmoStatus) {
- AddressToWrite = FindDmaAddy(3, hProcHandle,AmmoOffsets, AmmoBaseAddress);
- WriteProcessMemory(hProcHandle, (BYTE*)AddressToWrite, &AmmoValue, sizeof(AmmoValue), NULL);
- }
- if (HealthStatus) {
- AddressToWrite = FindDmaAddy(1, hProcHandle, HealthOffsets, HealthBaseAddress);
- WriteProcessMemory(hProcHandle, (BYTE*)AddressToWrite, &HealthValue, sizeof(HealthValue), NULL);
- }
- }
Add Comment
Please, Sign In to add comment