All Articles
Linux#tty#reverse shell#script#python#wsl
Jul 25, 2026 1 min read

Stabilizing a Shell (Getting a Fully Functional TTY) and WSL Fallback

This won't cover the technical details of why this works — if you want to understand the internals, check out 0xdf's video.

Below are a few techniques you can use to upgrade a bare/reverse shell into a fully interactive TTY.

#Method 1: Using Python

python3 -c 'import pty;pty.spawn("/bin/bash")'
CTRL+Z
stty raw -echo; fg
export TERM=xterm

#Method 2: Using script

script /dev/null -c bash
CTRL+Z
stty raw -echo; fg
# Terminal type? screen
export TERM=xterm

#WSL Fallback

If you're working from WSL and the above two methods don't work for some reason, try this instead:

python3 -c 'import pty; pty.spawn("/bin/bash")'
ps aux | grep nc
kill -s TSTP <PID>
stty raw -echo; fg
# Press Enter once or twice
export TERM=xterm
export SHELL=/bin/bash