forked from thisgamesux/linux-csgo-external
-
Notifications
You must be signed in to change notification settings - Fork 5
/
main.cpp
167 lines (126 loc) · 4.61 KB
/
main.cpp
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
#include <iostream>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include "log.hpp"
#include "remote.hpp"
#include "hack.hpp"
#include "netvar.hpp"
using namespace std;
bool shouldGlow = true;
// This isn't called or used because it's for debugging, use it if you want.
void printAllClasses() {
for (size_t i = 0; i < netvar::GetAllClasses().size(); i++) {
cout << netvar::GetAllClasses()[i].name << endl;
for (size_t p = 0; p < netvar::GetAllClasses()[i].props.size(); p++) {
cout << "\t" << netvar::GetAllClasses()[i].props[p].name << " = " << std::hex <<
netvar::GetAllClasses()[i].props[p].offset << endl;
}
}
}
int main() {
if (getuid() != 0) {
cout << "You should run this as root." << endl;
return 0;
}
cout << "s0beit linux hack version 1.3" << endl;
log::init();
log::put("Hack loaded...");
Display* dpy = XOpenDisplay(0);
Window root = DefaultRootWindow(dpy);
XEvent ev;
int keycode = XKeysymToKeycode(dpy, XK_X);
unsigned int modifiers = ControlMask | ShiftMask;
XGrabKey(dpy, keycode, modifiers, root, false,
GrabModeAsync, GrabModeAsync);
XSelectInput(dpy, root, KeyPressMask);
remote::Handle csgo;
while (true) {
if (remote::FindProcessByName("csgo_linux", &csgo)) {
break;
}
usleep(500);
}
cout << "CSGO Process Located [" << csgo.GetPath() << "][" << csgo.GetPid() << "]" << endl << endl;
remote::MapModuleMemoryRegion client;
client.start = 0;
while (client.start == 0) {
if (!csgo.IsRunning()) {
cout << "Exited game before client could be located, terminating" << endl;
return 0;
}
csgo.ParseMaps();
for (auto region : csgo.regions) {
if (region.filename.compare("client_client.so") == 0 && region.executable) {
cout << "client_client.so: [" << std::hex << region.start << "][" << std::hex << region.end << "][" <<
region.pathname << "]" << endl;
client = region;
break;
}
}
usleep(500);
}
cout << "GlowObject Size: " << std::hex << sizeof(hack::GlowObjectDefinition_t) << endl;
cout << "Found client_client.so [" << std::hex << client.start << "]" << endl;
client.client_start = client.start;
void* foundGlowPointerCall = client.find(csgo,
"\xE8\x00\x00\x00\x00\x8B\x78\x14\x6B\xD6",
"x????xxxxx");
//Old Sig Pre 11/10/15
//\xE8\x00\x00\x00\x00\x8B\x78\x14\x6B\xD6\x34
//x????xxxxxx
//New Sig as of 11/10/15
//\xE8\x00\x00\x00\x00\x8B\x78\x14\x6B\xD6\x38
//x????xxxxxx
//11/10/15 Sig reduction, we don't need the size
//\xE8\x00\x00\x00\x00\x8B\x78\x14\x6B\xD6
//x????xxxxx
cout << "Glow Pointer Call Reference: " << std::hex << foundGlowPointerCall <<
" | Offset: " << (unsigned long) foundGlowPointerCall - client.start << endl;
if (!foundGlowPointerCall) {
cout << "Unable to find glow pointer call reference" << endl;
return 0;
}
unsigned long call = csgo.GetCallAddress(foundGlowPointerCall);
if (!call) {
cout << "Unable to read glow pointer call reference address" << endl;
return 0;
}
cout << "Glow function address: " << std::hex << call << endl;
cout << "Glow function address offset: " << std::hex << call - client.start << endl;
unsigned long addressOfGlowPointer = call;
if (!csgo.Read((void*) (call + 0x11), &addressOfGlowPointer, sizeof(unsigned long))) {
cout << "Unable to read address of glow pointer" << endl;
return 0;
}
cout << "Glow Array: " << std::hex << addressOfGlowPointer << endl << endl;
while (!netvar::Cache(csgo, client)) {
if (!csgo.IsRunning()) {
cout << "Exited game before netvars could be cached, terminating" << endl;
return 0;
}
usleep(5000);
}
cout << "Cached " << std::dec << netvar::GetAllClasses().size() << " networked classes" << endl;
while (csgo.IsRunning()) {
while (XPending(dpy) > 0) {
XNextEvent(dpy, &ev);
switch (ev.type) {
case KeyPress:
cout << "Toggling glow..." << endl;
XUngrabKey(dpy, keycode, modifiers, root);
shouldGlow = !shouldGlow;
break;
default:
break;
}
XGrabKey(dpy, keycode, modifiers, root, false,
GrabModeAsync, GrabModeAsync);
XSelectInput(dpy, root, KeyPressMask);
}
if (shouldGlow)
hack::Glow(&csgo, &client, addressOfGlowPointer);
usleep(1000);
}
// cout << "Game ended." << endl;
return 0;
}