Compare commits
3 commits
45c84c281a
...
77c9afecb1
Author | SHA1 | Date | |
---|---|---|---|
ptrcnull | 77c9afecb1 | ||
ptrcnull | accab5dd87 | ||
ptrcnull | 9c8920067f |
19
infect.sh
19
infect.sh
|
@ -73,9 +73,15 @@ echo "tty1::wait:/sbin/getty -n -l /third_stage.sh 38400 tty1" > /etc/inittab
|
|||
|
||||
# here be dragons
|
||||
|
||||
init_file=/old_root/sbin/init
|
||||
init_link=$(readlink $init_file)
|
||||
if [[ "$init_link" != "" ]]; then
|
||||
init_file=/old_root$init_link
|
||||
fi
|
||||
|
||||
echo -e "set follow-fork-mode child
|
||||
set solib-absolute-prefix /old_root
|
||||
file /old_root$(cat /proc/1/cmdline)
|
||||
file $init_file
|
||||
attach 1
|
||||
call (int)execl(\"/sbin/init\", \"/sbin/init\", 0)
|
||||
" | gdb
|
||||
|
@ -85,13 +91,20 @@ echo '#!/bin/ash
|
|||
rm third_stage.sh
|
||||
|
||||
# kill all remaining processes
|
||||
lsof | grep old_root | awk "{print \$1}" | uniq | xargs kill -9 2>/dev/null
|
||||
cd /proc
|
||||
ps ax | awk "{print \$1}" | tail -n +3 | while read pid; do
|
||||
if grep -qE "^/dev/\w+ / " /proc/$pid/mounts; then
|
||||
kill -9 $pid
|
||||
fi
|
||||
done
|
||||
cd /
|
||||
|
||||
/bin/umount -Rl old_root/* 2>/dev/null
|
||||
/bin/umount old_root
|
||||
|
||||
# get nameservers
|
||||
udhcpc
|
||||
setup-interfaces -a
|
||||
ifquery --list | xargs ifup
|
||||
|
||||
# restore inittab
|
||||
mv /etc/inittab.bak /etc/inittab
|
||||
|
|
Loading…
Reference in a new issue