forked from LWSS/Fuzion
-
Notifications
You must be signed in to change notification settings - Fork 0
/
debug
executable file
·42 lines (34 loc) · 1.48 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
34
35
36
37
38
39
40
41
42
#!/usr/bin/env 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)"".
function echo_red {
echo -e "\\e[31m$*\\e[0m"
}
csgo_pid=$(pidof csgo_linux64)
if [ -z "$csgo_pid" ]; then
echo_red "CS:GO needs to be open before you can inject..."
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 --mode=000 /tmp/dumps # Make it as root with no permissions
if [ ! -f build_id ]; then
echo "Build ID not found. Please rebuild using the './build' script."
exit
fi
filename=$(cat build_id)
# https://www.kernel.org/doc/Documentation/security/Yama.txt
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
(echo -e "continue\\n"; cat) | sudo gdb -p "$csgo_pid"
else
echo "Injecting build $filename"
sudo cp "$filename" /"$filename"
(echo -e "set confirm off\\nset \$dlopen = (void*(*)(char*, int)) dlopen\\ncall \$dlopen(\"/$filename\", 1)\\n"; cat) | sudo gdb -p "$csgo_pid"
sudo rm /"$filename"
fi