daily pastebin goal
84%
SHARE
TWEET

Untitled

a guest Jul 17th, 2018 176 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. //From http://Boxvision.xyz
  2.  
  3.  
  4.  
  5. #include <Windows.h>
  6. #include <iostream>
  7. #include <vector>
  8. #include <TlHelp32.h>
  9. #include <tchar.h>
  10.  
  11. using namespace std;
  12.  
  13.  
  14. DWORD dwGetModuleBaseAddress(TCHAR *lpszModuleName, DWORD pID) {
  15.     DWORD dwModuleBaseAddress = 0;
  16.     HANDLE hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, pID);
  17.     MODULEENTRY32 ModuleEntry32 = { 0 };
  18.     ModuleEntry32.dwSize = sizeof(MODULEENTRY32);
  19.  
  20.     if (Module32First(hSnapshot, &ModuleEntry32))
  21.     {
  22.         do {
  23.             if (_tcscmp(ModuleEntry32.szModule, lpszModuleName) == 0)
  24.             {
  25.                 dwModuleBaseAddress = (DWORD)ModuleEntry32.modBaseAddr;
  26.                 break;
  27.             }
  28.         } while (Module32Next(hSnapshot, &ModuleEntry32));
  29.  
  30.  
  31.     }
  32.     CloseHandle(hSnapshot);
  33.     return dwModuleBaseAddress;
  34. }
  35.  
  36.  
  37.  
  38.  
  39.  
  40. int main() {
  41.     DWORD pID;
  42.     DWORD off1, off2, off3, off4;
  43.     DWORD baseAddress;
  44.     DWORD healthAddy;
  45.     int newHealth = 12345;
  46.     int currentHealth;
  47.     char moduleName[] = "client.dll";
  48.     HWND hGameWindow;
  49.     HANDLE pHandle;
  50.  
  51.     //Get Handles
  52.     hGameWindow = FindWindow(NULL, "Counter-Strike: Global Offensive");
  53.     GetWindowThreadProcessId(hGameWindow, &pID);
  54.     pHandle = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pID);
  55.  
  56.     //Get Client Base Addy
  57.     DWORD clientBase = dwGetModuleBaseAddress(_T(moduleName), pID);
  58.     ReadProcessMemory(pHandle, (LPCVOID)(clientBase + 0x04EDCF74), &baseAddress, sizeof(baseAddress), NULL);
  59.     cout << "Base Addy is: " << std::hex << baseAddress << std::endl;
  60.     ReadProcessMemory(pHandle, (LPCVOID)(baseAddress + 0x34), &off1, sizeof(off1), NULL);
  61.     cout << "Offset 1: " << std::hex << off1 << std::endl;
  62.     ReadProcessMemory(pHandle, (LPCVOID)(off1 + 0x68), &off2, sizeof(off2), NULL);
  63.     cout << "Offset 2: " << std::hex << off2 << std::endl;
  64.     ReadProcessMemory(pHandle, (LPCVOID)(off2 + 0x568), &off3, sizeof(off3), NULL);
  65.     cout << "Offset 3: " << std::hex << off3 << std::endl;
  66.     healthAddy = off3 + 0x110;
  67.     cout << "Final Addy: " << std::hex << healthAddy << std::endl;
  68.     ReadProcessMemory(pHandle, (LPCVOID)(healthAddy), &currentHealth, 4, NULL);
  69.     cout << "Health: " << currentHealth << std::endl;
  70.     WriteProcessMemory(pHandle,(LPVOID)(healthAddy), &newHealth, sizeof(newHealth), 0);
  71.     ReadProcessMemory(pHandle, (LPCVOID)(healthAddy), &currentHealth, 4, NULL);
  72.     cout << "Health: " << currentHealth << std::endl;
  73.     cin.get();
  74. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top