chore(Core/Logging): replace most server loggers (#5726)
* chore(Core/Logging): replace most server loggers Co-authored-by: Kitzunu <24550914+Kitzunu@users.noreply.github.com>
This commit is contained in:
@@ -100,20 +100,16 @@ void WardenWin::Init(WorldSession* session, SessionKey const& k)
|
||||
|
||||
_inputCrypto.Init(_inputKey);
|
||||
_outputCrypto.Init(_outputKey);
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("warden", "Server side warden for client %u initializing...", session->GetAccountId());
|
||||
LOG_DEBUG("warden", "C->S Key: %s", Acore::Impl::ByteArrayToHexStr(_inputKey, 16).c_str());
|
||||
LOG_DEBUG("warden", "S->C Key: %s", Acore::Impl::ByteArrayToHexStr(_outputKey,16).c_str());
|
||||
LOG_DEBUG("warden", " Seed: %s", Acore::Impl::ByteArrayToHexStr(_seed, 16).c_str());
|
||||
LOG_DEBUG("warden", "Loading Module...");
|
||||
#endif
|
||||
|
||||
_module = GetModuleForClient();
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("warden", "Module Key: %s", Acore::Impl::ByteArrayToHexStr(_module->Key, 16).c_str());
|
||||
LOG_DEBUG("warden", "Module ID: %s", Acore::Impl::ByteArrayToHexStr(_module->Id, 16).c_str());
|
||||
#endif
|
||||
RequestModule();
|
||||
}
|
||||
|
||||
@@ -140,9 +136,7 @@ ClientWardenModule* WardenWin::GetModuleForClient()
|
||||
|
||||
void WardenWin::InitializeModule()
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("warden", "Initialize module");
|
||||
#endif
|
||||
|
||||
// Create packet structure
|
||||
WardenInitModuleRequest Request;
|
||||
@@ -199,9 +193,7 @@ void WardenWin::InitializeModule()
|
||||
|
||||
void WardenWin::RequestHash()
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("warden", "Request hash");
|
||||
#endif
|
||||
|
||||
// Create packet structure
|
||||
WardenHashRequest Request;
|
||||
@@ -223,16 +215,12 @@ void WardenWin::HandleHashResult(ByteBuffer& buff)
|
||||
// Verify key
|
||||
if (memcmp(buff.contents() + 1, Module.ClientKeySeedHash, Acore::Crypto::Constants::SHA1_DIGEST_LENGTH_BYTES) != 0)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("warden", "Request hash reply: failed");
|
||||
#endif
|
||||
ApplyPenalty(0, "Request hash reply: failed");
|
||||
return;
|
||||
}
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("warden", "Request hash reply: succeed");
|
||||
#endif
|
||||
|
||||
// Change keys here
|
||||
memcpy(_inputKey, Module.ClientKeySeed, 16);
|
||||
@@ -246,9 +234,7 @@ void WardenWin::HandleHashResult(ByteBuffer& buff)
|
||||
|
||||
void WardenWin::RequestChecks()
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("warden", "Request data");
|
||||
#endif
|
||||
|
||||
// If all checks were done, fill the todo list again
|
||||
for (uint8 i = 0; i < MAX_WARDEN_CHECK_TYPES; ++i)
|
||||
@@ -443,7 +429,6 @@ void WardenWin::RequestChecks()
|
||||
|
||||
_dataSent = true;
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
std::stringstream stream;
|
||||
stream << "Sent check id's: ";
|
||||
for (uint16 checkId : _CurrentChecks)
|
||||
@@ -452,14 +437,11 @@ void WardenWin::RequestChecks()
|
||||
}
|
||||
|
||||
LOG_DEBUG("warden", "%s", stream.str().c_str());
|
||||
#endif
|
||||
}
|
||||
|
||||
void WardenWin::HandleData(ByteBuffer& buff)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("warden", "Handle data");
|
||||
#endif
|
||||
|
||||
_dataSent = false;
|
||||
_clientResponseTimer = 0;
|
||||
@@ -479,9 +461,7 @@ void WardenWin::HandleData(ByteBuffer& buff)
|
||||
if (!IsValidCheckSum(Checksum, buff.contents() + buff.rpos(), Length))
|
||||
{
|
||||
buff.rpos(buff.wpos());
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("warden", "CHECKSUM FAIL");
|
||||
#endif
|
||||
ApplyPenalty(0, "Failed checksum in HandleData");
|
||||
return;
|
||||
}
|
||||
@@ -493,9 +473,7 @@ void WardenWin::HandleData(ByteBuffer& buff)
|
||||
// TODO: test it.
|
||||
if (result == 0x00)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("warden", "TIMING CHECK FAIL result 0x00");
|
||||
#endif
|
||||
ApplyPenalty(0, "TIMING CHECK FAIL result");
|
||||
return;
|
||||
}
|
||||
@@ -503,7 +481,6 @@ void WardenWin::HandleData(ByteBuffer& buff)
|
||||
uint32 newClientTicks;
|
||||
buff >> newClientTicks;
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
uint32 ticksNow = World::GetGameTimeMS();
|
||||
uint32 ourTicks = newClientTicks + (ticksNow - _serverTicks);
|
||||
|
||||
@@ -511,7 +488,6 @@ void WardenWin::HandleData(ByteBuffer& buff)
|
||||
LOG_DEBUG("warden", "RequestTicks %u", _serverTicks); // At request
|
||||
LOG_DEBUG("warden", "Ticks %u", newClientTicks); // At response
|
||||
LOG_DEBUG("warden", "Ticks diff %u", ourTicks - newClientTicks);
|
||||
#endif
|
||||
}
|
||||
|
||||
uint16 checkFailed = 0;
|
||||
@@ -529,9 +505,7 @@ void WardenWin::HandleData(ByteBuffer& buff)
|
||||
|
||||
if (Mem_Result != 0)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("warden", "RESULT MEM_CHECK not 0x00, CheckId %u account Id %u", checkId, _session->GetAccountId());
|
||||
#endif
|
||||
checkFailed = checkId;
|
||||
continue;
|
||||
}
|
||||
@@ -541,18 +515,14 @@ void WardenWin::HandleData(ByteBuffer& buff)
|
||||
std::vector<uint8> result = rs->Result.ToByteVector(0, false);
|
||||
if (memcmp(buff.contents() + buff.rpos(), result.data(), rd->Length) != 0)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("warden", "RESULT MEM_CHECK fail CheckId %u account Id %u", checkId, _session->GetAccountId());
|
||||
#endif
|
||||
checkFailed = checkId;
|
||||
buff.rpos(buff.rpos() + rd->Length);
|
||||
continue;
|
||||
}
|
||||
|
||||
buff.rpos(buff.rpos() + rd->Length);
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("warden", "RESULT MEM_CHECK passed CheckId %u account Id %u", checkId, _session->GetAccountId());
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
case PAGE_CHECK_A:
|
||||
@@ -563,7 +533,6 @@ void WardenWin::HandleData(ByteBuffer& buff)
|
||||
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)
|
||||
LOG_DEBUG("warden", "RESULT PAGE_CHECK fail, CheckId %u account Id %u", checkId, _session->GetAccountId());
|
||||
|
||||
@@ -572,7 +541,6 @@ void WardenWin::HandleData(ByteBuffer& buff)
|
||||
|
||||
if (type == DRIVER_CHECK)
|
||||
LOG_DEBUG("warden", "RESULT DRIVER_CHECK fail, CheckId %u account Id %u", checkId, _session->GetAccountId());
|
||||
#endif
|
||||
checkFailed = checkId;
|
||||
buff.rpos(buff.rpos() + 1);
|
||||
continue;
|
||||
@@ -580,14 +548,12 @@ void WardenWin::HandleData(ByteBuffer& buff)
|
||||
|
||||
buff.rpos(buff.rpos() + 1);
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
if (type == PAGE_CHECK_A || type == PAGE_CHECK_B)
|
||||
LOG_DEBUG("warden", "RESULT PAGE_CHECK passed CheckId %u account Id %u", checkId, _session->GetAccountId());
|
||||
else if (type == MODULE_CHECK)
|
||||
LOG_DEBUG("warden", "RESULT MODULE_CHECK passed CheckId %u account Id %u", checkId, _session->GetAccountId());
|
||||
else if (type == DRIVER_CHECK)
|
||||
LOG_DEBUG("warden", "RESULT DRIVER_CHECK passed CheckId %u account Id %u", checkId, _session->GetAccountId());
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
case LUA_EVAL_CHECK:
|
||||
@@ -598,9 +564,7 @@ void WardenWin::HandleData(ByteBuffer& buff)
|
||||
buff.read_skip(buff.read<uint8>()); // discard attached string
|
||||
}
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("warden", "LUA_EVAL_CHECK CheckId %u account Id %u got in-warden dummy response", checkId, _session->GetAccountId()/* , result */);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
case MPQ_CHECK:
|
||||
@@ -610,9 +574,7 @@ void WardenWin::HandleData(ByteBuffer& buff)
|
||||
|
||||
if (Mpq_Result != 0)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("warden", "RESULT MPQ_CHECK not 0x00 account id %u", _session->GetAccountId());
|
||||
#endif
|
||||
checkFailed = checkId;
|
||||
continue;
|
||||
}
|
||||
@@ -620,18 +582,14 @@ void WardenWin::HandleData(ByteBuffer& buff)
|
||||
WardenCheckResult const* rs = sWardenCheckMgr->GetWardenResultById(checkId);
|
||||
if (memcmp(buff.contents() + buff.rpos(), rs->Result.ToByteArray<20>(false).data(), Acore::Crypto::Constants::SHA1_DIGEST_LENGTH_BYTES) != 0) // SHA1
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("warden", "RESULT MPQ_CHECK fail, CheckId %u account Id %u", checkId, _session->GetAccountId());
|
||||
#endif
|
||||
checkFailed = checkId;
|
||||
buff.rpos(buff.rpos() + Acore::Crypto::Constants::SHA1_DIGEST_LENGTH_BYTES); // 20 bytes SHA1
|
||||
continue;
|
||||
}
|
||||
|
||||
buff.rpos(buff.rpos() + Acore::Crypto::Constants::SHA1_DIGEST_LENGTH_BYTES); // 20 bytes SHA1
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("warden", "RESULT MPQ_CHECK passed, CheckId %u account Id %u", checkId, _session->GetAccountId());
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user