AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
WardenWin.cpp File Reference
#include "WardenWin.h"
#include "ByteBuffer.h"
#include "Common.h"
#include "CryptoRandom.h"
#include "GameTime.h"
#include "HMAC.h"
#include "Log.h"
#include "Opcodes.h"
#include "Player.h"
#include "ScriptMgr.h"
#include "SessionKeyGenerator.h"
#include "Util.h"
#include "WardenCheckMgr.h"
#include "WardenModuleWin.h"
#include "World.h"
#include "WorldPacket.h"
#include "WorldSession.h"
#include <openssl/crypto.h>

Go to the source code of this file.

Functions

static constexpr uint8 GetCheckPacketBaseSize (uint8 type)
 
static uint16 GetCheckPacketSize (WardenCheck const *check)
 
static ServerConfigs GetMaxWardenChecksForType (uint8 type)
 

Variables

static constexpr char _luaEvalPrefix [] = "local S,T,R=SendAddonMessage,function()"
 
static constexpr char _luaEvalMidfix [] = " end R=S and T()if R then S('_TW',"
 
static constexpr char _luaEvalPostfix [] = ",'GUILD')end"
 

Function Documentation

◆ GetCheckPacketBaseSize()

static constexpr uint8 GetCheckPacketBaseSize ( uint8  type)
staticconstexpr
45{
46 switch (type)
47 {
48 case DRIVER_CHECK:
49 case MPQ_CHECK: return 1;
50 case LUA_EVAL_CHECK: return 1 + sizeof(_luaEvalPrefix) - 1 + sizeof(_luaEvalMidfix) - 1 + 4 + sizeof(_luaEvalPostfix) - 1;
51 case PAGE_CHECK_A: return (4 + 1);
52 case PAGE_CHECK_B: return (4 + 1);
54 case MEM_CHECK: return (1 + 4 + 1);
55 default: return 0;
56 }
57}
static constexpr char _luaEvalPrefix[]
Definition WardenWin.cpp:38
static constexpr char _luaEvalMidfix[]
Definition WardenWin.cpp:39
static constexpr char _luaEvalPostfix[]
Definition WardenWin.cpp:40
@ DRIVER_CHECK
Definition Warden.h:53
@ PAGE_CHECK_A
Definition Warden.h:49
@ PAGE_CHECK_B
Definition Warden.h:50
@ LUA_EVAL_CHECK
Definition Warden.h:52
@ MPQ_CHECK
Definition Warden.h:51
@ MEM_CHECK
Definition Warden.h:48
@ MODULE_CHECK
Definition Warden.h:56
static constexpr std::size_t SHA1_DIGEST_LENGTH_BYTES
Definition CryptoConstants.h:26

References _luaEvalMidfix, _luaEvalPostfix, _luaEvalPrefix, DRIVER_CHECK, LUA_EVAL_CHECK, MEM_CHECK, MODULE_CHECK, MPQ_CHECK, PAGE_CHECK_A, PAGE_CHECK_B, and Acore::Crypto::Constants::SHA1_DIGEST_LENGTH_BYTES.

Referenced by GetCheckPacketSize().

◆ GetCheckPacketSize()

static uint16 GetCheckPacketSize ( WardenCheck const *  check)
static
60{
61 if (!check)
62 {
63 return 0;
64 }
65
66 uint16 size = 1;
67
68 if (check->CheckId >= WardenPayloadMgr::WardenPayloadOffsetMin && check->Type == LUA_EVAL_CHECK)
69 {
70 // Custom payload has no prefix, midfix, postfix.
71 size = size + (4 + 1);
72 }
73 else
74 {
75 size = size + GetCheckPacketBaseSize(check->Type); // 1 byte check type
76 }
77
78 if (!check->Str.empty())
79 {
80 size += (static_cast<uint16>(check->Str.length()) + 1); // 1 byte string length
81 }
82
83 BigNumber tempNumber = check->Data;
84 if (!tempNumber.GetNumBytes())
85 {
86 size += tempNumber.GetNumBytes();
87 }
88 return size;
89}
std::uint16_t uint16
Definition Define.h:108
static constexpr uint8 GetCheckPacketBaseSize(uint8 type)
Definition WardenWin.cpp:44
Definition BigNumber.h:29
int32 GetNumBytes() const
Definition BigNumber.cpp:165
static uint16 constexpr WardenPayloadOffsetMin
The minimum id available for custom payloads.
Definition WardenPayloadMgr.h:115

References WardenCheck::CheckId, WardenCheck::Data, GetCheckPacketBaseSize(), BigNumber::GetNumBytes(), LUA_EVAL_CHECK, WardenCheck::Str, WardenCheck::Type, and WardenPayloadMgr::WardenPayloadOffsetMin.

Referenced by WardenWin::RequestChecks().

◆ GetMaxWardenChecksForType()

static ServerConfigs GetMaxWardenChecksForType ( uint8  type)
static
93{
94 // Should never be higher type than defined
96
97 switch (type)
98 {
103 default:
104 break;
105 }
106
108}
#define ASSERT
Definition Errors.h:68
constexpr uint8 MAX_WARDEN_CHECK_TYPES
Definition WardenCheckMgr.h:41
@ WARDEN_CHECK_MEM_TYPE
Definition WardenCheckMgr.h:36
@ WARDEN_CHECK_LUA_TYPE
Definition WardenCheckMgr.h:37
@ CONFIG_WARDEN_NUM_LUA_CHECKS
Definition WorldConfig.h:351
@ CONFIG_WARDEN_NUM_MEM_CHECKS
Definition WorldConfig.h:350
@ CONFIG_WARDEN_NUM_OTHER_CHECKS
Definition WorldConfig.h:352

References ASSERT, CONFIG_WARDEN_NUM_LUA_CHECKS, CONFIG_WARDEN_NUM_MEM_CHECKS, CONFIG_WARDEN_NUM_OTHER_CHECKS, MAX_WARDEN_CHECK_TYPES, WARDEN_CHECK_LUA_TYPE, and WARDEN_CHECK_MEM_TYPE.

Referenced by WardenWin::RequestChecks().

Variable Documentation

◆ _luaEvalMidfix

constexpr char _luaEvalMidfix[] = " end R=S and T()if R then S('_TW',"
staticconstexpr

◆ _luaEvalPostfix

constexpr char _luaEvalPostfix[] = ",'GUILD')end"
staticconstexpr

◆ _luaEvalPrefix

constexpr char _luaEvalPrefix[] = "local S,T,R=SendAddonMessage,function()"
staticconstexpr