External base for conter strike : global offensive
So I decided to write a little project for those who are starting off and don’t quite know where to go. It consists of memory classes which sets everything up so you can read and write memory as you wish. Offsets are also provided… There are ways of getting the offset instead of hardcoding them, but i’ll leave that up to you to discover..
#include "SDK.h"
namespace SDK
{
int DOPROC::ReadInt(HANDLE Process, DWORD address) {
int value;
ReadProcessMemory(Process, (PBYTE*)(address), &value, sizeof(int), 0);
return value;
}
float DOPROC::ReadFloat(HANDLE Process, DWORD address) {
float value;
ReadProcessMemory(Process, (PBYTE*)(address), &value, sizeof(float), 0);
return value;
}
DWORD DOPROC::ReadDWORD(HANDLE Process, DWORD address) {
DWORD value;
ReadProcessMemory(Process, (PBYTE*)(address), &value, sizeof(DWORD), 0);
return value;
}
SDK::Vector3D DOPROC::ReadVector(HANDLE Process, DWORD address) {
SDK::Vector3D value;
ReadProcessMemory(Process, (PBYTE*)(address), &value.x, sizeof(float), 0);
ReadProcessMemory(Process, (PBYTE*)(address + 0x4), &value.z, sizeof(float), 0);
ReadProcessMemory(Process, (PBYTE*)(address + 0x8), &value.y, sizeof(float), 0);
return value;
}
void DOPROC::WriteFloat(HANDLE Process, DWORD address, float value) {
WriteProcessMemory(Process, (PBYTE*)(address), &value, sizeof(float), 0);
}
void DOPROC::WriteInt(HANDLE Process, DWORD address, int value) {
WriteProcessMemory(Process, (PBYTE*)(address), &value, sizeof(int), 0);
}
}
#include
#include "SDK.h"
//////////////////////
/// MAIN FUNCTIONS ///
//////////////////////
SDK::GTPROC GETPROCESS;
SDK::DOPROC DOPROCESS;
DWORD g_pLocalPlayer;
DWORD g_pEntityList;
DWORD oEntityList = 0x4A8D1AC;
DWORD oLocalPlayer = 0xAAFD7C;
DWORD oVecOrigin = 0x134;
HANDLE g_dwProc;
DWORD g_dwClient;
void Setup() {
printf("CS:GOs\n\n[Getting Addresses]\n\n");
g_dwProc = GETPROCESS.GetProcess("csgo.exe");
g_dwClient = GETPROCESS.GetModule("client.dll");
g_pLocalPlayer = DOPROCESS.ReadDWORD(g_dwProc, g_dwClient + oLocalPlayer);
printf("-Playerbase: %lu\n", g_pLocalPlayer);
printf("\n[Ready]");
}
int main() {
Setup();
while (true) {
//Removes Flash By OverWriting Alpha
if(DOPROCESS.ReadFloat(g_dwProc, g_pLocalPlayer + 0xA2F4) != 0.f)
DOPROCESS.WriteFloat(g_dwProc, g_pLocalPlayer + 0xA2F4, 25.f);
}
return 0;
}
#include "SDK.h"
PROCESSENTRY32 gameProcess;
namespace SDK
{
DWORD GTPROC::FindProcessName(const char *__ProcessName, PROCESSENTRY32 *pEntry)
{
PROCESSENTRY32 __ProcessEntry;
__ProcessEntry.dwSize = sizeof(PROCESSENTRY32);
HANDLE hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
if (hSnapshot == INVALID_HANDLE_VALUE) return 0; if (!Process32First(hSnapshot, &__ProcessEntry))
{
CloseHandle(hSnapshot);
return 0;
}
do {
if (!_strcmpi(__ProcessEntry.szExeFile, __ProcessName))
{
memcpy((void *)pEntry, (void *)&__ProcessEntry, sizeof(PROCESSENTRY32));
CloseHandle(hSnapshot);
return __ProcessEntry.th32ProcessID;
}
} while (Process32Next(hSnapshot, &__ProcessEntry));
CloseHandle(hSnapshot);
return 0;
}
DWORD GTPROC::getThreadByProcess(DWORD __DwordProcess)
{
THREADENTRY32 __ThreadEntry;
__ThreadEntry.dwSize = sizeof(THREADENTRY32);
HANDLE hSnapshot = CreateToolhelp32Snapshot(TH32CS_SNAPTHREAD, 0);
if (hSnapshot == INVALID_HANDLE_VALUE) return 0;
if (!Thread32First(hSnapshot, &__ThreadEntry)) { CloseHandle(hSnapshot); return 0; }
do {
if (__ThreadEntry.th32OwnerProcessID == __DwordProcess)
{
CloseHandle(hSnapshot);
return __ThreadEntry.th32ThreadID;
}
} while (Thread32Next(hSnapshot, &__ThreadEntry));
CloseHandle(hSnapshot);
return 0;
}
DWORD GTPROC::GetModuleNamePointer(LPSTR LPSTRModuleName, DWORD __DwordProcessId)
{
MODULEENTRY32 lpModuleEntry = { 0 };
HANDLE hSnapShot = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, __DwordProcessId);
if (!hSnapShot)
return NULL;
lpModuleEntry.dwSize = sizeof(lpModuleEntry);
BOOL __RunModule = Module32First(hSnapShot, &lpModuleEntry);
while (__RunModule)
{
if (!strcmp(lpModuleEntry.szModule, LPSTRModuleName))
{
CloseHandle(hSnapShot);
return (DWORD)lpModuleEntry.modBaseAddr;
}
__RunModule = Module32Next(hSnapShot, &lpModuleEntry);
}
CloseHandle(hSnapShot);
return NULL;
}
void GTPROC::runSetDebugPrivs()
{
HANDLE __HandleProcess = GetCurrentProcess(), __HandleToken;
TOKEN_PRIVILEGES priv;
LUID __LUID;
OpenProcessToken(__HandleProcess, TOKEN_ADJUST_PRIVILEGES, &__HandleToken);
LookupPrivilegeValue(0, "seDebugPrivilege", &__LUID);
priv.PrivilegeCount = 1;
priv.Privileges[0].Luid = __LUID;
priv.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
AdjustTokenPrivileges(__HandleToken, false, &priv, 0, 0, 0);
CloseHandle(__HandleToken);
CloseHandle(__HandleProcess);
}
HANDLE GTPROC::GetProcess(const char* processname)
{
runSetDebugPrivs();
while (!FindProcessName(processname, &gameProcess)) Sleep(12);
while (!(getThreadByProcess(gameProcess.th32ProcessID))) Sleep(12);
HANDLE HandleProcess = OpenProcess(PROCESS_ALL_ACCESS, false, gameProcess.th32ProcessID);
return HandleProcess;
}
DWORD GTPROC::GetModule(const char* modulename)
{
DWORD dw_module = 0x0;
while (dw_module == 0x0) dw_module = GetModuleNamePointer((LPSTR)modulename, gameProcess.th32ProcessID);
return dw_module;
}
}
All sources here github.com/iBambooFox/ext_base/tree/master/ext_base
|