forked from marzika/MonoInjector-Linux
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathload
More file actions
executable file
·31 lines (25 loc) · 749 Bytes
/
load
File metadata and controls
executable file
·31 lines (25 loc) · 749 Bytes
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/sh
rust_pid=$(pidof rust)
if [ -z "$rust_pid" ]; then
/bin/echo -e "\e[31mRust needs to be open before you can inject...\e[0m"
exit 1
fi
#Credit: Aixxe @ aixxe.net
if grep -q libMonoLoader.so /proc/$rust_pid/maps; then
/bin/echo -e "\e[33mMonoLoader is already injected... Aborting...\e[0m"
exit
fi
input="$(
sudo gdb -n -q -batch \
-ex "attach $rust_pid" \
-ex "set \$dlopen = (void*(*)(char*, int)) dlopen" \
-ex "call \$dlopen(\"$(pwd)/libMonoLoader.so\", 1)" \
-ex "detach" \
-ex "quit"
)"
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've compiled...\e[0m"
fi