-
Notifications
You must be signed in to change notification settings - Fork 39
/
Copy pathload_carto
executable file
·75 lines (62 loc) · 2.15 KB
/
load_carto
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
#!/bin/bash
prefix="\e[34m\e[1mMcDota >\e[0m"
error_prefix="\e[91m\e[1mMcDota >\e[0m"
success_prefix="\e[32m\e[1mMcDota >\e[0m"
dota_pid=$(pidof dota2)
if [ -z "$dota_pid" ]; then
/bin/echo -e "\\e[31mDota2 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"
# Credit: Aixxe @ aixxe.net
if grep -q "$filename" /proc/"$dota_pid"/maps; then
/bin/echo -e "\\e[33mMcDota is already injected... Aborting...\\e[0m"
exit
fi
if grep -Rq "cartographer" /proc/modules
then
sudo echo "turnoff allsettings" | sudo tee /proc/cartographer
sudo echo "settarget libMcDota.so" | sudo tee /proc/cartographer
sudo echo "removeentry" | sudo tee /proc/cartographer
else
echo -e "$error_prefix Cartographer doesn't seem to be loaded. VAC will see McDota in the m-maps"
while true; do
echo -e -n "$error_prefix "
read -p $'Do you wish to continue? (y/N) ' yn
case $yn in
[Yy]* ) break;;
[Nn]* ) exit -1;;
* ) echo -e "$error_prefix Please answer yes or no.";;
esac
done
fi
echo "Injecting Build ID: $filename"
# https://www.kernel.org/doc/Documentation/security/Yama.txt
sudo echo "2" | sudo tee /proc/sys/kernel/yama/ptrace_scope # Only allows root to ptrace. This is temporary until reboot.
sudo killall -19 steam
sudo killall -19 steamwebhelper
input="$(
sudo gdb -n -q -batch-silent \
-ex "set logging on" \
-ex "set logging file /dev/null" \
-ex "set logging redirect on" \
-ex "attach $dota_pid" \
-ex "set \$dlopen = (void*(*)(char*, int)) dlopen" \
-ex "call \$dlopen(\"$(pwd)/$filename\", 1)" \
-ex "detach" \
-ex "quit"
)"
sleep 1
sudo killall -18 steamwebhelper
sudo killall -18 steam
last_line="${input##*$'\n'}"
if [ "$last_line" != "\$1 = (void *) 0x0" ]; then
/bin/echo -e "\\e[32mSuccessfully injected!\\e[0m"
else
/bin/echo -e "\\e[31mInjection failed, make sure you have compiled...\\e[0m"
fi