-
Notifications
You must be signed in to change notification settings - Fork 41
/
debug
executable file
·31 lines (26 loc) · 1.09 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
#!/bin/bash
# Starts a GDB session on Dota, injects cheat if it is not already present.
# Send SIGINT to Dota with: "kill -2 "$(pidof dota2)"".
dota_pid=$(pidof dota2)
if [ -z "$dota_pid" ]; then
/bin/echo -e "\\e[31mDota 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="libMcDota.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.
# dlopen method Credits: Aixxe @ aixxe.net
if grep -q "$filename" /proc/"$dota_pid"/maps; then
sudo gdb -p "$dota_pid" -x ./gdb_debug_attach.txt
else
path="$(pwd)/$filename"
#put library name on first line
sed -i "1cset \$library = \"$path\"" ./gdb_debug_inject.txt
echo "Injecting build $path"
sudo gdb -p "$dota_pid" -x ./gdb_debug_inject.txt
fi