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 "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 WorldIntConfigs 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
44{
45 switch (type)
46 {
47 case DRIVER_CHECK:
48 case MPQ_CHECK: return 1;
49 case LUA_EVAL_CHECK: return 1 + sizeof(_luaEvalPrefix) - 1 + sizeof(_luaEvalMidfix) - 1 + 4 + sizeof(_luaEvalPostfix) - 1;
50 case PAGE_CHECK_A: return (4 + 1);
51 case PAGE_CHECK_B: return (4 + 1);
53 case MEM_CHECK: return (1 + 4 + 1);
54 default: return 0;
55 }
56}
static constexpr char _luaEvalPrefix[]
Definition WardenWin.cpp:37
static constexpr char _luaEvalMidfix[]
Definition WardenWin.cpp:38
static constexpr char _luaEvalPostfix[]
Definition WardenWin.cpp:39
@ 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
59{
60 if (!check)
61 {
62 return 0;
63 }
64
65 uint16 size = 1;
66
67 if (check->CheckId >= WardenPayloadMgr::WardenPayloadOffsetMin && check->Type == LUA_EVAL_CHECK)
68 {
69 // Custom payload has no prefix, midfix, postfix.
70 size = size + (4 + 1);
71 }
72 else
73 {
74 size = size + GetCheckPacketBaseSize(check->Type); // 1 byte check type
75 }
76
77 if (!check->Str.empty())
78 {
79 size += (static_cast<uint16>(check->Str.length()) + 1); // 1 byte string length
80 }
81
82 BigNumber tempNumber = check->Data;
83 if (!tempNumber.GetNumBytes())
84 {
85 size += tempNumber.GetNumBytes();
86 }
87 return size;
88}
std::uint16_t uint16
Definition Define.h:108
static constexpr uint8 GetCheckPacketBaseSize(uint8 type)
Definition WardenWin.cpp:43
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 WorldIntConfigs GetMaxWardenChecksForType ( uint8  type)
static
92{
93 // Should never be higher type than defined
95
96 switch (type)
97 {
102 default:
103 break;
104 }
105
107}
#define ASSERT
Definition Errors.h:68
@ CONFIG_WARDEN_NUM_LUA_CHECKS
Definition IWorld.h:381
@ CONFIG_WARDEN_NUM_MEM_CHECKS
Definition IWorld.h:380
@ CONFIG_WARDEN_NUM_OTHER_CHECKS
Definition IWorld.h:382
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

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