mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-02-03 19:13:49 +00:00
refactor(Core/Game): restyle game lib with astyle (#3466)
This commit is contained in:
@@ -20,8 +20,8 @@
|
||||
#include "BanManager.h"
|
||||
|
||||
Warden::Warden() : _session(nullptr), _inputCrypto(16), _outputCrypto(16), _checkTimer(10000/*10 sec*/), _clientResponseTimer(0),
|
||||
_dataSent(false), _previousTimestamp(0), _module(nullptr), _initialized(false)
|
||||
{
|
||||
_dataSent(false), _previousTimestamp(0), _module(nullptr), _initialized(false)
|
||||
{
|
||||
memset(_inputKey, 0, sizeof(_inputKey));
|
||||
memset(_outputKey, 0, sizeof(_outputKey));
|
||||
memset(_seed, 0, sizeof(_seed));
|
||||
@@ -144,7 +144,8 @@ bool Warden::IsValidCheckSum(uint32 checksum, const uint8* data, const uint16 le
|
||||
}
|
||||
}
|
||||
|
||||
struct keyData {
|
||||
struct keyData
|
||||
{
|
||||
union
|
||||
{
|
||||
struct
|
||||
@@ -184,56 +185,115 @@ std::string Warden::Penalty(WardenCheck* check /*= NULL*/, uint16 checkFailed /*
|
||||
if (checkFailed)
|
||||
switch (checkFailed)
|
||||
{
|
||||
case 47: banReason += " (FrameXML Signature Check)"; break;
|
||||
case 51: banReason += " (Lua DoString)"; break;
|
||||
case 59: banReason += " (Lua Protection Patch)"; break;
|
||||
case 72: banReason += " (Movement State related)"; break;
|
||||
case 118: banReason += " (Wall Climb)"; break;
|
||||
case 121: banReason += " (No Fall Damage Patch)"; break;
|
||||
case 193: banReason += " (Follow Unit Check)"; break;
|
||||
case 209: banReason += " (WoWEmuHacker Injection)"; longBan = true; break;
|
||||
case 237: banReason += " (AddChatMessage)"; break;
|
||||
case 246: banReason += " (Language Patch)"; break;
|
||||
case 260: banReason += " (Jump Momentum)"; break;
|
||||
case 288: banReason += " (Language Patch)"; break;
|
||||
case 308: banReason += " (SendChatMessage)"; break;
|
||||
case 312: banReason += " (Jump Physics)"; break;
|
||||
case 314: banReason += " (GetCharacterInfo)"; break;
|
||||
case 329: banReason += " (Wall Climb)"; break;
|
||||
case 343: banReason += " (Login Password Pointer)"; break;
|
||||
case 349: banReason += " (Language Patch)"; break;
|
||||
case 712: banReason += " (WS2_32.Send)"; break;
|
||||
case 780: banReason += " (Lua Protection Remover)"; break;
|
||||
case 781: banReason += " (Walk on Water Patch)"; break;
|
||||
case 782: banReason += " (Collision M2 Special)"; longBan = true; break;
|
||||
case 783: banReason += " (Collision M2 Regular)"; longBan = true; break;
|
||||
case 784: banReason += " (Collision WMD)"; longBan = true; break;
|
||||
case 785: banReason += " (Multi-Jump Patch)"; break;
|
||||
case 786: banReason += " (WPE PRO)"; longBan = true; break;
|
||||
case 787: banReason += " (rEdoX Packet Editor)"; break;
|
||||
case 47:
|
||||
banReason += " (FrameXML Signature Check)";
|
||||
break;
|
||||
case 51:
|
||||
banReason += " (Lua DoString)";
|
||||
break;
|
||||
case 59:
|
||||
banReason += " (Lua Protection Patch)";
|
||||
break;
|
||||
case 72:
|
||||
banReason += " (Movement State related)";
|
||||
break;
|
||||
case 118:
|
||||
banReason += " (Wall Climb)";
|
||||
break;
|
||||
case 121:
|
||||
banReason += " (No Fall Damage Patch)";
|
||||
break;
|
||||
case 193:
|
||||
banReason += " (Follow Unit Check)";
|
||||
break;
|
||||
case 209:
|
||||
banReason += " (WoWEmuHacker Injection)";
|
||||
longBan = true;
|
||||
break;
|
||||
case 237:
|
||||
banReason += " (AddChatMessage)";
|
||||
break;
|
||||
case 246:
|
||||
banReason += " (Language Patch)";
|
||||
break;
|
||||
case 260:
|
||||
banReason += " (Jump Momentum)";
|
||||
break;
|
||||
case 288:
|
||||
banReason += " (Language Patch)";
|
||||
break;
|
||||
case 308:
|
||||
banReason += " (SendChatMessage)";
|
||||
break;
|
||||
case 312:
|
||||
banReason += " (Jump Physics)";
|
||||
break;
|
||||
case 314:
|
||||
banReason += " (GetCharacterInfo)";
|
||||
break;
|
||||
case 329:
|
||||
banReason += " (Wall Climb)";
|
||||
break;
|
||||
case 343:
|
||||
banReason += " (Login Password Pointer)";
|
||||
break;
|
||||
case 349:
|
||||
banReason += " (Language Patch)";
|
||||
break;
|
||||
case 712:
|
||||
banReason += " (WS2_32.Send)";
|
||||
break;
|
||||
case 780:
|
||||
banReason += " (Lua Protection Remover)";
|
||||
break;
|
||||
case 781:
|
||||
banReason += " (Walk on Water Patch)";
|
||||
break;
|
||||
case 782:
|
||||
banReason += " (Collision M2 Special)";
|
||||
longBan = true;
|
||||
break;
|
||||
case 783:
|
||||
banReason += " (Collision M2 Regular)";
|
||||
longBan = true;
|
||||
break;
|
||||
case 784:
|
||||
banReason += " (Collision WMD)";
|
||||
longBan = true;
|
||||
break;
|
||||
case 785:
|
||||
banReason += " (Multi-Jump Patch)";
|
||||
break;
|
||||
case 786:
|
||||
banReason += " (WPE PRO)";
|
||||
longBan = true;
|
||||
break;
|
||||
case 787:
|
||||
banReason += " (rEdoX Packet Editor)";
|
||||
break;
|
||||
}
|
||||
|
||||
switch (action)
|
||||
{
|
||||
case WARDEN_ACTION_LOG:
|
||||
return "None";
|
||||
break;
|
||||
case WARDEN_ACTION_KICK:
|
||||
_session->KickPlayer("WARDEN_ACTION_KICK");
|
||||
return "Kick";
|
||||
break;
|
||||
case WARDEN_ACTION_BAN:
|
||||
{
|
||||
std::stringstream duration;
|
||||
duration << sWorld->getIntConfig(CONFIG_WARDEN_CLIENT_BAN_DURATION) << "s";
|
||||
std::string accountName;
|
||||
AccountMgr::GetName(_session->GetAccountId(), accountName);
|
||||
sBan->BanAccount(accountName, ((longBan && false /*ZOMG!*/) ? "1209600s" : duration.str()), banReason, "Server");
|
||||
case WARDEN_ACTION_LOG:
|
||||
return "None";
|
||||
break;
|
||||
case WARDEN_ACTION_KICK:
|
||||
_session->KickPlayer("WARDEN_ACTION_KICK");
|
||||
return "Kick";
|
||||
break;
|
||||
case WARDEN_ACTION_BAN:
|
||||
{
|
||||
std::stringstream duration;
|
||||
duration << sWorld->getIntConfig(CONFIG_WARDEN_CLIENT_BAN_DURATION) << "s";
|
||||
std::string accountName;
|
||||
AccountMgr::GetName(_session->GetAccountId(), accountName);
|
||||
sBan->BanAccount(accountName, ((longBan && false /*ZOMG!*/) ? "1209600s" : duration.str()), banReason, "Server");
|
||||
|
||||
return "Ban";
|
||||
}
|
||||
default:
|
||||
break;
|
||||
return "Ban";
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return "Undefined";
|
||||
}
|
||||
|
||||
@@ -93,43 +93,43 @@ class Warden
|
||||
friend class WardenWin;
|
||||
friend class WardenMac;
|
||||
|
||||
public:
|
||||
Warden();
|
||||
virtual ~Warden();
|
||||
public:
|
||||
Warden();
|
||||
virtual ~Warden();
|
||||
|
||||
virtual void Init(WorldSession* session, BigNumber* k) = 0;
|
||||
virtual ClientWardenModule* GetModuleForClient() = 0;
|
||||
virtual void InitializeModule() = 0;
|
||||
virtual void RequestHash() = 0;
|
||||
virtual void HandleHashResult(ByteBuffer &buff) = 0;
|
||||
virtual void RequestData() = 0;
|
||||
virtual void HandleData(ByteBuffer &buff) = 0;
|
||||
virtual void Init(WorldSession* session, BigNumber* k) = 0;
|
||||
virtual ClientWardenModule* GetModuleForClient() = 0;
|
||||
virtual void InitializeModule() = 0;
|
||||
virtual void RequestHash() = 0;
|
||||
virtual void HandleHashResult(ByteBuffer& buff) = 0;
|
||||
virtual void RequestData() = 0;
|
||||
virtual void HandleData(ByteBuffer& buff) = 0;
|
||||
|
||||
void SendModuleToClient();
|
||||
void RequestModule();
|
||||
void Update();
|
||||
void DecryptData(uint8* buffer, uint32 length);
|
||||
void EncryptData(uint8* buffer, uint32 length);
|
||||
void SendModuleToClient();
|
||||
void RequestModule();
|
||||
void Update();
|
||||
void DecryptData(uint8* buffer, uint32 length);
|
||||
void EncryptData(uint8* buffer, uint32 length);
|
||||
|
||||
static bool IsValidCheckSum(uint32 checksum, const uint8 *data, const uint16 length);
|
||||
static uint32 BuildChecksum(const uint8 *data, uint32 length);
|
||||
static bool IsValidCheckSum(uint32 checksum, const uint8* data, const uint16 length);
|
||||
static uint32 BuildChecksum(const uint8* data, uint32 length);
|
||||
|
||||
// If no check is passed, the default action from config is executed
|
||||
std::string Penalty(WardenCheck* check = NULL, uint16 checkFailed = 0);
|
||||
// If no check is passed, the default action from config is executed
|
||||
std::string Penalty(WardenCheck* check = NULL, uint16 checkFailed = 0);
|
||||
|
||||
private:
|
||||
WorldSession* _session;
|
||||
uint8 _inputKey[16];
|
||||
uint8 _outputKey[16];
|
||||
uint8 _seed[16];
|
||||
ARC4 _inputCrypto;
|
||||
ARC4 _outputCrypto;
|
||||
uint32 _checkTimer; // Timer for sending check requests
|
||||
uint32 _clientResponseTimer; // Timer for client response delay
|
||||
bool _dataSent;
|
||||
uint32 _previousTimestamp;
|
||||
ClientWardenModule* _module;
|
||||
bool _initialized;
|
||||
private:
|
||||
WorldSession* _session;
|
||||
uint8 _inputKey[16];
|
||||
uint8 _outputKey[16];
|
||||
uint8 _seed[16];
|
||||
ARC4 _inputCrypto;
|
||||
ARC4 _outputCrypto;
|
||||
uint32 _checkTimer; // Timer for sending check requests
|
||||
uint32 _clientResponseTimer; // Timer for client response delay
|
||||
bool _dataSent;
|
||||
uint32 _previousTimestamp;
|
||||
ClientWardenModule* _module;
|
||||
bool _initialized;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -115,12 +115,12 @@ void WardenCheckMgr::LoadWardenChecks()
|
||||
|
||||
if (checkType == MPQ_CHECK || checkType == MEM_CHECK)
|
||||
{
|
||||
WardenCheckResult *wr = new WardenCheckResult();
|
||||
WardenCheckResult* wr = new WardenCheckResult();
|
||||
wr->Result.SetHexStr(checkResult.c_str());
|
||||
int len = checkResult.size() / 2;
|
||||
if (wr->Result.GetNumBytes() < len)
|
||||
{
|
||||
uint8 *temp = new uint8[len];
|
||||
uint8* temp = new uint8[len];
|
||||
memset(temp, 0, len);
|
||||
memcpy(temp, wr->Result.AsByteArray().get(), wr->Result.GetNumBytes());
|
||||
std::reverse(temp, temp + len);
|
||||
@@ -136,8 +136,7 @@ void WardenCheckMgr::LoadWardenChecks()
|
||||
wardenCheck->Comment = comment;
|
||||
|
||||
++count;
|
||||
}
|
||||
while (result->NextRow());
|
||||
} while (result->NextRow());
|
||||
|
||||
sLog->outString(">> Loaded %u warden checks.", count);
|
||||
sLog->outString();
|
||||
@@ -185,8 +184,7 @@ void WardenCheckMgr::LoadWardenOverrides()
|
||||
CheckStore[checkId]->Action = WardenActions(action);
|
||||
++count;
|
||||
}
|
||||
}
|
||||
while (result->NextRow());
|
||||
} while (result->NextRow());
|
||||
|
||||
sLog->outString(">> Loaded %u warden action overrides.", count);
|
||||
sLog->outString();
|
||||
|
||||
@@ -39,27 +39,27 @@ class WardenCheckMgr
|
||||
WardenCheckMgr();
|
||||
~WardenCheckMgr();
|
||||
|
||||
public:
|
||||
static WardenCheckMgr* instance();
|
||||
public:
|
||||
static WardenCheckMgr* instance();
|
||||
|
||||
// We have a linear key without any gaps, so we use vector for fast access
|
||||
typedef std::vector<WardenCheck*> CheckContainer;
|
||||
typedef std::map<uint32, WardenCheckResult*> CheckResultContainer;
|
||||
// We have a linear key without any gaps, so we use vector for fast access
|
||||
typedef std::vector<WardenCheck*> CheckContainer;
|
||||
typedef std::map<uint32, WardenCheckResult*> CheckResultContainer;
|
||||
|
||||
WardenCheck* GetWardenDataById(uint16 Id);
|
||||
WardenCheckResult* GetWardenResultById(uint16 Id);
|
||||
WardenCheck* GetWardenDataById(uint16 Id);
|
||||
WardenCheckResult* GetWardenResultById(uint16 Id);
|
||||
|
||||
std::vector<uint16> MemChecksIdPool;
|
||||
std::vector<uint16> OtherChecksIdPool;
|
||||
std::vector<uint16> MemChecksIdPool;
|
||||
std::vector<uint16> OtherChecksIdPool;
|
||||
|
||||
void LoadWardenChecks();
|
||||
void LoadWardenOverrides();
|
||||
void LoadWardenChecks();
|
||||
void LoadWardenOverrides();
|
||||
|
||||
ACE_RW_Mutex _checkStoreLock;
|
||||
ACE_RW_Mutex _checkStoreLock;
|
||||
|
||||
private:
|
||||
CheckContainer CheckStore;
|
||||
CheckResultContainer CheckResultStore;
|
||||
private:
|
||||
CheckContainer CheckStore;
|
||||
CheckResultContainer CheckResultStore;
|
||||
};
|
||||
|
||||
#define sWardenCheckMgr WardenCheckMgr::instance()
|
||||
|
||||
@@ -26,7 +26,7 @@ WardenMac::~WardenMac()
|
||||
{
|
||||
}
|
||||
|
||||
void WardenMac::Init(WorldSession *pClient, BigNumber *K)
|
||||
void WardenMac::Init(WorldSession* pClient, BigNumber* K)
|
||||
{
|
||||
_session = pClient;
|
||||
// Generate Warden Key
|
||||
@@ -65,7 +65,7 @@ void WardenMac::Init(WorldSession *pClient, BigNumber *K)
|
||||
|
||||
ClientWardenModule* WardenMac::GetModuleForClient()
|
||||
{
|
||||
ClientWardenModule *mod = new ClientWardenModule;
|
||||
ClientWardenModule* mod = new ClientWardenModule;
|
||||
|
||||
uint32 len = sizeof(Module_0DBBF209A27B1E279A9FEC5C168A15F7_Data);
|
||||
|
||||
@@ -110,7 +110,8 @@ void WardenMac::RequestHash()
|
||||
_session->SendPacket(&pkt);
|
||||
}
|
||||
|
||||
struct keyData {
|
||||
struct keyData
|
||||
{
|
||||
union
|
||||
{
|
||||
struct
|
||||
@@ -125,7 +126,7 @@ struct keyData {
|
||||
};
|
||||
};
|
||||
|
||||
void WardenMac::HandleHashResult(ByteBuffer &buff)
|
||||
void WardenMac::HandleHashResult(ByteBuffer& buff)
|
||||
{
|
||||
|
||||
// test
|
||||
@@ -218,7 +219,7 @@ void WardenMac::RequestData()
|
||||
_dataSent = true;
|
||||
}
|
||||
|
||||
void WardenMac::HandleData(ByteBuffer &buff)
|
||||
void WardenMac::HandleData(ByteBuffer& buff)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_WARDEN, "Handle data");
|
||||
|
||||
@@ -18,17 +18,17 @@ class Warden;
|
||||
|
||||
class WardenMac : public Warden
|
||||
{
|
||||
public:
|
||||
WardenMac();
|
||||
~WardenMac();
|
||||
public:
|
||||
WardenMac();
|
||||
~WardenMac();
|
||||
|
||||
void Init(WorldSession* session, BigNumber* k);
|
||||
ClientWardenModule* GetModuleForClient();
|
||||
void InitializeModule();
|
||||
void RequestHash();
|
||||
void HandleHashResult(ByteBuffer& buff);
|
||||
void RequestData();
|
||||
void HandleData(ByteBuffer& buff);
|
||||
void Init(WorldSession* session, BigNumber* k);
|
||||
ClientWardenModule* GetModuleForClient();
|
||||
void InitializeModule();
|
||||
void RequestHash();
|
||||
void HandleHashResult(ByteBuffer& buff);
|
||||
void RequestData();
|
||||
void HandleData(ByteBuffer& buff);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -41,7 +41,7 @@ WardenWin::~WardenWin()
|
||||
sLog->outDebug(LOG_FILTER_POOLSYS, "IM DESTRUCTING MYSELF QQ, OTHERSIZE: %u, OTHEREM: %u, MEMSIZE: %u, MEMEM: %u, CURSIZE: %u, CUREM: %u!\n", otherSize, otherClear, memSize, memClear, curSize, curClear);
|
||||
}
|
||||
|
||||
void WardenWin::Init(WorldSession* session, BigNumber *k)
|
||||
void WardenWin::Init(WorldSession* session, BigNumber* k)
|
||||
{
|
||||
_session = session;
|
||||
// Generate Warden Key
|
||||
@@ -72,7 +72,7 @@ void WardenWin::Init(WorldSession* session, BigNumber *k)
|
||||
|
||||
ClientWardenModule* WardenWin::GetModuleForClient()
|
||||
{
|
||||
ClientWardenModule *mod = new ClientWardenModule;
|
||||
ClientWardenModule* mod = new ClientWardenModule;
|
||||
|
||||
uint32 length = sizeof(Module.Module);
|
||||
|
||||
@@ -156,7 +156,7 @@ void WardenWin::RequestHash()
|
||||
_session->SendPacket(&pkt);
|
||||
}
|
||||
|
||||
void WardenWin::HandleHashResult(ByteBuffer &buff)
|
||||
void WardenWin::HandleHashResult(ByteBuffer& buff)
|
||||
{
|
||||
buff.rpos(buff.wpos());
|
||||
|
||||
@@ -221,7 +221,8 @@ void WardenWin::RequestData()
|
||||
if (id != 786 /*WPE PRO*/ && id != 209 /*WoWEmuHacker*/)
|
||||
_currentChecks.push_back(id);
|
||||
}
|
||||
_currentChecks.push_back(786); _currentChecks.push_back(209);
|
||||
_currentChecks.push_back(786);
|
||||
_currentChecks.push_back(209);
|
||||
|
||||
ByteBuffer buff;
|
||||
buff << uint8(WARDEN_SMSG_CHEAT_CHECKS_REQUEST);
|
||||
@@ -274,42 +275,42 @@ void WardenWin::RequestData()
|
||||
switch (type)
|
||||
{
|
||||
case MEM_CHECK:
|
||||
{
|
||||
buff << uint8(0x00);
|
||||
buff << uint32(wd->Address);
|
||||
buff << uint8(wd->Length);
|
||||
break;
|
||||
}
|
||||
{
|
||||
buff << uint8(0x00);
|
||||
buff << uint32(wd->Address);
|
||||
buff << uint8(wd->Length);
|
||||
break;
|
||||
}
|
||||
case PAGE_CHECK_A:
|
||||
case PAGE_CHECK_B:
|
||||
{
|
||||
buff.append(wd->Data.AsByteArray(0, false).get(), wd->Data.GetNumBytes());
|
||||
buff << uint32(wd->Address);
|
||||
buff << uint8(wd->Length);
|
||||
break;
|
||||
}
|
||||
{
|
||||
buff.append(wd->Data.AsByteArray(0, false).get(), wd->Data.GetNumBytes());
|
||||
buff << uint32(wd->Address);
|
||||
buff << uint8(wd->Length);
|
||||
break;
|
||||
}
|
||||
case MPQ_CHECK:
|
||||
case LUA_STR_CHECK:
|
||||
{
|
||||
buff << uint8(index++);
|
||||
break;
|
||||
}
|
||||
{
|
||||
buff << uint8(index++);
|
||||
break;
|
||||
}
|
||||
case DRIVER_CHECK:
|
||||
{
|
||||
buff.append(wd->Data.AsByteArray(0, false).get(), wd->Data.GetNumBytes());
|
||||
buff << uint8(index++);
|
||||
break;
|
||||
}
|
||||
{
|
||||
buff.append(wd->Data.AsByteArray(0, false).get(), wd->Data.GetNumBytes());
|
||||
buff << uint8(index++);
|
||||
break;
|
||||
}
|
||||
case MODULE_CHECK:
|
||||
{
|
||||
uint32 seed = rand32();
|
||||
buff << uint32(seed);
|
||||
HmacHash hmac(4, (uint8*)&seed);
|
||||
hmac.UpdateData(wd->Str);
|
||||
hmac.Finalize();
|
||||
buff.append(hmac.GetDigest(), hmac.GetLength());
|
||||
break;
|
||||
}
|
||||
{
|
||||
uint32 seed = rand32();
|
||||
buff << uint32(seed);
|
||||
HmacHash hmac(4, (uint8*)&seed);
|
||||
hmac.UpdateData(wd->Str);
|
||||
hmac.Finalize();
|
||||
buff.append(hmac.GetDigest(), hmac.GetLength());
|
||||
break;
|
||||
}
|
||||
/*case PROC_CHECK:
|
||||
{
|
||||
buff.append(wd->i.AsByteArray(0, false).get(), wd->i.GetNumBytes());
|
||||
@@ -345,7 +346,7 @@ void WardenWin::RequestData()
|
||||
#endif
|
||||
}
|
||||
|
||||
void WardenWin::HandleData(ByteBuffer &buff)
|
||||
void WardenWin::HandleData(ByteBuffer& buff)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_WARDEN, "Handle data");
|
||||
@@ -397,8 +398,8 @@ void WardenWin::HandleData(ByteBuffer &buff)
|
||||
#endif
|
||||
}
|
||||
|
||||
WardenCheckResult *rs;
|
||||
WardenCheck *rd;
|
||||
WardenCheckResult* rs;
|
||||
WardenCheck* rd;
|
||||
uint8 type;
|
||||
uint16 checkFailed = 0;
|
||||
|
||||
@@ -413,133 +414,133 @@ void WardenWin::HandleData(ByteBuffer &buff)
|
||||
switch (type)
|
||||
{
|
||||
case MEM_CHECK:
|
||||
{
|
||||
uint8 Mem_Result;
|
||||
buff >> Mem_Result;
|
||||
|
||||
if (Mem_Result != 0)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_WARDEN, "RESULT MEM_CHECK not 0x00, CheckId %u account Id %u", *itr, _session->GetAccountId());
|
||||
#endif
|
||||
checkFailed = *itr;
|
||||
continue;
|
||||
}
|
||||
uint8 Mem_Result;
|
||||
buff >> Mem_Result;
|
||||
|
||||
if (memcmp(buff.contents() + buff.rpos(), rs->Result.AsByteArray(0, false).get(), rd->Length) != 0)
|
||||
{
|
||||
if (Mem_Result != 0)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_WARDEN, "RESULT MEM_CHECK fail CheckId %u account Id %u", *itr, _session->GetAccountId());
|
||||
sLog->outDebug(LOG_FILTER_WARDEN, "RESULT MEM_CHECK not 0x00, CheckId %u account Id %u", *itr, _session->GetAccountId());
|
||||
#endif
|
||||
checkFailed = *itr;
|
||||
checkFailed = *itr;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (memcmp(buff.contents() + buff.rpos(), rs->Result.AsByteArray(0, false).get(), rd->Length) != 0)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_WARDEN, "RESULT MEM_CHECK fail CheckId %u account Id %u", *itr, _session->GetAccountId());
|
||||
#endif
|
||||
checkFailed = *itr;
|
||||
buff.rpos(buff.rpos() + rd->Length);
|
||||
continue;
|
||||
}
|
||||
|
||||
buff.rpos(buff.rpos() + rd->Length);
|
||||
continue;
|
||||
}
|
||||
|
||||
buff.rpos(buff.rpos() + rd->Length);
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_WARDEN, "RESULT MEM_CHECK passed CheckId %u account Id %u", *itr, _session->GetAccountId());
|
||||
sLog->outDebug(LOG_FILTER_WARDEN, "RESULT MEM_CHECK passed CheckId %u account Id %u", *itr, _session->GetAccountId());
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case PAGE_CHECK_A:
|
||||
case PAGE_CHECK_B:
|
||||
case DRIVER_CHECK:
|
||||
case MODULE_CHECK:
|
||||
{
|
||||
const uint8 byte = 0xE9;
|
||||
if (memcmp(buff.contents() + buff.rpos(), &byte, sizeof(uint8)) != 0)
|
||||
{
|
||||
const uint8 byte = 0xE9;
|
||||
if (memcmp(buff.contents() + buff.rpos(), &byte, sizeof(uint8)) != 0)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
if (type == PAGE_CHECK_A || type == PAGE_CHECK_B)
|
||||
sLog->outDebug(LOG_FILTER_WARDEN, "RESULT PAGE_CHECK fail, CheckId %u account Id %u", *itr, _session->GetAccountId());
|
||||
|
||||
if (type == MODULE_CHECK)
|
||||
sLog->outDebug(LOG_FILTER_WARDEN, "RESULT MODULE_CHECK fail, CheckId %u account Id %u", *itr, _session->GetAccountId());
|
||||
|
||||
if (type == DRIVER_CHECK)
|
||||
sLog->outDebug(LOG_FILTER_WARDEN, "RESULT DRIVER_CHECK fail, CheckId %u account Id %u", *itr, _session->GetAccountId());
|
||||
#endif
|
||||
checkFailed = *itr;
|
||||
buff.rpos(buff.rpos() + 1);
|
||||
continue;
|
||||
}
|
||||
|
||||
buff.rpos(buff.rpos() + 1);
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
if (type == PAGE_CHECK_A || type == PAGE_CHECK_B)
|
||||
sLog->outDebug(LOG_FILTER_WARDEN, "RESULT PAGE_CHECK fail, CheckId %u account Id %u", *itr, _session->GetAccountId());
|
||||
|
||||
if (type == MODULE_CHECK)
|
||||
sLog->outDebug(LOG_FILTER_WARDEN, "RESULT MODULE_CHECK fail, CheckId %u account Id %u", *itr, _session->GetAccountId());
|
||||
|
||||
if (type == DRIVER_CHECK)
|
||||
sLog->outDebug(LOG_FILTER_WARDEN, "RESULT DRIVER_CHECK fail, CheckId %u account Id %u", *itr, _session->GetAccountId());
|
||||
sLog->outDebug(LOG_FILTER_WARDEN, "RESULT PAGE_CHECK passed CheckId %u account Id %u", *itr, _session->GetAccountId());
|
||||
else if (type == MODULE_CHECK)
|
||||
sLog->outDebug(LOG_FILTER_WARDEN, "RESULT MODULE_CHECK passed CheckId %u account Id %u", *itr, _session->GetAccountId());
|
||||
else if (type == DRIVER_CHECK)
|
||||
sLog->outDebug(LOG_FILTER_WARDEN, "RESULT DRIVER_CHECK passed CheckId %u account Id %u", *itr, _session->GetAccountId());
|
||||
#endif
|
||||
checkFailed = *itr;
|
||||
buff.rpos(buff.rpos() + 1);
|
||||
continue;
|
||||
break;
|
||||
}
|
||||
|
||||
buff.rpos(buff.rpos() + 1);
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
if (type == PAGE_CHECK_A || type == PAGE_CHECK_B)
|
||||
sLog->outDebug(LOG_FILTER_WARDEN, "RESULT PAGE_CHECK passed CheckId %u account Id %u", *itr, _session->GetAccountId());
|
||||
else if (type == MODULE_CHECK)
|
||||
sLog->outDebug(LOG_FILTER_WARDEN, "RESULT MODULE_CHECK passed CheckId %u account Id %u", *itr, _session->GetAccountId());
|
||||
else if (type == DRIVER_CHECK)
|
||||
sLog->outDebug(LOG_FILTER_WARDEN, "RESULT DRIVER_CHECK passed CheckId %u account Id %u", *itr, _session->GetAccountId());
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
case LUA_STR_CHECK:
|
||||
{
|
||||
uint8 Lua_Result;
|
||||
buff >> Lua_Result;
|
||||
|
||||
if (Lua_Result != 0)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_WARDEN, "RESULT LUA_STR_CHECK fail, CheckId %u account Id %u", *itr, _session->GetAccountId());
|
||||
#endif
|
||||
checkFailed = *itr;
|
||||
continue;
|
||||
}
|
||||
uint8 Lua_Result;
|
||||
buff >> Lua_Result;
|
||||
|
||||
uint8 luaStrLen;
|
||||
buff >> luaStrLen;
|
||||
if (Lua_Result != 0)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_WARDEN, "RESULT LUA_STR_CHECK fail, CheckId %u account Id %u", *itr, _session->GetAccountId());
|
||||
#endif
|
||||
checkFailed = *itr;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (luaStrLen != 0)
|
||||
{
|
||||
char *str = new char[luaStrLen + 1];
|
||||
memcpy(str, buff.contents() + buff.rpos(), luaStrLen);
|
||||
str[luaStrLen] = '\0'; // null terminator
|
||||
uint8 luaStrLen;
|
||||
buff >> luaStrLen;
|
||||
|
||||
if (luaStrLen != 0)
|
||||
{
|
||||
char* str = new char[luaStrLen + 1];
|
||||
memcpy(str, buff.contents() + buff.rpos(), luaStrLen);
|
||||
str[luaStrLen] = '\0'; // null terminator
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_WARDEN, "Lua string: %s", str);
|
||||
sLog->outDebug(LOG_FILTER_WARDEN, "Lua string: %s", str);
|
||||
#endif
|
||||
delete[] str;
|
||||
delete[] str;
|
||||
}
|
||||
buff.rpos(buff.rpos() + luaStrLen); // Skip string
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_WARDEN, "RESULT LUA_STR_CHECK passed, CheckId %u account Id %u", *itr, _session->GetAccountId());
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
buff.rpos(buff.rpos() + luaStrLen); // Skip string
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_WARDEN, "RESULT LUA_STR_CHECK passed, CheckId %u account Id %u", *itr, _session->GetAccountId());
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
case MPQ_CHECK:
|
||||
{
|
||||
uint8 Mpq_Result;
|
||||
buff >> Mpq_Result;
|
||||
|
||||
if (Mpq_Result != 0)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_WARDEN, "RESULT MPQ_CHECK not 0x00 account id %u", _session->GetAccountId());
|
||||
#endif
|
||||
checkFailed = *itr;
|
||||
continue;
|
||||
}
|
||||
uint8 Mpq_Result;
|
||||
buff >> Mpq_Result;
|
||||
|
||||
if (memcmp(buff.contents() + buff.rpos(), rs->Result.AsByteArray(0, false).get(), 20) != 0) // SHA1
|
||||
{
|
||||
if (Mpq_Result != 0)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_WARDEN, "RESULT MPQ_CHECK fail, CheckId %u account Id %u", *itr, _session->GetAccountId());
|
||||
sLog->outDebug(LOG_FILTER_WARDEN, "RESULT MPQ_CHECK not 0x00 account id %u", _session->GetAccountId());
|
||||
#endif
|
||||
checkFailed = *itr;
|
||||
buff.rpos(buff.rpos() + 20); // 20 bytes SHA1
|
||||
continue;
|
||||
}
|
||||
checkFailed = *itr;
|
||||
continue;
|
||||
}
|
||||
|
||||
buff.rpos(buff.rpos() + 20); // 20 bytes SHA1
|
||||
if (memcmp(buff.contents() + buff.rpos(), rs->Result.AsByteArray(0, false).get(), 20) != 0) // SHA1
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_WARDEN, "RESULT MPQ_CHECK passed, CheckId %u account Id %u", *itr, _session->GetAccountId());
|
||||
sLog->outDebug(LOG_FILTER_WARDEN, "RESULT MPQ_CHECK fail, CheckId %u account Id %u", *itr, _session->GetAccountId());
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
checkFailed = *itr;
|
||||
buff.rpos(buff.rpos() + 20); // 20 bytes SHA1
|
||||
continue;
|
||||
}
|
||||
|
||||
buff.rpos(buff.rpos() + 20); // 20 bytes SHA1
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
sLog->outDebug(LOG_FILTER_WARDEN, "RESULT MPQ_CHECK passed, CheckId %u account Id %u", *itr, _session->GetAccountId());
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
default: // Should never happen
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -60,23 +60,23 @@ class Warden;
|
||||
|
||||
class WardenWin : public Warden
|
||||
{
|
||||
public:
|
||||
WardenWin();
|
||||
~WardenWin();
|
||||
public:
|
||||
WardenWin();
|
||||
~WardenWin();
|
||||
|
||||
void Init(WorldSession* session, BigNumber* K);
|
||||
ClientWardenModule* GetModuleForClient();
|
||||
void InitializeModule();
|
||||
void RequestHash();
|
||||
void HandleHashResult(ByteBuffer &buff);
|
||||
void RequestData();
|
||||
void HandleData(ByteBuffer &buff);
|
||||
void Init(WorldSession* session, BigNumber* K);
|
||||
ClientWardenModule* GetModuleForClient();
|
||||
void InitializeModule();
|
||||
void RequestHash();
|
||||
void HandleHashResult(ByteBuffer& buff);
|
||||
void RequestData();
|
||||
void HandleData(ByteBuffer& buff);
|
||||
|
||||
private:
|
||||
uint32 _serverTicks;
|
||||
std::list<uint16> _otherChecksTodo;
|
||||
std::list<uint16> _memChecksTodo;
|
||||
std::list<uint16> _currentChecks;
|
||||
private:
|
||||
uint32 _serverTicks;
|
||||
std::list<uint16> _otherChecksTodo;
|
||||
std::list<uint16> _memChecksTodo;
|
||||
std::list<uint16> _currentChecks;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user