forked from LWSS/Skeletux
-
Notifications
You must be signed in to change notification settings - Fork 1
/
debug
executable file
·33 lines (27 loc) · 1.23 KB
/
debug
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
#!/bin/bash
# Starts a GDB session on CS:GO, injects cheat if it is not already present.
# Send SIGINT to CS:GO with: "kill -2 "$(pidof csgo_linux64)"".
csgo_pid=$(pidof gmod)
if [ -z "$csgo_pid" ]; then
/bin/echo -e "\\e[31mCS:GO needs to be open before you can inject...\\e[0m"
exit 1
fi
# pBypass for crash dumps being sent
# You may also want to consider using -nobreakpad in your launch options.
sudo rm -rf /tmp/dumps # Remove if it exists
sudo mkdir /tmp/dumps # Make it as root
sudo chmod 000 /tmp/dumps # No permissions
filename="libskeletux.so"
# https://www.kernel.org/doc/Documentation/security/Yama.txt
sudo echo "2" | sudo tee /proc/sys/kernel/yama/ptrace_scope # Only allows root to inject code. This is temporary until reboot.
# Adjust the Sleep time below for your system if needed.
# This sends 2 interrupts to CS:GO after gdb attachs so gdb will drop into a shell.
sleep 3 && kill -2 "$csgo_pid" && sleep 1 && kill -2 "$csgo_pid" &
# dlopen method Credits: Aixxe @ aixxe.net
if grep -q "$filename" /proc/"$csgo_pid"/maps; then
(sudo echo -e "continue\\n"; cat) | sudo gdb -p "$csgo_pid"
else
echo "Injecting build $filename"
# TODO: make this at least kinda proper
sudo gdb -x "inject.txt" -p "$csgo_pid"
fi