Last active
June 7, 2016 21:07
-
-
Save KINGSABRI/baae12a5b4e4786c8cdd830dc9d35228 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
# Reproduce | |
## Terminal 1 | |
ncat -lvp 5555 -e /bin/sh | |
## Terminal 2 | |
ncat -v localhost 5555 | |
# Python pty spawn | |
python -c 'import pty; pty.spawn("/bin/bash")' | |
# test interactive mode with interactive linux command | |
passwd | |
# Ruby tries - didn't work | |
ruby -r 'pty' -e 'PTY.getpty("/bin/bash")' | |
ruby -r 'pty' -e 'PTY.spawn("/bin/bash")' | |
ruby -e 'puts exec("/bin/bash")' | |
ruby -e 'puts system("/bin/bash")' | |
ruby -e 'IO.popen("/bin/bash") { |f| puts f.gets }' | |
ruby -e '%x"/bin/bash"' | |
ruby -r 'pty' -r 'expect' -e 'PTY.getpty("/bin/bash"){|i, o| o.sync = true; i.expect(/.*/) {|l| puts l,o}}' | |
ruby -r 'pty' -r 'expect' -e 'PTY.getpty("/bin/bash"){|i, o| o.sync = true; i.expect(/.*/) {|l| puts l,o; o.flush} }' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment