40static constexpr char _luaEvalPrefix[] =
"local S,T,R=SendAddonMessage,function()";
41static constexpr char _luaEvalMidfix[] =
" end R=S and T()if R then S('_TW',";
50 auto& [checks, checksIt] =
_checks[category];
53 checksIt = checks.begin();
102 Request.Function1[0] = 0x00024F80;
103 Request.Function1[1] = 0x000218C0;
104 Request.Function1[2] = 0x00022530;
105 Request.Function1[3] = 0x00022910;
113 Request.Function2 = 0x00419210;
122 Request.Function3 = 0x0046AE20;
206 if (!check.
Str.empty())
207 size += (check.
Str.length() + 1);
208 if (!check.
Data.empty())
220 auto& [checks, checksIt] =
_checks[category];
221 if ((checksIt == checks.end()) && !checks.empty())
225 checksIt = checks.begin();
241 auto& [checks, checksIt] =
_checks[category];
244 if (checksIt == checks.end())
254 [&expectedSize](
uint16 id)
257 if ((expectedSize + thisSize) > 450)
259 expectedSize += thisSize;
276 else if (!check.
Str.empty())
296 buff <<
uint8(type ^ xorByte);
317 buff <<
uint8(index++);
323 buff <<
uint8(index++);
328 std::array<uint8, 4> seed = Trinity::Crypto::GetRandomBytes<4>();
346 buff <<
uint8(xorByte);
349 auto idstring = [
this]() -> std::string
351 std::stringstream stream;
357 if (buff.
size() == expectedSize)
359 TC_LOG_DEBUG(
"warden",
"Finished building warden packet, size is {} bytes", buff.
size());
364 TC_LOG_WARN(
"warden",
"Finished building warden packet, size is {} bytes, but expected {} bytes!", buff.
size(), expectedSize);
365 TC_LOG_WARN(
"warden",
"Sent checks: {}", idstring());
390 if (Length != (buff.
size() - buff.
rpos()))
419 buff >> newClientTicks;
424 TC_LOG_DEBUG(
"warden",
"Server tick count now: {}", ticksNow);
426 TC_LOG_DEBUG(
"warden",
"Client ticks in response: {}", newClientTicks);
427 TC_LOG_DEBUG(
"warden",
"Round trip response time: {} ms", ourTicks - newClientTicks);
451 std::vector<uint8> response;
452 response.resize(expected.size());
453 buff.
read(response.data(), response.size());
455 if (response != expected)
503 std::vector<uint8> result;
505 buff.
read(result.data(), result.size());
537 swapPositions[category] =
_checks[category].first.begin();
540 for (
uint16 check : checks)
544 std::vector<uint16>& checks =
_checks[category].first;
545 std::vector<uint16>::iterator& swapPos = swapPositions[category];
546 if (
auto it = std::find(swapPos, checks.end(), check); it != checks.end())
548 std::iter_swap(swapPos, it);
std::array< uint8, SESSION_KEY_LENGTH > SessionKey
void EndianConvert(T &val)
#define TC_LOG_WARN(filterType__,...)
#define TC_LOG_DEBUG(filterType__,...)
std::string ByteArrayToHexStr(Container const &c, bool reverse=false)
constexpr uint8 WARDEN_MAX_LUA_CHECK_LENGTH
constexpr bool IsWardenCategoryInWorldOnly(WardenCheckCategory category)
constexpr WorldIntConfigs GetWardenCategoryCountConfig(WardenCheckCategory category)
std::vector< uint8 > WardenCheckResult
struct Module_79C0768D657977D697E10BAD956CCED1 Module
static constexpr char _luaEvalPrefix[]
static constexpr char _luaEvalMidfix[]
static constexpr uint8 GetCheckPacketBaseSize(WardenCheckType type)
static constexpr char _luaEvalPostfix[]
static uint16 GetCheckPacketSize(WardenCheck const &check)
@ WARDEN_SMSG_HASH_REQUEST
@ WARDEN_SMSG_MODULE_INITIALIZE
@ WARDEN_SMSG_CHEAT_CHECKS_REQUEST
static char const * ToConstant(Enum value)
void Generate(uint8 *buf, uint32 sz)
void Init(uint8 const *seed, size_t len)
static Digest GetDigestOf(Container const &seed, uint8 const *data, size_t len)
static constexpr size_t DIGEST_LENGTH
std::array< uint8, DIGEST_LENGTH > Digest
static constexpr size_t DIGEST_LENGTH
void HandleHashResult(ByteBuffer &buff) override
void InitializeModule() override
void Init(WorldSession *session, SessionKey const &K) override
std::vector< uint16 > _currentChecks
size_t DEBUG_ForceSpecificChecks(std::vector< uint16 > const &checks) override
void HandleCheckResult(ByteBuffer &buff) override
void InitializeModuleForClient(ClientWardenModule &module) override
void RequestChecks() override
void RequestHash() override
std::array< std::pair< std::vector< uint16 >, std::vector< uint16 >::const_iterator >, NUM_CHECK_CATEGORIES > _checks
char const * ApplyPenalty(WardenCheck const *check)
Optional< ClientWardenModule > _module
void EncryptData(uint8 *buffer, uint32 length)
uint32 _clientResponseTimer
void MakeModuleForClient()
Trinity::Crypto::ARC4 _outputCrypto
std::array< uint8, 16 > _inputKey
Trinity::Crypto::ARC4 _inputCrypto
static bool IsValidCheckSum(uint32 checksum, const uint8 *data, const uint16 length)
static uint32 BuildChecksum(const uint8 *data, uint32 length)
std::array< uint8, 16 > _seed
std::array< uint8, 16 > _outputKey
Player session in the World.
std::string GetPlayerInfo() const
Player * GetPlayer() const
bool PlayerLoading() const
void SendPacket(WorldPacket const *packet, bool forced=false)
Send a packet to the client.
uint32 GetAccountId() const
std::string const & GetPlayerName() const
@ CONFIG_WARDEN_CLIENT_CHECK_HOLDOFF
void RandomShuffle(Iterator begin, Iterator end)
Reorder the elements of the iterator range randomly.
void EraseIf(Container &c, Predicate p)
boost::beast::http::request< RequestBody > Request
constexpr std::size_t size()
uint8 const * CompressedData
std::array< uint8, 16 > Key
std::array< uint8, 16 > ClientKeySeed
std::array< uint8, 16 > Seed
Trinity::Crypto::SHA1::Digest ClientKeySeedHash
std::array< uint8, 16 > ServerKeySeed
std::array< uint8, 16 > ModuleKey
std::array< uint8, 18756 > Module
std::array< char, 4 > IdStr
std::vector< uint8 > Data