Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include <Windows.h>
- #include <iostream>
- #include <TlHelp32.h>
- using namespace std;
- #define BHOP_KEY 'V'
- struct module_t
- {
- DWORD dwBase, dwSize;
- };
- class CDebbuger
- {
- private:
- DWORD dwPid;
- HANDLE hProcess;
- public:
- bool attach(char* szProcess)
- {
- HANDLE handle = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, NULL);
- PROCESSENTRY32 entry; entry.dwSize = sizeof(entry);
- do
- {
- if (!strcmp((char*)entry.szExeFile, szProcess))
- {
- dwPid = entry.th32ProcessID;
- CloseHandle(handle);
- hProcess = OpenProcess(PROCESS_ALL_ACCESS, false, dwPid);
- return true;
- }
- } while (Process32Next(handle, &entry)); return false;
- }
- module_t GetModule(char* szModule)
- {
- HANDLE handle = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, NULL);
- MODULEENTRY32 entry; entry.dwSize = sizeof(entry);
- do
- {
- if (!strcmp((char*)entry.szModule, szModule))
- {
- dwPid = entry.th32ProcessID;
- CloseHandle(handle);
- hProcess = OpenProcess(PROCESS_ALL_ACCESS, false, dwPid);
- return{ (DWORD)entry.hModule, entry.modBaseSize };
- }
- } while (Module32Next(handle, &entry)); return{(DWORD) false, false};
- }
- template<typename T>
- T ReadMemory(DWORD Address)
- {
- T read;
- ReadProcessMemory(hProcess,(LPCVOID*)Address, &read, sizeof(T),0 );
- return read;
- }
- };
- DWORD dwLocalPlayer = 0xA9948C;
- DWORD dwJump = 0x4AD0374;
- DWORD dwFlags = 0x100;
- CONST int scrolldown = -120;
- CONST int scrollup = 120;
- CDebbuger debbuger;
- module_t moduleClient;
- module_t* GetModuleClient()
- {
- if (!moduleClient.dwBase && !moduleClient.dwSize)
- {
- moduleClient = debbuger.GetModule("client.dll");
- }
- return &moduleClient; //there were many problems with this for example: '&' before module client
- }
- int main()
- {
- cout << "Waiting to attach" << endl; //addet for test
- while (!debbuger.attach("csgo.exe"))
- {
- Sleep(100);
- }
- cout << "Attached" << endl; // even after opening cs go program dont reach this point
- while (true)
- {
- //if (GetAsyncKeyState(VK_DELETE)) { goto end_program; }
- DWORD dwMe = debbuger.ReadMemory<DWORD>(GetModuleClient()->dwBase + dwLocalPlayer);
- int CanJump = debbuger.ReadMemory<DWORD>(dwMe + dwFlags);
- if ((GetAsyncKeyState(BHOP_KEY) & 0x8000) && (CanJump & 0x1 == true))
- {
- cout << "Bhoping" << endl;
- mouse_event(MOUSEEVENTF_WHEEL, 0, 0, scrolldown, 0); //replaced write to memory with scrolling becouse of errors
- Sleep(50);
- mouse_event(MOUSEEVENTF_WHEEL, 0, 0, scrollup, 0);
- }
- }
- end_program:
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement