• Birlikte RealityCheatsi yönetebilecek ekip arkadaşları arıyoruz — fikirlerin, tecrübelerin,merakın ve enerjinle katkıda bulunmak istersen seni bekliyoruz!

CapsLock

Enough
Ultra Member
Katılım
5 Kas 2019
Konular
342
Mesajlar
950
Tepkime puanı
725
Konum
Peak
RC Point
0
1. Searching for Offsets
If you want to write a external Hack you need some Offsets, like the LocalPlayer & EntityPlayer Pointer and some netVars like m_lifeState, m_iHealth.
  • netVars(for internal and external)
    1. Open OllyDebug and attach Counter-Strike: Global Offensive
    2. Click on [E]xecutable Modules and select the client module
    3. Go to the [C]PU thread, right-click on it, search for -> all referenced text strings
    4. enter your netVar name like m_iHealth
    5. Double-click on it and the PUSH Offset is the Offset to the netVar
  • Pointer(for external only. Internal use Interfaces)
    1. Open Cheat-Engine and attach Counter-Strike: Global Offensive
    2. Search for your current health
    3. type in console hurtme
    4. Search the new health value in Cheat-Engine via next
    5. Repeat that until you have ~20 addresses
    6. Search for Addreses which are similar (like 23XXX, 23XXXX, 23XXX)
    7. Pointer scan with max level 1
    8. If you found a address which points + the m_iHealth offset to the current health -> you are right
    9. the first address which point to the health is the local player pointer
    10. the second address is the pointer to the entity player
Setting up the base
Befor we start writing the base, go to the SourceEngine SDK on GitHub and search for IClientEntity, IClientEntityList, IVEngineClient, Vector.
If you are going to write an internal cheat you have to rebuild the classes from the SourceEngineSDK to your SourceEngine Game(for this: CSGO). The Vector struct/class contains x, y, z values(3D).
  • External:
    Befor you setting up your base, make sure you have a process handle to the game and the GetModuleBaseExternal() function to get the base address of the client.dll or smth. like that.
C++:
#ifdef UNICODE
#define GetRemoteModuleBase GetRemoteModuleBaseW( const wchar_t* pwszModuleName, DWORD ProcessId )
#else
#define GetRemoteModuleBase GetRemoteModuleBaseA( const char* pszModuleName, DWORD ProcessId )
#endif

DWORD GetRemoteModuleBase
{
DWORD dwModuleBase = 0;
HANDLE hSnapshot = CreateToolhelp32Snapshot( TH32CS_SNAPMODULE, ProcessId );

if( hSnapshot == INVALID_HANDLE_VALUE )
return dwModuleBase;

MODULEENTRY32 ME32 = { NULL };
ME32.dwSize = sizeof( MODULEENTRY32 );


if( Module32First( hSnapshot, &ME32 ) )
{
do
{
#ifdef UNICODE
if( !__wcismp( pwszModuleName, ME32.szModule ) )
{
dwModuleBase = ( DWORD )ME32.modBaseAddr;
break;
}
#else
if( !strcmp( pszModuleName, ME32.szModule ) )
{
dwModuleBase = ( DWORD )ME32.modBaseAddr;
break;
}
#endif
}
while( Module32Next( hSnapshot, &ME32 ) );
}

CloseHandle( hSnapshot );

return dwModuleBase;
}

If you have done this, create a new class like class CBaseEntity. In this class we need we declar all variables like the health, team, flags, lifestate, pointer to our weapon.

C++:
#define MAX_PLAYER 64

class CBaseEntity
{
public:
CBaseEntity( void ){}
DWORD m_dwEntity;

// netVars
BYTE m_fFlags;
BYTE m_lifeState;

int m_iHealth;
int m_iTeamNum;

Vector m_vecViewOffset;
Vector m_vecOrigin;
Vector m_vecEyePosition; // m_vecOrigin + m_vecViewOffset
};

extern CBaseEntity g_BaseEntity[ MAX_PLAYER ];
extern CBaseEntity* g_pLocalEntity;

In the next step, we need to call all ReadProcessMemory() calls to get the PlayerInformation. We are starting to get the LocalPlayer and the EntityPlayer Array. You need to loop all 64 Players!

C++:
if( !g_pLocalEntity ) // Check if the LocalEntity Pointer isn't valid
{
g_pLocalEntity = &g_pLocalEntity[ 0 ]; // Setup the pointer with the first array of the LocalEntity array
}

DWORD dwLocalPlayer = 0;
ReadProcessMemory( GetProcessHandle(), LPCVOID( Process::dwClient + OFFSET_LOCALPLAYER ), &dwLocalPlayer, sizeof( DWORD ), NULL );

for( int i = 0; i < MAX_PLAYER; i++ )
{
ReadProcessMemory( GetProcessHandle(), LPCVOID( Process::dwClient + OFFSET_ENTITYPLAYER + i * 0x10 ), &g_BaseEntity[ i ].m_dwEntity, sizeof( DWORD ), NULL );

// now we need to check if the entity pointer is equal to the local player pointer to set the Entity
// informations from the array to our pointer
if( dwLocalPlayer == g_BaseEntity[ i ].m_dwEntity )
{
g_pLocalEntity = &g_BaseEntity[ i ];
}
}

// now we have our pointer so we are able to read all stuff like netVars or handles

for( int i = 0; i < MAX_PLAYER; i++ )
{
ReadProcessMemory( GetProcessHandle(), LPCVOID( g_BaseEntity[ i ].m_dwEntity + OFFSET_HEALTH ), &g_BaseEntity[ i ].m_iHealth, sizeof( int ), NULL );
// continue with all shit
}

Internal
So I give you the IClientEntity + IClientEntityList classes. You have to initialize the IClientEntityList pointer with the Interface VClientEntityListXXX( xxx = the version. your homework) from the client.dll

C++:
typedef ULONG EHANDLE;

class IClientRenderable;
class IClientNetworkable;
class IClientUnknown;
class IClientThinkable;
class IClientEntity;

class IClientRenderable
{
public:
virtual PVOID GetIClientUnknown( void ) = 0;
virtual Vector const& GetRenderOrigin( void ) = 0;
virtual Vector const& GetRenderAngles( void ) = 0;
virtual bool ShouldDraw( void ) = 0;
virtual bool IsTransparent( void ) = 0;
virtual bool UsesPowerOfTwoFrameBufferTexture( void ) = 0;
virtual bool UsesFullFrameBufferTexture( void ) = 0;
virtual void GetShadowHandle( void ) const = 0;
virtual PVOID RenderHandle( void ) = 0;
virtual CONST PVOID GetModel( void ) const = 0;
virtual int DrawModel( int flags ) = 0;
virtual int GetBody( void ) = 0;
virtual void ComputeFxBlend( void ) = 0;
};
class IClientNetworkable
{
public:
virtual IClientUnknown* GetIClientUnknown( void ) = 0;
virtual void Release( void ) = 0;
virtual PVOID GetClientClass( void ) = 0;
virtual void NotifyShouldTransmit( void ) = 0;
virtual void OnPreDataChanged( void ) = 0;
virtual void OnDataChanged( void ) = 0;
virtual void PreDataUpdate( void ) = 0;
virtual void PostDataUpdate( void ) = 0;
virtual void unknown( void );
virtual int IsDormant( void ) = 0;
virtual int Index( void ) const = 0;
virtual void ReceiveMessage( int classID ) = 0;
virtual PVOID GetDataTableBasePtr( void ) = 0;
virtual void SetDestroyedOnRecreateEntities( void ) = 0;
};
class IClientUnknown
{
public:
virtual PVOID GetCollideable( void ) = 0;
virtual IClientNetworkable* GetClientNetworkable( void ) = 0;
virtual IClientRenderable* GetClientRenderable( void ) = 0;
virtual IClientEntity* GetIClientEntity( void ) = 0;
virtual IClientEntity* GetBaseEntity( void ) = 0;
virtual IClientThinkable* GetClientThinkable( void ) = 0;
};
class IClientThinkable
{
public:
virtual IClientUnknown* GetIClientUnknown( void ) = 0;
virtual void ClientThink( void ) = 0;
virtual PVOID GetThinkHandle( void ) = 0;
virtual void SetThinkHandle( PVOID hThink ) = 0;
virtual void Release( void ) = 0;
};

class __declspec ( novtable )IClientEntity : public IClientUnknown, public IClientRenderable, public IClientNetworkable, public IClientThinkable
{
public:
virtual void Release( void ) = 0;
virtual void Unknown000( void ) = 0;
virtual Vector& GetAbsOrigin( void ) const = 0;//in broken place use GetOrigin Below
virtual const Vector& GetAbsAngles( void ) const = 0;

// declar your own functions here example:
int GetHealth( void )
{
return *( int* )( ( DWORD )this + OFFSET_HEALTH );
}
Vector GetEyePosition( void )
{
return ( *( Vector* )( ( DWORD )this + OFFSET_VECORIGIN ) + *( Vector* )( ( DWORD )this + OFFSET_VECVIEWOFFSET ) );
}
};

class IClientEntityList
{
public:
virtual void Unknown0( void );
virtual void Unknown1( void );
virtual void Unknown2( void );
virtual IClientEntity* GetClientEntity( int nIndex );
virtual IClientEntity* GetClientEntityFromHandle( EHANDLE hEnt ) = 0;
virtual int NumberOfEntities( bool bIncludeNonNetworkable ) = 0;
virtual int GetHighestEntityIndex( void );
virtual void SetMaxEntities( int nMaxEnts );
virtual int GetMaxEntities( void );
};

extern IClientEntityList* g_pClientEntityList;

3. Setting up CBaseCombatWeapon:
There are different ways to get the current weapon. I will show you an internal and external way. We are getting the unsigned long index from our entity + netVar m_hActiveWeapon. Then we are going to read it on the same way like the PlayerArray. (all entitys like weapons, nades, .. are in that pointer).
  1. External:
    define the CBaseCombatWeapon class and add a pointer into our CBaseEntity class.
C++:
class CBaseCombatWeapon
{
public:
DWORD m_dwWeapon;
int m_iWeaponId;
};

After that we must read now the weapon pointerfrom our entity

C++:
unsigned long ulWeapon = 0;
ReadProcessMemory( GetProcessHandle(), LPCVOID( g_BaseEntity[ i ].m_dwEntity + OFFSET_HACTIVEWEAPON ), &ulWeapon, sizeof( ulWeapon ), NULL );

ulWeapon &= 0xFFF;
CBaseCombatWeapon BaseWeapon;
ReadProcessMemory( GetProcessHandle(), LPCVOID( Process::dwClient + OFFSET_ENTITYPLAYER + ulWeapon * 0x10 ), BaseWeapon.m_dwWeapon, sizeof( DWORD ), NULL );
ReadProcessMemory( GetProcessHandle(), LPCVOID( BaseWeapon.m_dwWeapon + OFFSET_WEAPONID ), &BaseWeapon.m_iWeaponId, sizeof( int ), NULL );

g_BaseEntity[ i ].m_pWeapon = &BaseWeapon;

// call g_BaseEntity[ INDEX ].m_pWeapon->m_iWeaponId;

Internal:
Internal it's pretty simple because you have the function GetClientEntityFromHandle() in IClientEntityList which does the ^procedure by calling engine function.
You must only add the BaseCombatWeapon class (without the WeaponPtr) and add a funktion into the IClientEntityClass to get access to the class.

C++:
CBaseCombatWeapon* GetWeapon( void )
{
EHANDLE hActiveWeapon = ( EHANDLE )*( PDWROD )( ( DWORD )this + OFFSET_HACTIVEWEAPON );

return ( CBaseCombatWeapon* )g_pClientEntityList->GetClientEntityFromHandle( hActiveWeapon );
}

So now you have the CBaseCombatWeapon class internal. now try to use the vtables to call the WeaponID. hint: Index is 432.
 
Katılım
26 Haz 2022
Konular
11
Mesajlar
2,506
Çözümler
7
Tepkime puanı
198
Konum
Osderda
RC Point
0
eski usul hurtme ile can tarama ve ollydbg string arama hala temel mantığı anlamak için güzel ama artık her güncellemede pointer avlamak insanı yoruyor gibi görünüyor gerçi geleneksel kaynak motoru mantığını öğrenmeden hazıra konmak da ileride farklı bir motor karşımıza çıkınca işimizi zorlaştırır diye düşünüyorum
 
Üst