Interactive Shell

Once an shell is established (e.g. using netcat), use python to spawn a new shell:

# In reverse shell
# ("/bin/sh")'
python -c 'import pty; pty.spawn("/bin/bash")' 
python3 -c 'import pty; pty.spawn("/bin/bash")'
export SHELL=bash
# export TERM=screen-256color # export TERM=linux
export TERM=xterm-256color
Ctrl + Z
# In host
stty raw -echo ; fg ; reset
# In reverse shell
stty rows 200 columns 200
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/tmp