mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-05-07 01:23:52 +00:00
feat: implement Warden module callbacks (sendPacket, validateModule, generateRC4)
Implement the three stubbed Warden module callbacks that were previously TODO placeholders: - **sendPacket**: Encrypts module output via WardenCrypto RC4 and sends as CMSG_WARDEN_DATA through the game socket. Enables modules to send responses back to the server (required for strict servers like Warmane). - **validateModule**: Compares the module's provided 16-byte MD5 hash against the hash received during download. Logs error on mismatch (indicates corrupted module transit). - **generateRC4**: Derives new encrypt/decrypt RC4 keys from a 16-byte seed using SHA1Randx, then replaces the active WardenCrypto key state. Handles mid-session re-keying requested by the module. Architecture: - Add setCallbackDependencies() to inject WardenCrypto* and socket send function into WardenModule before load() is called - Use thread_local WardenModule* so C function pointer callbacks (which can't capture state) can reach the module's dependencies during init - Wire dependencies from WardenHandler before module load Also update warden_module.hpp status markers — RSA verification, zlib, executable parsing, relocation, and Unicorn emulation are all implemented (were incorrectly marked as TODO). Only API binding/IAT patching and RSA modulus verification against real WoW.exe remain as gaps.
This commit is contained in:
parent
7cfaf2c7e9
commit
248d131af7
3 changed files with 88 additions and 24 deletions
|
|
@ -440,8 +440,21 @@ void WardenHandler::handleWardenData(network::Packet& packet) {
|
|||
}
|
||||
}
|
||||
|
||||
// Load the module (decrypt, decompress, parse, relocate)
|
||||
// Load the module (decrypt, decompress, parse, relocate, init)
|
||||
wardenLoadedModule_ = std::make_shared<WardenModule>();
|
||||
// Inject crypto and socket so module callbacks (sendPacket, generateRC4)
|
||||
// can reach the network layer during initializeModule().
|
||||
wardenLoadedModule_->setCallbackDependencies(
|
||||
wardenCrypto_.get(),
|
||||
[this](const uint8_t* data, size_t len) {
|
||||
if (!wardenCrypto_ || !owner_.socket) return;
|
||||
std::vector<uint8_t> plaintext(data, data + len);
|
||||
auto encrypted = wardenCrypto_->encrypt(plaintext);
|
||||
network::Packet pkt(wireOpcode(Opcode::CMSG_WARDEN_DATA));
|
||||
for (uint8_t b : encrypted) pkt.writeUInt8(b);
|
||||
owner_.socket->send(pkt);
|
||||
LOG_DEBUG("Warden: Module sendPacket callback sent ", len, " bytes");
|
||||
});
|
||||
if (wardenLoadedModule_->load(wardenModuleData_, wardenModuleHash_, wardenModuleKey_)) { // codeql[cpp/weak-cryptographic-algorithm]
|
||||
LOG_INFO("Warden: Module loaded successfully (image size=",
|
||||
wardenLoadedModule_->getModuleSize(), " bytes)");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue