From 46d21e6c1ba7a7da363589d747c5e6a8793cd7bf Mon Sep 17 00:00:00 2001 From: killerwife Date: Sun, 10 Sep 2023 22:12:42 +0200 Subject: [PATCH] Fix warden scans terminator logic. https://github.com/vmangos/core/commit/eeb6d45574e2666ac62dc8fec0d8e9b83584cc65 - all credit goes to this --- .../Anticheat/module/Warden/WardenModule.hpp | 3 +++ src/game/Anticheat/module/Warden/warden.cpp | 2 +- .../Anticheat/module/Warden/wardenmodule.cpp | 17 +++++++++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/game/Anticheat/module/Warden/WardenModule.hpp b/src/game/Anticheat/module/Warden/WardenModule.hpp index 0ba273554f..921791b41d 100644 --- a/src/game/Anticheat/module/Warden/WardenModule.hpp +++ b/src/game/Anticheat/module/Warden/WardenModule.hpp @@ -57,6 +57,9 @@ class WardenModule // mapping of scan function to the numerical value of the opcode uint8_t opcodes[ScanTypeCount]; + // invalid opcode value that signifies scans are over + uint8 scanTerminator; + // pregenerated challenge, responses, and encryption keys for this module std::vector crk; }; diff --git a/src/game/Anticheat/module/Warden/warden.cpp b/src/game/Anticheat/module/Warden/warden.cpp index ca31c6042b..d4036e3a80 100644 --- a/src/game/Anticheat/module/Warden/warden.cpp +++ b/src/game/Anticheat/module/Warden/warden.cpp @@ -259,7 +259,7 @@ void Warden::RequestScans(std::vector> &&scans) if (_session->GetOS() == CLIENT_OS_WIN) { // indicates to the client that there are no further requests in this packet - buff << _xor; + buff << uint8(_module->scanTerminator ^ _xor); } BeginTimeoutClock(); diff --git a/src/game/Anticheat/module/Warden/wardenmodule.cpp b/src/game/Anticheat/module/Warden/wardenmodule.cpp index f106d3fc29..74003a030d 100644 --- a/src/game/Anticheat/module/Warden/wardenmodule.cpp +++ b/src/game/Anticheat/module/Warden/wardenmodule.cpp @@ -81,6 +81,23 @@ WardenModule::WardenModule(std::string const &bin, std::string const &kf, std::s if (Windows()) { + for (uint8 i = 0; i <= UINT8_MAX; i++) + { + if (opcodes[0] != i && + opcodes[1] != i && + opcodes[2] != i && + opcodes[3] != i && + opcodes[4] != i && + opcodes[5] != i && + opcodes[6] != i && + opcodes[7] != i && + opcodes[8] != i) + { + scanTerminator = i; + break; + } + } + if (!memoryRead) throw std::runtime_error("Module data does not include memory read information");