Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // BHOP.cpp : Defines the entry point for the console application.
- //
- #include <Windows.h>
- #include <TlHelp32.h>
- #include <iostream>
- #define BHOP_KEY 'C'
- struct module_t {
- DWORD dwBase, dwSize;
- };
- //debugger class:
- class CDebugger {
- private:
- DWORD dwPid;
- HANDLE hProcess;
- public:
- bool attach(char* szProcess) {
- HANDLE handle = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, NULL);
- PROCESSENTRY32 entry;
- entry.dwSize = sizeof(entry);
- do {
- if (!wcscmp(entry.szExeFile, L"csgo.exe")) {
- 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 (!wcscmp(entry.szModule, L"client.dll")) {
- 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,(DWORD)false };
- }
- template<typename T>
- T ReadMemory(DWORD Adress) {
- T read;
- ReadProcessMemory(hProcess, (LPVOID)Adress, &read, sizeof(T), 0);
- return read;
- }
- template<typename T>
- void WriteMemory(DWORD Adress, T value) {
- WriteProcessMemory(hProcess, (LPVOID)Adress, &value, sizeof(T), 0);
- }
- };
- //offsets
- DWORD dwLocalPlayer = 0x00A6E444;
- DWORD dwJump = 0x04AF150C;
- DWORD dwFlags = 0x100;
- CDebugger debugger;
- module_t moduleClient;
- module_t* GetModuleClient() {
- if (!moduleClient.dwBase && !moduleClient.dwSize) {
- moduleClient = debugger.GetModule("client.dll");
- }
- return &moduleClient;
- }
- class CBunnyhop {
- public:
- static unsigned long __stdcall ThreadRoutine(void*) {
- while (true) {
- DWORD dwMe = debugger.ReadMemory<DWORD>(GetModuleClient()->dwBase + dwLocalPlayer);
- int CanJump = debugger.ReadMemory<DWORD>(dwMe + dwFlags);
- if ((GetAsyncKeyState(VK_SPACE))) {
- debugger.WriteMemory<int>(GetModuleClient()->dwBase + dwJump, 5);
- Sleep(50);
- std::cout << "Jumping" << std::endl;
- debugger.WriteMemory<int>(GetModuleClient()->dwBase + dwJump, 4);
- }
- }
- }
- };
- int main()
- {
- while (!debugger.attach("csgo.exe")) {
- Sleep(100);
- }
- std::cout << " Attached!" << std::endl;
- CreateThread(0, 0, &CBunnyhop::ThreadRoutine, 0, 0, 0);
- while (1) {
- Sleep(100);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement