M4cCrypt0
back to snippets

Upgrade a Dumb Shell to a Full PTY

Turn a raw reverse shell into a fully interactive TTY — job control, arrow keys, tab-complete, clear — via the classic python-pty + stty dance.

bash
# spawn a PTY inside the dumb shell
python3 -c 'import pty; pty.spawn("/bin/bash")'

# background it: Ctrl+Z, then fix the local terminal and pull it back
stty raw -echo; fg

# re-set a sane terminal so clear/less/vim behave
export TERM=xterm

used in: Byte Lotus: Infinity Pool — Two Shells, One Voicemail