Advertisement
Guest User

Untitled

a guest
Jun 24th, 2019
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.49 KB | None | 0 0
  1. #include <iostream>
  2. #include <Windows.h>
  3. #include <TlHelp32.h>
  4. #include <thread>
  5.  
  6. const DWORD dwLocalPlayer = 0xCBD6A4;
  7. const DWORD dwEntityList = 0x4CCDCBC;
  8. const DWORD m_iTeamNum = 0xF4;
  9. const DWORD m_iGlowIndex = 0xA3F8;
  10. const DWORD dwGlowObjectManager = 0x520DAE0;
  11.  
  12. HANDLE process;
  13. DWORD clientBase;
  14. DWORD engineBase;
  15.  
  16. bool wh = true;
  17.  
  18. DWORD getModuleBaseAddress(DWORD pid, const char* name)
  19. {
  20.     HANDLE snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, pid);
  21.     MODULEENTRY32 mEntry;
  22.     mEntry.dwSize = sizeof(MODULEENTRY32);
  23.     do
  24.     {
  25.         if (!strcmp(mEntry.szModule, name))
  26.         {
  27.             CloseHandle(snapshot);
  28.             return (DWORD)mEntry.modBaseAddr;
  29.         }
  30.     } while (Module32Next(snapshot, &mEntry));
  31. }
  32.  
  33. template <typename T>
  34. T readMem(DWORD address)
  35. {
  36.     T buffer;
  37.     ReadProcessMemory(process, (LPVOID)address, &buffer, sizeof(buffer), 0);
  38.     return buffer;
  39. }
  40.  
  41. template <typename T>
  42. void writeMem(DWORD address, T value)
  43. {
  44.     WriteProcessMemory(process, (LPVOID)address, &value, sizeof(value), 0);
  45. }
  46.  
  47. int main() {
  48.     std::thread whThread(wallhack)
  49.         while (true)
  50.         {
  51.  
  52.             if (GetAsyncKeyState(VK_F9))
  53.             {
  54.                 wh = !wh;
  55.                 if (wh)
  56.                     std::cout("PulaHook: ON\n");
  57.                 else
  58.                     std::cout("PulaHook: OFF\n");
  59.  
  60.                 Sleep(100);
  61.             }
  62.  
  63.         }
  64.  
  65.  
  66.     SetConsoleTitle("PulaHook ESP");
  67.  
  68.     std::cout << "-> Please open Counter-Strike: Global Offensive\n";
  69.  
  70.     HWND hwnd;
  71.  
  72.     do {
  73.         hwnd = FindWindowA(0, "Counter-Strike: Global Offensive");
  74.         Sleep(50);
  75.     } while (!hwnd);
  76.  
  77.     DWORD pid;
  78.     GetWindowThreadProcessId(hwnd, &pid);
  79.     process = OpenProcess(PROCESS_ALL_ACCESS, FALSE, pid);
  80.  
  81.     std::cout << "-> Counter-Strike: Global Offensive Detected!, pid " << pid << ".\n";
  82.  
  83.     do {
  84.         clientBase = getModuleBaseAddress(pid, "client_panorama.dll");
  85.         Sleep(50);
  86.     } while (!clientBase);
  87.  
  88.     do {
  89.         engineBase = getModuleBaseAddress(pid, "engine.dll");
  90.         Sleep(50);
  91.     } while (!engineBase);
  92.  
  93. }
  94.  
  95. void wallhack()
  96. {
  97.     while (true)
  98.     {
  99.         Sleep(10);
  100.         if (!wallhack && !readMem<DWORD>(readMem<DWORD>(clientBase + dwLocalPlayer) + 0xED))
  101.             continue;
  102.  
  103.         DWORD glowObj = readMem<DWORD>(clientBase + dwGlowObjectManager);
  104.         DWORD myTeam = readMem<DWORD>(readMem<DWORD>(clientBase + dwLocalPlayer) + m_iTeamNum);
  105.  
  106.         for (int x = 0; x < 32; x++)
  107.         {
  108.             DWORD player = readMem<DWORD>(clientBase + dwEntityList + x * 0x10);
  109.             if (player == 0)
  110.                 continue;
  111.  
  112.             bool dormant = readMem<bool>(player + 0xED);
  113.             if (dormant)
  114.                 continue;
  115.  
  116.             DWORD team = readMem<DWORD>(player + m_iTeamNum);
  117.             if (team != 2 && team != 3)
  118.                 continue;
  119.  
  120.             DWORD currentGlowIndex = readMem<DWORD>(player + m_iGlowIndex);
  121.  
  122.             if (team != myTeam)
  123.             {
  124.                 writeMem<float>(glowObj + currentGlowIndex * 0x38 + 0x4, 255); // R
  125.                 writeMem<float>(glowObj + currentGlowIndex * 0x38 + 0x8, 0);   // G
  126.                 writeMem<float>(glowObj + currentGlowIndex * 0x38 + 0xC, 0);   // B
  127.                 writeMem<float>(glowObj + currentGlowIndex * 0x38 + 0x10, 255);
  128.                 writeMem<bool>(glowObj + currentGlowIndex * 0x38 + 0x24, true);
  129.                 writeMem<bool>(glowObj + currentGlowIndex * 0x38 + 0x25, false);
  130.             }
  131.             else
  132.             {
  133.                 writeMem<float>(glowObj + currentGlowIndex * 0x38 + 0x4, 0);   // R
  134.                 writeMem<float>(glowObj + currentGlowIndex * 0x38 + 0x8, 0);   // G
  135.                 writeMem<float>(glowObj + currentGlowIndex * 0x38 + 0xC, 255); // B
  136.                 writeMem<float>(glowObj + currentGlowIndex * 0x38 + 0x10, 255);
  137.                 writeMem<bool>(glowObj + currentGlowIndex * 0x38 + 0x24, true);
  138.                 writeMem<bool>(glowObj + currentGlowIndex * 0x38 + 0x25, false);
  139.             }
  140.         }
  141.     }
  142. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement