Implemented #20 into hack.hpp now featuring a better entity loop and fixing known bugs while cleaning the code.

Added simple config system to enable team esp, automatic updates, and render distance.

Also moved the offsets to the updater namespace and read/writte methods to the offsets.json

Implemented Handle Hijacking method requested by #19 to improve the security. Credits to Apxaey on github for the source
This commit is contained in:
IMXNOOBX
2023-10-03 17:52:46 +02:00
parent 53a65d22c2
commit 509d2b5f2d
12 changed files with 524 additions and 74 deletions
+36
View File
@@ -1,5 +1,6 @@
#include "memory.hpp"
#include <tlhelp32.h>
#include "handle_hijack.hpp"
uint32_t pProcess::FindProcessIdByProcessName(const char* ProcessName)
{
@@ -83,6 +84,41 @@ bool pProcess::AttachProcess(const char* ProcessName)
return false;
}
bool pProcess::AttachProcessHj(const char* ProcessName)
{
this->pid_ = this->FindProcessIdByProcessName(ProcessName);
if (pid_)
{
HMODULE modules[0xFF];
MODULEINFO module_info;
DWORD _;
// Using Apxaey's handle hijack function to safely open a handle
handle_ = hj::HijackExistingHandle(pid_);
if (!hj::IsHandleValid(handle_))
{
std::cout << "[cheat] Handle Hijack failed, falling back to OpenProcess method." << std::endl;
return pProcess::AttachProcess(ProcessName); // Handle hijacking failed, so we fall back to the normal OpenProcess method
}
EnumProcessModulesEx(this->handle_, modules, sizeof(modules), &_, LIST_MODULES_64BIT);
base_module_.base = (uintptr_t)modules[0];
GetModuleInformation(this->handle_, modules[0], &module_info, sizeof(module_info));
base_module_.size = module_info.SizeOfImage;
hwnd_ = this->GetWindowHandleFromProcessId(pid_);
return true;
}
return false;
}
bool pProcess::AttachWindow(const char* WindowName)
{
this->pid_ = this->FindProcessIdByWindowName(WindowName);