25-01-2013, 22:25
eHop (Orange Box Bunny Hopper)
Voici la source d'une bunny hop permettant d'être utilisé avec
Garry's Mod
Team Forteress 2
Cs Source
DoD Source
Codé par J.Large, ce logiciel est complétement externe.
Seul deux fichier forme la source, le fichier source principal et le header cProcess pour gérer la lecture dans la mémoire.
A importer dans un nouveau projet c++ (application console)
main.cpp
[hide]
[/hide]
cProcess.h
[hide]
[/hide]
DOWNLOAD / Télécharger la source :
[hide] [/hide]
Voici la source d'une bunny hop permettant d'être utilisé avec
Garry's Mod
Team Forteress 2
Cs Source
DoD Source
Codé par J.Large, ce logiciel est complétement externe.
Seul deux fichier forme la source, le fichier source principal et le header cProcess pour gérer la lecture dans la mémoire.
A importer dans un nouveau projet c++ (application console)
main.cpp
[hide]
Spoiler:
Code :
//Copyright (c) 2012 Jacob Large
//This program is a fully external tool for assisting in bunnyhopping in all games based on the Orange Box engine.
#include <windows.h>
#include <stdio.h>
#include <iostream>
#include <cstring>
#include "CProcess.h"
#include <time.h>
//Struct to store offsets, gamewindow, and game name
struct offset
{
offset();
DWORD ON_GROUND;
DWORD SPECTATING;
DWORD OVERLAY;
DWORD WATER;
HWND game;
char *gameName;
};
//Initializer function to set all members to NULL
offset::offset()
{
ON_GROUND = NULL;
SPECTATING = NULL;
OVERLAY = NULL;
game = NULL;
}
//Prototype functions
bool isSpectating();
bool onGround();
bool overlayOpen();
void bhopLoop(const offset&);
void sendSpace(const offset &addrs);
void findGame(offset &addrs);
//Global variables
int grounded = -1;
int overlay = -1;
int spectate = -1;
int water = -1;
int grmax = 0;
double timestart;
//Create CProcess object
CProcess worker;
int main()
{
SetConsoleTitle("eHop External Orange Box Bunnyhop Tool");
std::cout << "eHop External Orange Box Bunnyhop Tool by Lagunka and tflo" << std::endl;
std::cout << "Waiting for hl2.exe..." << std::endl;
worker.Initialize();//Searches for hl2.exe
std::cout << "hl2.exe found. Waiting for game window..." << std::endl;
offset addrs;//Creates a struct object for storing offsets and game name
findGame(addrs);//Searches for a source game window
bhopLoop(addrs);//Main loop for bhopping
std::cout << "Lost game window, now exiting..." << std::endl;//Game was closed
Sleep(2000);
delete [] addrs.gameName;//Free the memory allocated for the dynamic array
return 0;
}
//Reads the process memory to see if the client is on ground
//Because the values can start becoming other than 0 and 1 (3 and 4 for example) some fixes were applied
bool onGround(offset addrs)
{
if(grounded > grmax)//Stores the max value of the address
grmax = grounded;
while(grmax - 1 > grounded)//If max value is more than 1 more of the min value, it lowers it to be 1 more again
grmax -= 1;
ReadProcessMemory(worker.hProcess, (LPVOID)(worker.dwClient+addrs.ON_GROUND), &grounded, sizeof(grounded), 0);//reads the process memory and stores the value to grounded
if(grounded == grmax)
timestart = time(NULL);
else
timestart = 0.0;
return grounded == grmax;//returns true if grounded is at it's max, false if not.
}
//Function to check if the client is in the water
bool isInWater(offset addrs)
{
ReadProcessMemory(worker.hProcess, (LPVOID)(worker.dwClient+addrs.WATER), &water, sizeof(water), 0);
return water > 0;
}
//Function to check if the client is in spectate (only applies to CS:S and DOD:S)
bool isSpectating(offset addrs)
{
ReadProcessMemory(worker.hProcess, (LPVOID)(worker.dwClient+addrs.SPECTATING), &spectate, sizeof(spectate), 0);
return spectate == 1;
}
//Function to check if the steam overlay is open so spaces don't get sent while typing
bool overlayOpen(offset addrs)
{
ReadProcessMemory(worker.hProcess, (LPVOID)(worker.dwOverlay+addrs.OVERLAY), &overlay, sizeof(overlay), 0);
return overlay == 1;
}
//This function loops until a proper game window is found
void findGame(offset &addrs)
{
addrs.game = NULL;
while(!addrs.game)//Loop while addrs.game is NULL
{
if(FindWindow(NULL, "Counter-Strike Source"))
{
addrs.gameName = new char[strlen("Counter-Strike Source") + 1];
strcpy(addrs.gameName, "Counter-Strike Source");
addrs.game = FindWindow(NULL, addrs.gameName);
addrs.SPECTATING = 0x7417B0;
addrs.ON_GROUND = 0x72970C;
addrs.OVERLAY = 0x77D8C;
addrs.WATER = 0x744FFC;
std::cout << "Found game: " << addrs.gameName << std::endl;
}
else if(FindWindow(NULL, "Garry\'s Mod"))
{
addrs.gameName = new char[strlen("Garry\'s Mod") + 1];
strcpy(addrs.gameName, "Garry\'s Mod");
addrs.game = FindWindow(NULL, addrs.gameName);
addrs.ON_GROUND = 0x538984;
addrs.OVERLAY = 0x77D8C;
std::cout << "Found game: " << addrs.gameName << std::endl;
}
else if(FindWindow(NULL, "Day of Defeat Source"))
{
addrs.gameName = new char[strlen("Day of Defeat Source") + 1];
strcpy(addrs.gameName, "Day of Defeat Source");
addrs.game = FindWindow(NULL, addrs.gameName);
addrs.SPECTATING = 0x493350;
addrs.ON_GROUND = 0x48B91C;
addrs.OVERLAY = 0x77D8C;
std::cout << "Found game: " << addrs.gameName << std::endl;
}
else if(FindWindow(NULL, "Team Fortress 2"))
{
addrs.gameName = new char[strlen("Team Fortress 2") + 1];
strcpy(addrs.gameName, "Team Fortress 2");
addrs.game = FindWindow(NULL, addrs.gameName);
addrs.ON_GROUND = 0x8EEB84;
addrs.OVERLAY = 0x77D8C;
std::cout << "Found game: " << addrs.gameName << std::endl;
}
}
}
//Function to send a single space key press to the window
void sendSpace(const offset &addrs)
{
SendMessage(addrs.game, WM_KEYDOWN, VK_SPACE, 0x390000);
Sleep(10);
SendMessage(addrs.game, WM_KEYUP, VK_SPACE, 0x390000);
}
//Function that loops and checks if the user is holding space
void bhopLoop(const offset &addrs)
{
std::cout << "The tool is now active, use the \'delete\' key to toggle through settings\n\nIMPORTANT: Leave this window open while the tool is in use." << std::endl;
int bhop_enable = 1;//bhop enable defaults to perfect
int space = 0;
int button_pressed = 0;//Variable so that button has to be pressed and released to pass
srand(time(NULL));//Seed the random number generator
int interval = 0;
std::cout << "\n\nIf you suffer performance issues, use the 'page up' key to slow the scan time.\n";
std::cout << "Current setting: Perfect Bhop with no delay in scan time" << std::endl;
for( ;FindWindow(NULL, addrs.gameName); Sleep(interval))
if(GetAsyncKeyState(VK_PRIOR) && !button_pressed && interval < 5)
{
interval += 1;
button_pressed = 1;
std::cout << "Scan interval set to: " << interval << " ms.\n";
}
else if(GetAsyncKeyState(VK_NEXT) && !button_pressed && interval > 0)
{
interval -= 1;
button_pressed = 1;
std::cout << "Scan interval set to: " << interval << " ms.\n";
}
else if(GetAsyncKeyState(VK_DELETE) && !button_pressed)
{
//bhop is dissabled, so set it to 1
if(!bhop_enable)
{
bhop_enable = 1;
std::cout << "Bhop changed to perfect" << std::endl;
}
//bhop is on 1, so set to 2
else if(bhop_enable == 1)
{
bhop_enable = 2;
std::cout << "Bhop changed to legit" << std::endl;
}
//bhop is on 2, so set to 0
else if(bhop_enable == 2)
{
bhop_enable = 0;
std::cout << "Bhop disabled" << std::endl;
}
button_pressed = 1;
}
else if(GetAsyncKeyState(VK_SPACE) && bhop_enable && onGround(addrs) && !overlayOpen(addrs) && !isSpectating(addrs))
{
if(bhop_enable == 2)//bhop is set to legit
{
Sleep(rand() % 6);//If the user hits the ground, waits 4 to 8 ms to jump (to look legit)
for(int i = 0; i < rand() % 3 + 5; ++i)//Sends the space key 5 to 8 times (to look like scroll wheel)
{
sendSpace(addrs);//
Sleep(20);
}
}
//bhop is set to perfect
else
sendSpace(addrs);
}
//Use pressed space while in the air, so run the command once to make sure +jump isn't stuck.
else if((GetAsyncKeyState(VK_SPACE) && !onGround(addrs) && !space && !isSpectating(addrs) && !overlayOpen(addrs) && !isInWater(addrs)) || (timestart - time(NULL) > 0.005 && !space && !isSpectating(addrs) && !overlayOpen(addrs) && !isInWater(addrs)))
{
sendSpace(addrs);
space = 1;
}
//reset space var to 0
else if(!GetAsyncKeyState(VK_SPACE) && space)
space = 0;
//Use is in water and not touching the ground, so simulate +jump until they are out of the water, touch ground, or let go of space
else if(isInWater(addrs) && GetAsyncKeyState(VK_SPACE) && !onGround(addrs))
{
SendMessage(addrs.game, WM_KEYDOWN, VK_SPACE, 0x390000);
while(isInWater(addrs) && GetAsyncKeyState(VK_SPACE) && !onGround(addrs))
Sleep(10);
SendMessage(addrs.game, WM_KEYUP, VK_SPACE, 0x390000);
}
else if(!GetAsyncKeyState(VK_NEXT) && !GetAsyncKeyState(VK_PRIOR) && !GetAsyncKeyState(VK_DELETE) && button_pressed)
button_pressed = 0;
}cProcess.h
[hide]
Spoiler:
Code :
#include <windows.h>
#include <tlhelp32.h>
#include <tchar.h>
class CProcess
{
private:
public:
PROCESSENTRY32 pGame;
HANDLE hProcess;
DWORD dwClient;
DWORD dwEngine;
DWORD dwOverlay;
DWORD dwVGui;
DWORD dwLibCef;
DWORD dwSteam;
DWORD FindProcess(const char *ccName, PROCESSENTRY32 *pEntry)
{
PROCESSENTRY32 pEntry32;
pEntry32.dwSize = sizeof(PROCESSENTRY32);
HANDLE hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
if (hSnapshot == INVALID_HANDLE_VALUE) return 0;
if (!Process32First(hSnapshot, &pEntry32))
{
CloseHandle(hSnapshot);
return 0;
}
do
{
if (!strcmpi(pEntry32.szExeFile, ccName))
{
memcpy((void *)pEntry, (void *)&pEntry32, sizeof(PROCESSENTRY32));
CloseHandle(hSnapshot);
return pEntry32.th32ProcessID;
}
}
while (Process32Next(hSnapshot, &pEntry32));
CloseHandle(hSnapshot);
return 0;
}
DWORD FindThread(DWORD dwProcess)
{
THREADENTRY32 tEntry32;
tEntry32.dwSize = sizeof(THREADENTRY32);
HANDLE hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPTHREAD, 0);
if (hSnapshot == INVALID_HANDLE_VALUE) return 0;
if (!Thread32First(hSnapshot, &tEntry32))
{
CloseHandle(hSnapshot);
return 0;
}
do
{
if (tEntry32.th32OwnerProcessID == dwProcess)
{
CloseHandle(hSnapshot);
return tEntry32.th32ThreadID;
}
}
while (Thread32Next(hSnapshot, &tEntry32));
CloseHandle(hSnapshot);
return 0;
}
DWORD GetModuleBase(LPSTR lpModuleName, DWORD dwProcessId)
{
MODULEENTRY32 lpModuleEntry = {0};
HANDLE hSnapShot = CreateToolhelp32Snapshot( TH32CS_SNAPMODULE, dwProcessId);
if(!hSnapShot) return NULL;
lpModuleEntry.dwSize = sizeof(lpModuleEntry);
BOOL bModule = Module32First( hSnapShot, &lpModuleEntry );
while(bModule)
{
if(!strcmp(lpModuleEntry.szModule, lpModuleName ) )
{
CloseHandle( hSnapShot );
return (DWORD)lpModuleEntry.modBaseAddr;
}
bModule = Module32Next( hSnapShot, &lpModuleEntry );
}
CloseHandle( hSnapShot );
return NULL;
}
void SetDebugPrivilege()
{
HANDLE hProcess=GetCurrentProcess(), hToken;
TOKEN_PRIVILEGES priv;
LUID luid;
OpenProcessToken(hProcess, TOKEN_ADJUST_PRIVILEGES, &hToken);
LookupPrivilegeValue(0, "seDebugPrivilege", &luid);
priv.PrivilegeCount = 1;
priv.Privileges[0].Luid = luid;
priv.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
AdjustTokenPrivileges(hToken, false, &priv, 0, 0, 0);
CloseHandle(hToken);
CloseHandle(hProcess);
}
void Initialize()
{
SetDebugPrivilege();
while (!FindProcess("hl2.exe", &pGame)) Sleep(10);
while (!(FindThread(pGame.th32ProcessID))) Sleep(10);
hProcess = OpenProcess(PROCESS_ALL_ACCESS, false, pGame.th32ProcessID);
while(dwClient == 0x0) dwClient = GetModuleBase("client.dll", pGame.th32ProcessID);
while(dwEngine == 0x0) dwEngine = GetModuleBase("engine.dll", pGame.th32ProcessID);
while(dwOverlay == 0x0) dwOverlay = GetModuleBase("GameOverlayRenderer.dll", pGame.th32ProcessID);
while(dwVGui == 0x0) dwVGui = GetModuleBase("vguimatsurface.dll", pGame.th32ProcessID);
while(dwLibCef == 0x0) dwLibCef = GetModuleBase("libcef.dll", pGame.th32ProcessID);
while(dwSteam == 0x0) dwSteam = GetModuleBase("steam.dll", pGame.th32ProcessID);
}
};
extern CProcess gProcess;DOWNLOAD / Télécharger la source :
[hide] [/hide]
