Advertisement
Guest User

Cs go bhop

a guest
Dec 5th, 2016
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.53 KB | None | 0 0
  1. #include "stdafx.h"
  2. #include <Windows.h>
  3. #include <iostream>
  4. #include <TlHelp32.h>
  5.  
  6. using namespace std;
  7.  
  8. #define BHOP_KEY 'V'
  9.  
  10. struct module_t
  11. {
  12.     DWORD dwBase, dwSize;
  13. };
  14.  
  15. class CDebbuger
  16. {
  17. private:
  18.     DWORD dwPid;
  19.     HANDLE hProcess;
  20. public:
  21.  
  22.     bool attach(char* szProcess)
  23.     {
  24.         HANDLE handle = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, NULL);
  25.         PROCESSENTRY32 entry; entry.dwSize = sizeof(entry);
  26.         do
  27.         {
  28.             if (!strcmp((char*)entry.szExeFile, szProcess))
  29.             {
  30.                 dwPid = entry.th32ProcessID;
  31.                 CloseHandle(handle);
  32.                 hProcess = OpenProcess(PROCESS_ALL_ACCESS, false, dwPid);
  33.                 return true;
  34.             }
  35.         } while (Process32Next(handle, &entry)); return false;
  36.     }
  37.  
  38.     module_t GetModule(char* szModule)
  39.     {
  40.         HANDLE handle = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, NULL);
  41.         MODULEENTRY32 entry; entry.dwSize = sizeof(entry);
  42.         do
  43.         {
  44.             if (!strcmp((char*)entry.szModule, szModule))
  45.             {
  46.                 dwPid = entry.th32ProcessID;
  47.                 CloseHandle(handle);
  48.                 hProcess = OpenProcess(PROCESS_ALL_ACCESS, false, dwPid);
  49.                 return{ (DWORD)entry.hModule, entry.modBaseSize };
  50.             }
  51.         } while (Module32Next(handle, &entry)); return{(DWORD) false, false};
  52.     }
  53.  
  54.     template<typename T>
  55.     T ReadMemory(DWORD Address)
  56.     {
  57.         T read;
  58.         ReadProcessMemory(hProcess,(LPCVOID*)Address, &read, sizeof(T),0 );
  59.         return read;
  60.     }
  61.  
  62. };
  63.  
  64. DWORD dwLocalPlayer = 0xA9948C;
  65. DWORD dwJump = 0x4AD0374;
  66. DWORD dwFlags = 0x100;
  67. CONST int scrolldown = -120;
  68. CONST int scrollup = 120;
  69. CDebbuger debbuger;
  70. module_t moduleClient;
  71.  
  72. module_t* GetModuleClient()
  73. {
  74.     if (!moduleClient.dwBase && !moduleClient.dwSize)
  75.     {
  76.         moduleClient = debbuger.GetModule("client.dll");
  77.     }
  78.     return &moduleClient; //there were many problems with this for example: '&' before module client
  79. }
  80.  
  81.  
  82.  
  83. int main()
  84. {
  85.     cout << "Waiting to attach" << endl; //addet for test
  86.     while (!debbuger.attach("csgo.exe"))
  87.     {
  88.         Sleep(100);
  89.     }
  90.     cout << "Attached" << endl; // even after opening cs go program dont reach this point
  91.     while (true)
  92.     {
  93.         //if (GetAsyncKeyState(VK_DELETE)) { goto end_program; }
  94.         DWORD dwMe = debbuger.ReadMemory<DWORD>(GetModuleClient()->dwBase + dwLocalPlayer);
  95.         int CanJump = debbuger.ReadMemory<DWORD>(dwMe + dwFlags);
  96.         if ((GetAsyncKeyState(BHOP_KEY) & 0x8000) && (CanJump & 0x1 == true))
  97.         {
  98.             cout << "Bhoping" << endl;
  99.             mouse_event(MOUSEEVENTF_WHEEL, 0, 0, scrolldown, 0); //replaced write to memory with scrolling becouse of errors
  100.             Sleep(50);
  101.             mouse_event(MOUSEEVENTF_WHEEL, 0, 0, scrollup, 0);
  102.         }
  103.     }
  104. end_program:
  105.     return 0;
  106. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement