← Back to search

Upgrade to a Full TTY (Linux)

enumerationlinuxtool

Summary

Turn a dumb reverse shell into a fully interactive TTY so job control, arrow keys, and tab completion work.

Walkthrough

Convert a basic, non-interactive reverse shell into a full TTY for proper job control and terminal behaviour.

Steps

  1. Spawn a PTY with Python (pty.spawn("/bin/bash")), then background the shell with stty raw -echo; fg and set export TERM=xterm. Press Enter a couple of times after fg.
  2. Match your terminal size: read your local dimensions with stty -a, then set them in the shell with stty rows 40 columns 120.
  3. If Python isn't available, check cat /etc/shells and fall back to Perl (exec "/bin/bash"), Ruby, or script /dev/null -c bash.

Commands

bash

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

bash

stty -a
stty rows 40 columns 120

bash

perl -e 'exec "/bin/bash";'
ruby -e 'exec "/bin/bash"'
script /dev/null -c bash