34 _dataSent(false), _initialized(false)
63 burstSize = sizeLeft < 500 ? sizeLeft : 500;
66 memcpy(packet.
Data,
_module->CompressedData + pos, burstSize);
67 sizeLeft -= burstSize;
74 pkt1.
append(
reinterpret_cast<uint8*
>(&packet), burstSize + 3);
110 if (maxClientResponseDelay > 0)
115 TC_LOG_WARN(
"warden",
"{} (latency: {}, IP: {}) exceeded Warden module response delay ({}) - disconnecting client",
146 if (checksum != newChecksum)
169 for (
uint8 i = 0; i < 5; ++i)
170 checkSum = checkSum ^ hash.
ints[i];
191 std::string accountName;
193 std::string banReason =
"Warden Anticheat Violation";
229 TC_LOG_DEBUG(
"warden",
"NYI WARDEN_CMSG_MEM_CHECKS_RESULT received!");
236 TC_LOG_DEBUG(
"warden",
"NYI WARDEN_CMSG_MODULE_FAILED received!");
239 TC_LOG_WARN(
"warden",
"Got unknown warden opcode {:02X} of size {}.", opcode,
uint32(buff.
size() - 1));
246 static constexpr char WARDEN_TOKEN[] =
"_TW\t";
251 std::from_chars(msg.data() +
sizeof(WARDEN_TOKEN) - 1, msg.data() + msg.size(),
id, 10);
252 if (id < sWardenCheckMgr->GetMaxValidCheckId())
void EndianConvert(T &val)
#define TC_LOG_WARN(filterType__,...)
#define TC_LOG_DEBUG(filterType__,...)
std::string secsToTimeString(uint64 timeInSecs, TimeFormat timeFormat, bool hoursOnly)
bool StringStartsWith(std::string_view haystack, std::string_view needle)
@ WARDEN_CMSG_MODULE_MISSING
@ WARDEN_CMSG_HASH_RESULT
@ WARDEN_CMSG_MODULE_FAILED
@ WARDEN_CMSG_CHEAT_CHECKS_RESULT
@ WARDEN_SMSG_MODULE_CACHE
@ WARDEN_CMSG_MEM_CHECKS_RESULT
static bool GetName(uint32 accountId, std::string &name)
static char const * ToConstant(Enum value)
static char const * ToTitle(Enum value)
void UpdateData(uint8 *data, size_t len)
static Digest GetDigestOf(uint8 const *data, size_t len)
char const * ApplyPenalty(WardenCheck const *check)
virtual void InitializeModuleForClient(ClientWardenModule &module)=0
Optional< ClientWardenModule > _module
void EncryptData(uint8 *buffer, uint32 length)
void DecryptData(uint8 *buffer, uint32 length)
uint32 _clientResponseTimer
void MakeModuleForClient()
bool ProcessLuaCheckResponse(std::string const &msg)
virtual void RequestHash()=0
Trinity::Crypto::ARC4 _outputCrypto
Trinity::Crypto::ARC4 _inputCrypto
void HandleData(ByteBuffer &buff)
static bool IsValidCheckSum(uint32 checksum, const uint8 *data, const uint16 length)
void SendModuleToClient()
virtual void InitializeModule()=0
virtual void HandleCheckResult(ByteBuffer &buff)=0
static uint32 BuildChecksum(const uint8 *data, uint32 length)
virtual void RequestChecks()=0
virtual void HandleHashResult(ByteBuffer &buff)=0
void HandleWardenData(WorldPackets::Warden::WardenData &packet)
std::string GetPlayerInfo() const
void KickPlayer(std::string const &reason)
Kick a player out of the World.
std::string const & GetRemoteAddress() const
void SendPacket(WorldPacket const *packet, bool forced=false)
Send a packet to the client.
uint32 GetAccountId() const
uint32 GetLatency() const
std::unique_ptr< Warden > _warden
@ CONFIG_WARDEN_CLIENT_BAN_DURATION
@ CONFIG_WARDEN_CLIENT_RESPONSE_DELAY
@ CONFIG_WARDEN_CLIENT_FAIL_ACTION
std::string StringFormat(FormatString< Args... > fmt, Args &&... args)
Default TC string format function.
std::array< uint8, 16 > ModuleKey
std::array< uint8, 16 > ModuleId
std::array< uint32, 5 > ints
std::array< uint8, 20 > bytes