s243a

chroot_extracted (attack pup)

Feb 22nd, 2021 (edited)
1,380
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 3.13 KB | None | 0 0
  1. #!/bin/bash
  2. CHROOT_FOLDER="$(realpath ./AttackPup2Headed.sfs.extracted/kali)"
  3. function umountall(){
  4.   set -x
  5.   umount -l "$CHROOT_FOLDER"/dev/shm
  6.   umount -l "$CHROOT_FOLDER"/dev/pts
  7.   umount -l "$CHROOT_FOLDER"/dev
  8.   umount -l "$CHROOT_FOLDER"/proc
  9.   umount -l "$CHROOT_FOLDER"/sys
  10.   killall Xephyr   
  11. }
  12. trap 'umountall' 1
  13. mkdir -p "$CHROOT_FOLDER"/sys
  14. mount --bind /dev "$CHROOT_FOLDER"/dev
  15. mount --bind /proc "$CHROOT_FOLDER"/proc
  16. mount --bind /sys "$CHROOT_FOLDER"/sys
  17. mkdir -p "$CHROOT_FOLDER"/dev/shm
  18. mount --bind "$CHROOT_FOLDER"/dev/shm
  19. mount -t devpts devpts "$CHROOT_FOLDER"/dev/pts
  20. XP="-fullscreen -title container -name Xephyr2 -dpi 144 -nolisten tcp"
  21. #if [ $T -ne 2 ];then
  22.         Xephyr :2 ${XP} &
  23. #else
  24. #       exit # Xephyr2 already running
  25. #fi
  26. cat << "EOF" >"$CHROOT_FOLDER"/strip_jwm.sh
  27. #!bin/sh
  28. cat /root/.jwmrc | sed -nr '$! {H};$ {H;x;s#(<StartupCommand>)(.*)(</StartupCommand>)##g;p}' > /root/.jwmrc-new
  29. mv /root/.jwmrc-new /root/.jwmrc
  30.  
  31. cat /root/.jwmrc-tray | sed -nr '/.*xload*./! {p}' > /root/.jwmrc-tray-new
  32. mv /root/.jwmrc-tray-new /root/.jwmrc-tray
  33. EOF
  34. chmod +x "$CHROOT_FOLDER"/strip_jwm.sh
  35.  
  36. echo '
  37. #!/bin/sh
  38. source /etc/profile
  39. ldconfig
  40. #gdk-pixbuf-query-loaders --update-cache
  41. /usr/bin/gtk-update-icon-cache -f /usr/share/icons/hicolor/
  42. DEFAULT_DESK_ICONS="JQ8flat"
  43. #[ $NEWPVERSION -ge 500 ] && DEFAULT_DESK_ICONS="JQ8flat"
  44. [ ! -d /usr/local/lib/X11/themes/JQ8flat ] && DEFAULT_DESK_ICONS="Stardust"
  45. [ -f /etc/desktop_icon_theme ] && DEFAULT_DESK_ICONS="`cat /etc/desktop_icon_theme`" #w477
  46. /usr/sbin/icon_switcher_cli $DEFAULT_DESK_ICONS
  47. fixmenus #probably not necessary
  48. DISPLAY=:2 rox -n &
  49. /strip_jwm.sh
  50. DISPLAY=:2 jwm &
  51. PID=$!
  52. #/opt/Ungoogled_Chromium-portable/chromium/chromium-pup-nosb" &
  53. wait "$PID"
  54. #DISPLAY=:2 jwm &
  55. #DISPLAY=:2 roxfiler -n &
  56. #DISPLAY=:2 xterm
  57.  
  58. ' >"$CHROOT_FOLDER"/init_basic
  59. chmod +x "$CHROOT_FOLDER"/init_basic
  60.  
  61. if [ ! -f "$CHROOT_FOLDER/opt/Ungoogled_Chromium-portable/chromium/chromium-pup-nosb" ] && \
  62.    [ -f "$CHROOT_FOLDER/opt/Ungoogled_Chromium-portable/chromium/chromium-pup" ] ; then
  63.   (cd "$CHROOT_FOLDER/opt/Ungoogled_Chromium-portable/chromium/"; cp -a  chromium-pup chromium-pup-nosb;
  64.    cat chromium-pup | sed -rn \
  65. '/run-as-spot "$HERE\/chrome"/ {s#^(.*)$#"$HERE/chrome" --no-sandbox --user-data-dir=$HERE/PROFILE --disable-infobars "$@"#g;p}
  66. /run-as-spot "$HERE\/chrome"/! {p}' > chromium-pup-nosb )
  67. fi
  68.  
  69. cp -f /etc/resolv.conf "$CHROOT_FOLDER"/etc/resolv.conf
  70. mount -t devpts devpts "$CHROOT_FOLDER"/dev/pts
  71. cp /var/lib/dbus/machine-id "$CHROOT_FOLDER"/var/lib/dbus/machine-id
  72. echo "LD_LIBRARY_PATH=/lib/x86_64-linux-gnu:/usr/local/lib/x86_64-linux-gnu:/usr/lib/x86_64-linux-gnu:$LD_LIBRARY_PATH" > "$CHROOT_FOLDER"/etc/profile
  73. set +x
  74. #read -p "ready to chroot. Press enter to continue"
  75. LD_LIBRARY_PATH=/lib/x86_64-linux-gnu:/usr/local/lib/x86_64-linux-gnu:usr/lib/x86_64-linux-gnu:/lib64:/usr/lib64:/usr/local/lib64:/usr/lib64/seamonkey:/lib:/usr/lib:/lib32:/usr/lib32:/usr/local/lib:/usr/local/lib32:/opt/qt5/lib64:/usr/local/firstrib/bin \
  76. #DISPLAY=:2 chroot "$CHROOT_FOLDER" bash -c "/init_basic &"
  77. DISPLAY=:2 chroot "$CHROOT_FOLDER" /init_basic
  78. umountall
  79.  
Add Comment
Please, Sign In to add comment