-
Notifications
You must be signed in to change notification settings - Fork 15
/
AntiCheat.hpp
75 lines (65 loc) · 2.07 KB
/
AntiCheat.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
//By AlSch092 @github
#pragma once
#if _WIN32 || _WIN64
#if _WIN64
#define ENVIRONMENT64
#else
#define ENVIRONMENT32
#endif
#endif
#include "Network/NetClient.hpp"
#include "Detections.hpp"
#include "Preventions.hpp"
#include "Logger.hpp"
/*
The `AntiCheat` class is a container for the necessary classes of our program, including the monitor, barrier, netclient, and anti-debugger
*/
class AntiCheat
{
public:
AntiCheat()
{
_AntiDebugger = new Debugger::AntiDebug();
Monitor = new Detections(false);
Barrier = new Preventions(true);
Client = new NetClient();
}
~AntiCheat()
{
delete Monitor;
delete Barrier;
delete _AntiDebugger;
delete Client;
}
Debugger::AntiDebug* GetAntiDebugger() { return this->_AntiDebugger; }
NetClient* GetNetworkClient() { return this->Client; }
Preventions* GetBarrier() { return this->Barrier; }
Detections* GetMonitor() { return this->Monitor; }
/*
IsAnyThreadSuspended - Checks the looping threads of class members to ensure the program is running as normal. An attacker may try to suspend threads to either remap or disable functionalities
*/
__forceinline bool IsAnyThreadSuspended()
{
if (Thread::IsThreadSuspended(Monitor->GetMonitorThread()->handle))
{
Logger::logf("UltimateAnticheat.log", Detection, "Monitor was found suspended! Abnormal program execution.");
return true;
}
else if (Thread::IsThreadSuspended(_AntiDebugger->GetDetectionThreadHandle()))
{
Logger::logf("UltimateAnticheat.log", Detection, "Anti-debugger was found suspended! Abnormal program execution.");
return true;
}
else if (Thread::IsThreadSuspended(Client->GetRecvThread()->handle))
{
Logger::logf("UltimateAnticheat.log", Detection, "Netclient comms thread was found suspended! Abnormal program execution.");
return true;
}
return false;
}
private:
Detections* Monitor = NULL; //cheat detections
Preventions* Barrier = NULL; //cheat preventions
Debugger::AntiDebug* _AntiDebugger = NULL;
NetClient* Client = NULL; //for client-server comms
};