diff --git a/deps/fmt b/deps/fmt index a5d0adf3..2bf59a97 160000 --- a/deps/fmt +++ b/deps/fmt @@ -1 +1 @@ -Subproject commit a5d0adf3953f0ae3e698d5b5702d1e5a7bf3d87e +Subproject commit 2bf59a97c6e65e4963913d9ba2f8d260e5c8fbf5 diff --git a/deps/json11 b/deps/json11 index fb6cc808..78780917 160000 --- a/deps/json11 +++ b/deps/json11 @@ -1 +1 @@ -Subproject commit fb6cc808e0a3532d27ee336cd8f2e1ff06093f3b +Subproject commit 787809178ddb3d739e6f408af5233930c9077929 diff --git a/deps/mongoose b/deps/mongoose index af98854c..d4a83514 160000 --- a/deps/mongoose +++ b/deps/mongoose @@ -1 +1 @@ -Subproject commit af98854ce440181a46a3a3315c1e69dcbf1e7918 +Subproject commit d4a8351464e9737b8108435ffb51382f21a55230 diff --git a/deps/protobuf b/deps/protobuf index 32fadc0d..a2484208 160000 --- a/deps/protobuf +++ b/deps/protobuf @@ -1 +1 @@ -Subproject commit 32fadc0d4928c5f2d2c76fc4ddc39270673b7fa7 +Subproject commit a2484208c3291ea522a891114d2821829bd09083 diff --git a/src/Components/Modules/AntiCheat.cpp b/src/Components/Modules/AntiCheat.cpp index cb2b0939..5df5af22 100644 --- a/src/Components/Modules/AntiCheat.cpp +++ b/src/Components/Modules/AntiCheat.cpp @@ -85,12 +85,16 @@ namespace Components jmp AntiCheat::NullSub } } -#endif - +#else void AntiCheat::CrashClient() { +#ifdef DEBUG_DETECTIONS + MessageBoxA(0, "Check the debug log for more information!", "AntiCheat triggered", MB_ICONERROR); +#else Utils::Hook::Set(0x41BA2C, 0xEB); +#endif } +#endif void AntiCheat::AssertCalleeModule(void* callee) { diff --git a/src/Components/Modules/AntiCheat.hpp b/src/Components/Modules/AntiCheat.hpp index 32e5ff2c..75ff07c0 100644 --- a/src/Components/Modules/AntiCheat.hpp +++ b/src/Components/Modules/AntiCheat.hpp @@ -3,7 +3,7 @@ // Log detections // Make sure to disable that before releasig! -//#define DEBUG_DETECTIONS +#define DEBUG_DETECTIONS namespace Components { diff --git a/src/Components/Modules/Auth.cpp b/src/Components/Modules/Auth.cpp index 0da1a830..5d72f79a 100644 --- a/src/Components/Modules/Auth.cpp +++ b/src/Components/Modules/Auth.cpp @@ -8,6 +8,51 @@ namespace Components Utils::Cryptography::Token Auth::ComputeToken; Utils::Cryptography::ECC::Key Auth::GuidKey; + void Auth::Frame() + { + if (Auth::TokenContainer.generating) + { + static int lastCalc = 0; + static double mseconds = 0; + + if (!lastCalc || (Game::Sys_Milliseconds() - lastCalc) > 500) + { + lastCalc = Game::Sys_Milliseconds(); + + int diff = Game::Sys_Milliseconds() - Auth::TokenContainer.startTime; + double hashPMS = (Auth::TokenContainer.hashes * 1.0) / diff; + double requiredHashes = std::pow(2, Auth::TokenContainer.targetLevel + 1) - Auth::TokenContainer.hashes; + mseconds = requiredHashes / hashPMS; + if (mseconds < 0) mseconds = 0; + } + + Localization::Set("MPUI_SECURITY_INCREASE_MESSAGE", Utils::String::VA("Increasing security level from %d to %d (est. %s)", Auth::GetSecurityLevel(), Auth::TokenContainer.targetLevel, Utils::String::FormatTimeSpan(static_cast(mseconds)).data())); + } + else if (Auth::TokenContainer.thread.joinable()) + { + Auth::TokenContainer.thread.join(); + Auth::TokenContainer.generating = false; + + Auth::StoreKey(); + Logger::Print("Security level is %d\n", Auth::GetSecurityLevel()); + Command::Execute("closemenu security_increase_popmenu", false); + + if (!Auth::TokenContainer.cancel) + { + if (Auth::TokenContainer.command.empty()) + { + Game::MessageBox(Utils::String::VA("Your new security level is %d", Auth::GetSecurityLevel()), "Success"); + } + else + { + Command::Execute(Auth::TokenContainer.command, false); + } + } + + Auth::TokenContainer.cancel = false; + } + } + void Auth::SendConnectDataStub(Game::netsrc_t sock, Game::netadr_t adr, const char *format, int len) { // Ensure our certificate is loaded @@ -319,6 +364,8 @@ namespace Components Auth::LoadKey(true); + QuickPatch::OnFrame(Auth::Frame); + // Register dvar Dvar::Register("sv_securityLevel", 23, 0, 512, Game::dvar_flag::DVAR_FLAG_SERVERINFO, "Security level for GUID certificates (POW)"); diff --git a/src/Components/Modules/Auth.hpp b/src/Components/Modules/Auth.hpp index 2bd5c6ac..f68897f5 100644 --- a/src/Components/Modules/Auth.hpp +++ b/src/Components/Modules/Auth.hpp @@ -41,5 +41,7 @@ namespace Components static void SendConnectDataStub(Game::netsrc_t sock, Game::netadr_t adr, const char *format, int len); static void ParseConnectData(Game::msg_t* msg, Game::netadr_t addr); static void DirectConnectStub(); + + static void Frame(); }; } diff --git a/src/Components/Modules/Maps.cpp b/src/Components/Modules/Maps.cpp index 6b25c818..c0960b5c 100644 --- a/src/Components/Modules/Maps.cpp +++ b/src/Components/Modules/Maps.cpp @@ -177,7 +177,7 @@ namespace Components // This is placed here in case the anticheat has been disabled! #ifndef DEBUG - Renderer::OnFrame(AntiCheat::ScanIntegrityCheck); + QuickPatch::OnFrame(AntiCheat::ScanIntegrityCheck); #endif } diff --git a/src/Components/Modules/RawFiles.cpp b/src/Components/Modules/RawFiles.cpp index c653f1e9..cc37184f 100644 --- a/src/Components/Modules/RawFiles.cpp +++ b/src/Components/Modules/RawFiles.cpp @@ -23,7 +23,7 @@ namespace Components // This is placed here in case the anticheat has been disabled! #ifndef DEBUG - Renderer::OnFrame(AntiCheat::FlagIntegrityCheck); + QuickPatch::OnFrame(AntiCheat::FlagIntegrityCheck); #endif } } diff --git a/src/Components/Modules/ServerList.cpp b/src/Components/Modules/ServerList.cpp index e695e5e3..3f1cc0f6 100644 --- a/src/Components/Modules/ServerList.cpp +++ b/src/Components/Modules/ServerList.cpp @@ -719,7 +719,7 @@ namespace Components // This is placed here in case the anticheat has been disabled! #ifndef DEBUG - Renderer::OnFrame(AntiCheat::ReadIntegrityCheck); + QuickPatch::OnFrame(AntiCheat::ReadIntegrityCheck); #endif } diff --git a/tools/protoc.exe b/tools/protoc.exe index d36a1cc9..9285f90e 100644 Binary files a/tools/protoc.exe and b/tools/protoc.exe differ