Thema: Offsets in CSS finden (Help) | ||
Anmeldungsdatum: Apr 2009 Beiträge: 3 |
Hallo ich würde gerne einen CSS Hack in C# schreiben hab auch schon ein Source Code von einem (Only ProcessMemoryRead) gefunden in C++ kann ja umsetzen . Ich weiß ja wie man offsets findet aber sachen wie LocalViewangles; CmdViewangles; ScreenSize; LocalPlayer.m_iIndex so was halt der Source Code ist von extern0r (ESP Only). hier ist ein teil vom source.. viele offsets aber ich wieß nicht wie ich sie finden kann.. // extern0r.cpp : Defines the entry point for the application. // #include "extern0r.h" cLocalPlayer gLocalPlayer; char szpath[1024]; char szlogfile[1024]; bool bGotPath = false; void __cdecl add_log(const char * fmt, ...) { va_list va_alist; char logbuf[256]; FILE *fp; char szLogFile[256]; struct tm *current_tm; time_t current_time; time (¤t_time); current_tm = localtime (¤t_time); sprintf (logbuf, "[%02d:%02d:%02d] ", current_tm->tm_hour, current_tm->tm_min, current_tm->tm_sec); va_start (va_alist, fmt); _vsnprintf (logbuf+strlen(logbuf), sizeof(logbuf) - strlen(logbuf), fmt, va_alist); va_end (va_alist); if( !bGotPath ) { bGotPath = true; GetModuleFileName( 0, szpath, 1024 ); } strcpy(szlogfile, szpath); strcpy(&szlogfile[strlen(szlogfile) - 3], "log"); if ( (fp = fopen ( szlogfile , "a")) != NULL ) { fprintf ( fp, "%s\n", logbuf ); fclose (fp); } } // Global Variables: DWORD dwPID = 0; HANDLE hProcess; DWORD m_EntPtrArray; DWORD dwClient_DLL; DWORD dwEngine_DLL; DWORD dwVGUIMatSurface_DLL; DWORD dwLocalViewangles; DWORD dwCmdViewangles; DWORD dwScreenSize; // Pre-Declarations: DWORD GetModuleBaseExtern( DWORD dwPID, char* szModuleName ); int GetLocalPlayer( void ); bool InGame( void ); void ESP( void ); void DrawBox(HDC context, int x, int y, int r, int g, int b, int size, int thickness); void DrawString( HDC context, int x, int y, int r, int g, int b, char* text, bool center ); struct sPlayer { DWORD m_dwAddress; float m_vecOrigin[3]; float m_f2DCoordinates[2]; float m_fViewangles[3]; unsigned int m_iTeamNum; unsigned int m_iHealth; unsigned int m_lifeState; unsigned int m_bIsPlayer; unsigned int m_fFlags; unsigned int m_iFOV; unsigned int m_bDormant; COLORREF m_clrTeamColor; }; sPlayer Players[32]; struct sGame { unsigned int m_bInGame; }; sGame Game; struct sGameWindow { HWND hWindow; HDC hDC; unsigned int m_iCaptionHeight; RECT m_Rect; unsigned int m_iSize[2]; unsigned int m_iResolution[2]; unsigned int m_iDisplayCenter[2]; }; sGameWindow GameWindow; unsigned int g_iCaptionHeight; unsigned int g_iBorderWidth; unsigned int g_iDisplayCenter[2]; unsigned int m_iMin[2]; unsigned int m_iMax[2]; int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow) { char szMutex[256]; GetModuleFileName( 0, szMutex, 256 ); for( int i = 0; i < ( int )strlen( szMutex ); i++ ) { if( szMutex[ strlen( szMutex ) - i ] == '\\' ) { //szMutex[ ( strlen( szMutex ) - i ) + 1 ] = '\0'; sprintf( szMutex, szMutex + ( strlen( szMutex ) - i + 1 ) ); break; } } CreateMutex( 0, FALSE, "extern0r" ); if( GetLastError() ) { char szMessage[256]; sprintf( szMessage, "%s is already running!", szMutex ); MessageBox( 0, szMessage, "Error", MB_ICONERROR ); return true; } add_log( " add_log( " add_log( " while( !( GameWindow.hWindow = FindWindow( NULL, "Counter-Strike Source" ) ) ) Sleep(10); SetForegroundWindow( GameWindow.hWindow ); while( !( GetForegroundWindow() == GameWindow.hWindow ) ) Sleep(10); while( !( GameWindow.hDC = /*GetDC(0)*/GetWindowDC( GameWindow.hWindow ) ) ) Sleep(10); add_log( " GetWindowThreadProcessId( GameWindow.hWindow, &dwPID ); add_log( " while( !( hProcess = OpenProcess( PROCESS_ALL_ACCESS, false, dwPID ) ) ) Sleep(10); add_log( " while( !( dwEngine_DLL = GetModuleBaseExtern( dwPID, "engine" ) ) ) Sleep(10); add_log( " while( ! ( dwClient_DLL = GetModuleBaseExtern( dwPID, "client" ) ) ) Sleep(10); add_log( " //m_EntPtrArray = 0x243CD17C m_EntPtrArray = ( dwClient_DLL + 0x3CD17C ); //not needed yet while( !( dwVGUIMatSurface_DLL = GetModuleBaseExtern( dwPID, "vguimatsurface" ) ) ) Sleep(10); add_log( " dwLocalViewangles = ( dwEngine_DLL + 0x3943D0 ); add_log( " //client.dll+3FB344 //same here dwCmdViewangles = ( dwEngine_DLL+ 0x3FB344 ); add_log( " dwScreenSize = ( dwEngine_DLL+ 0x5357C8 ); ReadProcessMemory( hProcess, (PVOID)( dwEngine_DLL + 0x5357C8 ), &GameWindow.m_iSize, 8, NULL ); add_log( " CreateThread( 0, 0, (LPTHREAD_START_ROUTINE)ESP, 0, 0, 0 ); while( FindWindow( NULL, "Counter-Strike Source" ) ) Sleep(10); add_log( " add_log( " return true; } // Global Functions: //credits to ~burN DWORD GetModuleBaseExtern( DWORD dwPID, char* szModuleName ) { HANDLE hModuleSnap = INVALID_HANDLE_VALUE; MODULEENTRY32 me32; hModuleSnap = CreateToolhelp32Snapshot( TH32CS_SNAPMODULE, dwPID ); if ( hModuleSnap == INVALID_HANDLE_VALUE ) return 0x0; me32.dwSize = sizeof( MODULEENTRY32 ); if ( !Module32First( hModuleSnap, &me32 ) ) { CloseHandle( hModuleSnap ); return 0x0; } do { if ( strstr( me32.szModule, szModuleName ) ) { CloseHandle( hModuleSnap ); return (DWORD)me32.modBaseAddr; } } while( Module32Next( hModuleSnap, &me32 ) ); CloseHandle( hModuleSnap ); return 0x0; } /*int GetLocalPlayer( void ) { ReadProcessMemory( hProcess, (PVOID)( dwEngine_DLL + 0x38FAF0 ), &LocalPlayer.m_iIndex, 4, NULL ); //FIX LocalPlayer.m_iIndex += 2; return LocalPlayer.m_iIndex; }*/ bool InGame( void ) { ReadProcessMemory( hProcess, (PVOID)( dwEngine_DLL + 0x38FA80 ), &Game.m_bInGame, 4, NULL ); if( Game.m_bInGame == 6 ) { Game.m_bInGame = 1; return true; } Game.m_bInGame = 0; return false; } DWORD GetClientEntity( int index ) { DWORD dwClientEntity = 0x0; ReadProcessMemory( hProcess, (PVOID)( m_EntPtrArray + ( index * 0x8 ) ), &dwClientEntity, 4, NULL ); //FIX dwClientEntity -=0x8; return dwClientEntity; } float GetDistance( float *origin ) { float diff[3] = { gLocalPlayer.GetAbsOrigin()[0] - origin[0], gLocalPlayer.GetAbsOrigin()[1] - origin[1], gLocalPlayer.GetAbsOrigin()[2] - origin[2] }; return (float)( sqrt( ( diff[0] * diff[0] ) + ( diff[1] * diff[1] ) + ( diff[2] * diff[2] ) ) ); } void AngleVectors( const vec3_t angles, vec3_t forward, vec3_t right, vec3_t up ) { float angle; static float sp, sy, cp, cy; angle = angles[0] * ( M_PI / 180 ); sp = sin( angle ); cp = cos( angle ); angle = angles[1] * ( M_PI / 180 ); sy = sin( angle ); cy = cos( angle ); if( forward ) { forward[0] = cp*cy; forward[1] = cp*sy; forward[2] = -sp; } if( right || up ) { static float sr, cr; angle = angles[2] * ( M_PI / 180 ); sr = sin( angle ); cr = cos( angle ); if( right ) { right[0] = -1*sr*sp*cy+-1*cr*-sy; right[1] = -1*sr*sp*sy+-1*cr*cy; right[2] = -1*sr*cp; } if( up ) { up[0] = cr*sp*cy+-sr*-sy; up[1] = cr*sp*sy+-sr*cy; up[2] = cr*cp; } } } int iWindowSizeDifference[2]; void UpdateWindowInfo( void ) { ReadProcessMemory( hProcess, (PVOID)dwScreenSize, &GameWindow.m_iResolution, 8, NULL ); GameWindow.m_iDisplayCenter[0] = GameWindow.m_iResolution[0]/2; GameWindow.m_iDisplayCenter[1] = GameWindow.m_iResolution[1]/2; g_iDisplayCenter[0] = GameWindow.m_iDisplayCenter[0]; g_iDisplayCenter[1] = GameWindow.m_iDisplayCenter[1]; GetWindowRect( GameWindow.hWindow, &GameWindow.m_Rect ); GameWindow.m_iSize[0] = GameWindow.m_Rect.right - GameWindow.m_Rect.left; GameWindow.m_iSize[1] = GameWindow.m_Rect.bottom - GameWindow.m_Rect.top; iWindowSizeDifference[0] = GameWindow.m_iSize[0] - GameWindow.m_iResolution[0]; iWindowSizeDifference[1] = GameWindow.m_iSize[1] - GameWindow.m_iResolution[1]; g_iBorderWidth = ( iWindowSizeDifference[0] / 2 ); g_iCaptionHeight = GameWindow.m_iCaptionHeight = ( GameWindow.m_iSize[1] - ( iWindowSizeDifference[0] / 2 ) - GameWindow.m_iResolution[1] ); } void ResetPlayers( void ) { for( int i = 0; i < 33; i++ ) { Players.m_vecOrigin[0] = 0; Players.m_vecOrigin[1] = 0; Players.m_vecOrigin[2] = 0; } } char szHealthEsp[12]; wchar_t wc_tBuffer[50];//not needed float fForward[3]; float fRight[3]; float fUp[3]; bool bPanic = false; void ESP( void ) { while(true) { Sleep(1); UpdateWindowInfo(); if( GetAsyncKeyState( VK_F12 )&1 ) bPanic = !bPanic; if( !bPanic && InGame() ) { ResetPlayers(); for( int iIndex = 0; iIndex < 33; iIndex++ ) { if( iIndex == gLocalPlayer.GetIndex() ) continue; Players[iIndex].m_dwAddress = GetClientEntity( iIndex ); if( Players[iIndex].m_dwAddress == NULL ) continue; ReadProcessMemory( hProcess, (PVOID)( Players[iIndex].m_dwAddress + 0x140 ) , &Players[iIndex].m_bDormant, 4, NULL ); ReadProcessMemory( hProcess, (PVOID)( Players[iIndex].m_dwAddress + 0x42A ) , &Players[iIndex].m_bIsPlayer, 4, NULL ); if( Players[iIndex].m_bDormant || !Players[iIndex].m_bIsPlayer ) continue; ReadProcessMemory( hProcess, (PVOID)( Players[iIndex].m_dwAddress + 0x101C ), &Players[iIndex].m_fViewangles, 12, NULL ); ReadProcessMemory( hProcess, (PVOID)( Players[iIndex].m_dwAddress + 0x29C ) , &Players[iIndex].m_vecOrigin, 12, NULL ); ReadProcessMemory( hProcess, (PVOID)( Players[iIndex].m_dwAddress + 0x2B4 ) , &Players[iIndex].m_fFlags, 4, NULL ); ReadProcessMemory( hProcess, (PVOID)( Players[iIndex].m_dwAddress + 0x90 ) , &Players[iIndex].m_iTeamNum, 4, NULL ); ReadProcessMemory( hProcess, (PVOID)( Players[iIndex].m_dwAddress + 0x0DA4 ) , &Players[iIndex].m_iHealth, 4, NULL ); ReadProcessMemory( hProcess, (PVOID)( Players[iIndex].m_dwAddress + 0x87 ) , &Players[iIndex].m_lifeState, 4, NULL ); if( !Players[iIndex].m_iTeamNum || /*Players[iIndex].m_iHealth < 0 || Players[iIndex].m_iHealth > 100 ||*/ Players[iIndex].m_lifeState || !Players[iIndex].m_vecOrigin[0] && !Players[iIndex].m_vecOrigin[1] && !Players[iIndex].m_vecOrigin[2] ) continue; if( Players[iIndex].m_iTeamNum == 2 ) Players[iIndex].m_clrTeamColor = RGB( 255, 0, 0 ); else if( Players[iIndex].m_iTeamNum == 3 ) Players[iIndex].m_clrTeamColor = RGB( 0, 0, 255 ); else Players[iIndex].m_clrTeamColor = RGB( 255, 255, 255 ); if( Players[iIndex].m_fFlags &FL_DUCKING ) Players[iIndex].m_vecOrigin[2] -= 35; else Players[iIndex].m_vecOrigin[2] -= 25; if( CalculateScreen( Players[iIndex].m_vecOrigin, gLocalPlayer.GetAbsOrigin(), gLocalPlayer.GetViewAngles(), gLocalPlayer.GetFOV(), 25, Players[iIndex].m_f2DCoordinates ) ) { sprintf( szHealthEsp, "- %u -", Players[iIndex].m_iHealth ); DrawString( GameWindow.hDC, Players[iIndex].m_f2DCoordinates[0], Players[iIndex].m_f2DCoordinates[1] + 12, GetRValue(Players[iIndex].m_clrTeamColor), GetGValue(Players[iIndex].m_clrTeamColor), GetBValue(Players[iIndex].m_clrTeamColor), szHealthEsp, true ); DrawBox( GameWindow.hDC, Players[iIndex].m_f2DCoordinates[0], Players[iIndex].m_f2DCoordinates[1], GetRValue(Players[iIndex].m_clrTeamColor), GetGValue(Players[iIndex].m_clrTeamColor), GetBValue(Players[iIndex].m_clrTeamColor), 24, 2 ); } if( Players[iIndex].m_fFlags &FL_DUCKING ) Players[iIndex].m_vecOrigin[2] += 35; else Players[iIndex].m_vecOrigin[2] += 25; AngleVectors( Players[iIndex].m_fViewangles, fForward, fRight, fUp ); Players[iIndex].m_vecOrigin[0] += fForward[0] * 8; Players[iIndex].m_vecOrigin[1] += fForward[1] * 8; Players[iIndex].m_vecOrigin[2] += fForward[2] * 8; Players[iIndex].m_vecOrigin[0] += fRight[0] * 2; Players[iIndex].m_vecOrigin[1] += fRight[1] * 2; Players[iIndex].m_vecOrigin[2] += fRight[2] * 2; if( CalculateScreen( Players[iIndex].m_vecOrigin, gLocalPlayer.GetAbsOrigin(), gLocalPlayer.GetViewAngles(), gLocalPlayer.GetFOV(), 4, Players[iIndex].m_f2DCoordinates ) ) { DrawBox( GameWindow.hDC, Players[iIndex].m_f2DCoordinates[0], Players[iIndex].m_f2DCoordinates[1], 0, 255, 0, 2, 2 ); } } } } } //credits to xgx void DrawBox(HDC context, int x, int y, int r, int g, int b, int size, int thickness) { HBRUSH handle_brush; LOGBRUSH log_brush; log_brush.lbStyle = BS_NULL; handle_brush = CreateBrushIndirect( &log_brush ); SelectObject( context, handle_brush ); HPEN pen; pen = CreatePen( PS_SOLID, thickness, RGB( r, g, b ) ); SelectObject( context, pen ); Rectangle( context, x - size/2, y - size/2, x + size/2, y + size/2 ); DeleteObject( pen ); } void DrawString(HDC context, int x, int y, int r, int g, int b, char* text, bool center) { HFONT font; font = CreateFont( 14, // height of font 0, // average character width 0, // angle of escapement 0, // base-line orientation angle /*FW_MEDIUM*/800, // font weight 0, // italic attribute option 0, // underline attribute option 0, // strikeout attribute option ANSI_CHARSET, // character set identifier OUT_OUTLINE_PRECIS, // output precision CLIP_STROKE_PRECIS, // clipping precision ANTIALIASED_QUALITY, // output quality VARIABLE_PITCH|FF_SWISS, // pitch and family "Arial" // typeface name ); if(center) { SetTextAlign(context,TA_CENTER|TA_NOUPDATECP); } SetBkColor(context,RGB(0,0,0)); SetBkMode(context,TRANSPARENT); SetTextColor(context,RGB(r,g,b)); SelectObject(context,font); TextOutA(context,x,y,text,strlen(text)); DeleteObject(font); } |
|
chea77er ist offline |