-
Автор темы
- #1
It is detected by anti-cheat
main:
#include <iostream>
#include <Windows.h>
#include <TlHelp32.h>
#include "offset.cpp"
#include <thread>
#include <chrono>
uintptr_t GetModuleBaseAddress(DWORD procId, const wchar_t* moduleName) {
uintptr_t moduleBaseAddress = 0;
HANDLE snapshot = CreateToolhelp32Snapshot(TH32CS_SNAPMODULE | TH32CS_SNAPMODULE32, procId);
if (snapshot != INVALID_HANDLE_VALUE) {
MODULEENTRY32 moduleEntry;
moduleEntry.dwSize = sizeof(moduleEntry);
if (Module32First(snapshot, &moduleEntry)) {
do {
if (_wcsicmp(moduleEntry.szModule, moduleName) == 0) {
moduleBaseAddress = (uintptr_t)moduleEntry.modBaseAddr;
break;
}
} while (Module32Next(snapshot, &moduleEntry));
}
CloseHandle(snapshot);
}
return moduleBaseAddress;
}
int main() {
const wchar_t* processName = L"cs2.exe";
const wchar_t* moduleName = L"client.dll";
// Get process ID
DWORD procId = 0;
HANDLE hProcessSnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
PROCESSENTRY32 pe32;
pe32.dwSize = sizeof(pe32);
if (Process32First(hProcessSnap, &pe32)) {
do {
if (_wcsicmp(pe32.szExeFile, processName) == 0) {
procId = pe32.th32ProcessID;
break;
}
} while (Process32Next(hProcessSnap, &pe32));
}
CloseHandle(hProcessSnap);
if (procId == 0) {
std::cerr << "Process " << processName << " not found." << std::endl;
return 1;
}
uintptr_t client = GetModuleBaseAddress(procId, moduleName);
if (client == 0) {
std::cerr << "Module " << moduleName << " not found." << std::endl;
return 1;
}
HANDLE hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, procId);
if (hProcess == NULL) {
std::cerr << "Failed to open process." << std::endl;
return 1;
}
int jump = 65537;
int notjump = 256;
while (true)
{
DWORD local_player;
ReadProcessMemory(hProcess, (LPVOID)(client + dwLocalPlayerPawn), &local_player, sizeof(local_player), nullptr);
DWORD flags;
ReadProcessMemory(hProcess, (LPVOID)(local_player + m_EntClientFlags), &flags, sizeof(flags), nullptr);
if (GetAsyncKeyState(VK_SPACE) && (flags * (1 << 0)))
{
WriteProcessMemory(hProcess, (LPVOID)(client + dwForceJump), &jump, sizeof(jump), nullptr);
std::this_thread::sleep_for(std::chrono::milliseconds(5));
WriteProcessMemory(hProcess, (LPVOID)(client + dwForceJump), ¬jump, sizeof(notjump), nullptr);
std::this_thread::sleep_for(std::chrono::milliseconds(5));
}
}
CloseHandle(hProcess);
return 0;
}
offset:
#include <iostream>
#include <Windows.h>
#include <TlHelp32.h>
#include <thread>
#include <chrono>
const int dwForceJump = 0x1730530;
const int dwLocalPlayerPawn = 0x17371A8;
const int m_EntClientFlags = 0x3C8;