Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Windows.h>
- #include <iostream>
- #include <TlHelp32.h>
- int i;
- int junkjumps;
- HANDLE GetProcessHandleByName( const char* pImageName )
- {
- PROCESSENTRY32 pe32;
- HANDLE hSnapShot = NULL;
- DWORD dwPID = 0;
- if( !pImageName )
- return INVALID_HANDLE_VALUE;
- hSnapShot = CreateToolhelp32Snapshot( TH32CS_SNAPPROCESS, 0 );
- if( hSnapShot != INVALID_HANDLE_VALUE )
- {
- pe32.dwSize = sizeof( PROCESSENTRY32 );
- if( Process32First( hSnapShot, &pe32 ) )
- {
- do
- {
- if( !strcmp( pe32.szExeFile, pImageName ) )
- {
- dwPID = pe32.th32ProcessID;
- if( dwPID != 0 )
- {
- hSnapShot = OpenProcess( PROCESS_ALL_ACCESS, false, dwPID );
- return hSnapShot;
- }
- }
- }while( Process32Next( hSnapShot, &pe32 ) );
- }
- }
- return INVALID_HANDLE_VALUE;
- }
- DWORD GetModuleBaseAddress( HANDLE hProcess, const char* pModuleName )
- {
- if( hProcess == INVALID_HANDLE_VALUE || !pModuleName )
- return 0;
- DWORD dwPID = 0;
- HANDLE hSnapShot = NULL;
- MODULEENTRY32 moduleEntry32;
- dwPID = GetProcessId( hProcess );
- if( dwPID == 0 )
- return 0;
- hSnapShot = CreateToolhelp32Snapshot( TH32CS_SNAPMODULE, dwPID );
- if( hSnapShot == INVALID_HANDLE_VALUE )
- return 0;
- moduleEntry32.dwSize = sizeof( moduleEntry32 );
- if( Module32First( hSnapShot, &moduleEntry32 ) )
- {
- do
- {
- if( !strcmp( moduleEntry32.szModule, pModuleName ) )
- {
- return ( DWORD )moduleEntry32.modBaseAddr;
- CloseHandle( hSnapShot );
- }
- }while( Module32Next( hSnapShot, &moduleEntry32 ) );
- }
- return 0;
- }
- template<class T> T ReadMemory( HANDLE hProcess, PVOID pBaseAddress )
- {
- if( hProcess == INVALID_HANDLE_VALUE )
- return 0;
- T buffer;
- if( ReadProcessMemory( hProcess, pBaseAddress, &buffer, sizeof( T ), NULL ) )
- return buffer;
- else
- return 0;
- }
- int ranjumps()
- {
- int junkjumps;
- int min = 4;
- int max = 8;
- junkjumps = min + (rand() % (int)(max - min + 1));
- return junkjumps;
- }
- int main( )
- {
- HANDLE hProcess = NULL;
- HWND hWindow = nullptr;
- hProcess = GetProcessHandleByName( "csgo.exe" );
- if( hProcess == INVALID_HANDLE_VALUE )
- {
- printf( "Couldnt get handle huso!\n" );
- return ( int )( 0x13376077 | ( ~0xDEADBEEF ) );
- }
- hWindow = FindWindowA( "Valve001", NULL );
- if( !hWindow )
- {
- printf( "Couldnt get window!\n" );
- return ( int )( 0x13376077 | ( ~0xDEADBEEF ) );
- }
- DWORD dwClientBase = 0;
- dwClientBase = GetModuleBaseAddress( hProcess, "client.dll" );
- if( dwClientBase == 0 )
- {
- printf( "Couldnt get client.dll!\n" );
- return ( int )( 0x13376077 | ( ~0xDEADBEEF ) );
- }
- while( 1 )
- {
- if( GetAsyncKeyState( VK_XBUTTON1) )
- {
- DWORD dwLocalPlayer = 0;
- dwLocalPlayer = ReadMemory< DWORD >( hProcess, ( PVOID )( dwClientBase + 0xA6D91C ) );
- if( dwLocalPlayer != 0 )
- {
- int iFlags = 0;
- iFlags = ReadMemory< int >( hProcess, ( PVOID )( dwLocalPlayer + 0x100 ) );
- if( iFlags & ( 1 << 0 ) )
- {
- SendMessage( hWindow, WM_KEYDOWN, 0x5A, 0x150000 );
- SendMessage( hWindow, WM_KEYUP, 0x5A, 0x150000 );
- ranjumps();
- for(i = 0; i < junkjumps; i++)
- {
- SendMessage( hWindow, WM_KEYDOWN, 0x5A, 0x150000 );
- SendMessage( hWindow, WM_KEYUP, 0x5A, 0x150000 );
- Sleep(30);
- }
- }
- }
- }
- Sleep( 3 );
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement