-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathhack.cpp
More file actions
181 lines (141 loc) · 4.63 KB
/
Copy pathhack.cpp
File metadata and controls
181 lines (141 loc) · 4.63 KB
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
#include "hack.h"
bool Hack::init()
{
//*/// root
if (getuid() != 0)
{
endit("Cannot start as NON ROOT user.");
}
//*/// pid
while (true)
{
if (remote::FindProcessByName(PROCESSNAME, &handle)) break;
usleep(1000);
}
printab("Discovered with PID: ",handle.GetPid());
//*/// memory regions
client.start = 0;
engine.start = 0;
while (client.start == 0 || engine.start == 0)
{
if (!handle.IsRunning()) endit("Cannot find client_client.so and engine_client.so! (csgo stoped)");
handle.ParseMaps();
for (auto region : handle.regions)
{
if (region.filename.compare("client_panorama_client.so") == 0 && region.executable)
//if (region.filename.compare("client_client.so") == 0 && region.executable)
{
client = region;
}
if (region.filename.compare("engine_client.so") == 0 && region.executable)
{
engine = region;
}
}
usleep(1);
printa("region");
}
printhex("client.start: ",client.start);
printhex("engine.start: ",engine.start);
//*/// patterns
// m_addressOfGlowPointer
unsigned long foundGlowPointerCall = (long)client.find(handle,patternGlowPointerCall);
unsigned long call = handle.GetCallAddress( (void*)(foundGlowPointerCall+glowGlowPointerCall1) );
m_addressOfGlowPointer = handle.GetCallAddress( (void *)(call + glowGlowPointerCall2) );
printhex("m_addressOfGlowPointer: ",m_addressOfGlowPointer);
// m_addressOfLocalPlayer
unsigned long foundLocalPlayerLea = (long)client.find(handle,patternLocalPlayerLea);
m_addressOfLocalPlayer = handle.GetCallAddress( (void *)(foundLocalPlayerLea + offsetLocalPlayer) );
printhex("m_addressOfLocalPlayer: ",m_addressOfLocalPlayer);
// m_addressIsConnected
unsigned long foundIsConnectedMov = (long)engine.find(handle,patternIsConnectedMov);
m_addressIsConnected = handle.GetCallAddress( (void *)(foundIsConnectedMov + offsetIsConnectedMov) ) + 0x1;
printhex("m_addressIsConnected: ",m_addressIsConnected);
/*/// debug
remote::MapModuleMemoryRegion *region = NULL;
handle.ParseMaps();
region = handle.GetRegionOfAddress((void*)m_addressIsConnected);
region->print(handle,(void*)m_addressIsConnected);
//*/// ok
return true;
}
bool Hack::isOK()
{
return handle.IsRunning();
}
void Hack::chConnected()
{
uint8_t b = 0;
handle.Read((void *)m_addressIsConnected, &b, sizeof(b));
isConnected = (b == 1);
}
bool Hack::players()
{
struct GlowObjectDefinition_t g_glow[1024];
std::array<EntityInfo, 64> entitiesLocal;
//reset
bzero(g_glow, sizeof(g_glow));
for (int i = 0; i < 64; ++i)
{
entitiesLocal[i]=EntityInfo();
}
//local player
unsigned long localPlayer = 0;
handle.Read((void*) m_addressOfLocalPlayer, &localPlayer, sizeof(localPlayer));
Entity local;
if (localPlayer != 0)
{
handle.Read((void *)(unsigned long)localPlayer, &local, sizeof(local));
}
//CGlowObjectManager
CGlowObjectManager manager;
if (!handle.Read((void*) m_addressOfGlowPointer, &manager, sizeof(manager)))
{
endit("Failed to read glowClassAddress");
}
//g_glow
size_t count = manager.m_GlowObjectDefinitions.Count;
void *data_ptr = (void *) manager.m_GlowObjectDefinitions.DataPtr;
if (!handle.Read(data_ptr, g_glow, sizeof(GlowObjectDefinition_t) * count))
{
endit("Failed to read m_GlowObjectDefinitions");
}
//read
for (unsigned int i = 0; i < count; i++)
{
if (g_glow[i].m_pEntity != NULL)
{
Entity ent;
if (handle.Read(g_glow[i].m_pEntity, &ent, sizeof(ent)))
{
if ((ent.m_iTeamNum == 2 || ent.m_iTeamNum == 3) && (ent.ID <= 64 && ent.ID > 0))
{
EntityInfo e;
e.entity = ent;
e.entityPtr = g_glow[i].m_pEntity;
e.isLocalPlayer = false;
entitiesLocal[ent.ID] = e;
}
}
}
}
//whoami
{
EntityInfo e;
e.entity = local;
e.entityPtr = (void *)(unsigned long)localPlayer;
e.isLocalPlayer = true;
entitiesLocal[local.ID] = e;
}
writeEntities(entitiesLocal);
return true;
}
//Maybe some lock mechanism??
void Hack::readEntities(std::array<EntityInfo, 64> &rentities)
{
rentities = entities;
}
void Hack::writeEntities(std::array<EntityInfo, 64> &wentities)
{
entities = wentities;
}