From 33974e81f5f0ca1e5c6fe5d78f0a3c0f2d4d5817 Mon Sep 17 00:00:00 2001 From: Abu Aziz v <67204062+abuazizv@users.noreply.github.com> Date: Sun, 6 Apr 2025 01:30:00 +0300 Subject: [PATCH] Block The Bonus Endpoint (#104) * Block Bonus Endpoint. * fix * Block bonus endpoint --- src/core/hooking/Hooking.cpp | 1 + src/game/hooks/Anticheat/HttpStartRequest.cpp | 24 +++++++++++++++++++ src/game/hooks/Hooks.hpp | 1 + src/game/pointers/Pointers.cpp | 5 ++++ src/game/pointers/Pointers.hpp | 1 + 5 files changed, 32 insertions(+) create mode 100644 src/game/hooks/Anticheat/HttpStartRequest.cpp diff --git a/src/core/hooking/Hooking.cpp b/src/core/hooking/Hooking.cpp index 88585ee..9667da0 100644 --- a/src/core/hooking/Hooking.cpp +++ b/src/core/hooking/Hooking.cpp @@ -19,6 +19,7 @@ namespace YimMenu BaseHook::Add(new DetourHook("QueueDependency", Pointers.QueueDependency, Hooks::Anticheat::QueueDependency)); BaseHook::Add(new DetourHook("PrepareMetricForSending", Pointers.PrepareMetricForSending, Hooks::Anticheat::PrepareMetricForSending)); BaseHook::Add(new DetourHook("GetThreadContext", reinterpret_cast(GetProcAddress(LoadLibraryA("kernel32.dll"), "GetThreadContext")), Hooks::Anticheat::GetThreadContext)); + BaseHook::Add(new DetourHook("HttpStartRequest", Pointers.HttpStartRequest, Hooks::Anticheat::HttpStartRequest)); BaseHook::Add(new DetourHook("RunScriptThreads", Pointers.RunScriptThreads, Hooks::Script::RunScriptThreads)); BaseHook::Add(new DetourHook("InitNativeTables", Pointers.InitNativeTables, Hooks::Script::InitNativeTables)); diff --git a/src/game/hooks/Anticheat/HttpStartRequest.cpp b/src/game/hooks/Anticheat/HttpStartRequest.cpp new file mode 100644 index 0000000..96b2d01 --- /dev/null +++ b/src/game/hooks/Anticheat/HttpStartRequest.cpp @@ -0,0 +1,24 @@ +#include "common.hpp" +#include "core/hooking/DetourHook.hpp" +#include "game/hooks/Hooks.hpp" + + +namespace YimMenu::Hooks +{ + void Anticheat::HttpStartRequest(void* request) + { + uintptr_t req_ptr = reinterpret_cast(request); + const char** host_ptr = reinterpret_cast(req_ptr + 0x18F8); + const char* path = *reinterpret_cast(req_ptr + 0x1900); + + if (path && strstr(path, "Bonus")) + { + *const_cast(host_ptr) = "0.0.0.0"; + LOG(WARNING) << "Blocked Bonus Report"; + return BaseHook::Get>()->Original()(request); + } + + + return BaseHook::Get>()->Original()(request); + } +} \ No newline at end of file diff --git a/src/game/hooks/Hooks.hpp b/src/game/hooks/Hooks.hpp index 1bf9be0..e88af87 100644 --- a/src/game/hooks/Hooks.hpp +++ b/src/game/hooks/Hooks.hpp @@ -37,6 +37,7 @@ namespace YimMenu::Hooks extern void QueueDependency(__int64 a1); extern bool PrepareMetricForSending(rage::JsonSerializer* ser, void* a2, void* a3, rage::rlMetric* metric); extern BOOL GetThreadContext(HANDLE hThread, LPCONTEXT lpContext); + extern void HttpStartRequest(void* request); } namespace Info diff --git a/src/game/pointers/Pointers.cpp b/src/game/pointers/Pointers.cpp index f5784b8..5e56975 100644 --- a/src/game/pointers/Pointers.cpp +++ b/src/game/pointers/Pointers.cpp @@ -261,6 +261,11 @@ namespace YimMenu GetActiveBasket = ptr.Sub(0x39).As(); }); + constexpr auto HttpStartRequestPtrn = Pattern<"56 57 48 83 EC 28 48 89 CE 8B 81 ? ? ? ? FF C8 83 F8 04 0F 87">("HttpStartRequest"); + scanner.Add(HttpStartRequestPtrn, [this](PointerCalculator ptr) { + HttpStartRequest = ptr.As(); + }); + if (!scanner.Scan()) { LOG(FATAL) << "Some patterns could not be found, unloading."; diff --git a/src/game/pointers/Pointers.hpp b/src/game/pointers/Pointers.hpp index 018e1a8..20da8b7 100644 --- a/src/game/pointers/Pointers.hpp +++ b/src/game/pointers/Pointers.hpp @@ -108,6 +108,7 @@ namespace YimMenu Functions::GetCatalogItem GetCatalogItem; void** TransactionMgr; Functions::GetActiveBasket GetActiveBasket; + PVOID HttpStartRequest; }; struct Pointers : PointerData