From b0b56ee4f74d088f524059f83082a65d9d2147d4 Mon Sep 17 00:00:00 2001 From: Arthur <121949966+ShinyWasabi@users.noreply.github.com> Date: Sat, 7 Sep 2024 14:59:32 +0300 Subject: [PATCH] Add Logging for HTTP Start Requests (#3667) --- src/core/settings.hpp | 3 ++- src/hooks/misc/http_start_request.cpp | 5 ++++- src/views/debug/views_debug_logs.cpp | 1 + 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/core/settings.hpp b/src/core/settings.hpp index 7ab80a8f..b8df82f1 100644 --- a/src/core/settings.hpp +++ b/src/core/settings.hpp @@ -120,6 +120,7 @@ namespace big int metric_logs{}; int packet_logs{}; + bool http_start_request_logs{}; bool script_hook_logs{}; struct script_event @@ -134,7 +135,7 @@ namespace big NLOHMANN_DEFINE_TYPE_INTRUSIVE(script_event, logs, filter_player, player_id) } script_event{}; - NLOHMANN_DEFINE_TYPE_INTRUSIVE(logs, metric_logs, packet_logs, script_hook_logs, script_event) + NLOHMANN_DEFINE_TYPE_INTRUSIVE(logs, metric_logs, packet_logs, http_start_request_logs, script_hook_logs, script_event) } logs{}; struct fuzzer diff --git a/src/hooks/misc/http_start_request.cpp b/src/hooks/misc/http_start_request.cpp index e54c7961..11640d0f 100644 --- a/src/hooks/misc/http_start_request.cpp +++ b/src/hooks/misc/http_start_request.cpp @@ -4,11 +4,14 @@ namespace big { bool hooks::http_start_request(void* request, const char* uri) { + if (g.debug.logs.http_start_request_logs) + LOG(INFO) << uri; + if (strstr(uri, "Bonus")) [[unlikely]] { // This is for worst case scenario where a report does slip through the cracks... // Lets make it go somewhere it doesn't matter -- don't let the reports reach their servers! - LOG(WARNING) << "Blocked bonus report!"; + LOG(WARNING) << "Blocked bonus report!"; uri = "https://0.0.0.0/"; } return g_hooking->get_original()(request, uri); diff --git a/src/views/debug/views_debug_logs.cpp b/src/views/debug/views_debug_logs.cpp index a39ea0d0..0d403b20 100644 --- a/src/views/debug/views_debug_logs.cpp +++ b/src/views/debug/views_debug_logs.cpp @@ -11,6 +11,7 @@ namespace big static const char* options[]{"OFF"_T.data(), "ALL"_T.data(), "FILTERS"_T.data()}; ImGui::Combo("DEBUG_LOG_METRICS"_T.data(), (int*)&g.debug.logs.metric_logs, options, IM_ARRAYSIZE(options)); ImGui::Combo("VIEW_DEBUG_LOGS_LOG_PACKETS"_T.data(), (int*)&g.debug.logs.packet_logs, options, IM_ARRAYSIZE(options)); + ImGui::Checkbox("DEBUG_LOG_HTTP_START_REQUESTS"_T.data(), &g.debug.logs.http_start_request_logs); ImGui::Checkbox("DEBUG_LOG_NATIVE_SCRIPT_HOOKS"_T.data(), &g.debug.logs.script_hook_logs); if (ImGui::TreeNode("DEBUG_LOG_TREE_SCRIPT_EVENT"_T.data()))