Upgrade Default Reverse Shell to Fully Interactive Shell
After reverse shell with netcat
listener (e.g. nc -lvp 6969
), by default the “dumb shell” is non-interactive and cannot pass special keyboard commands such as tab autocomplete, backspace, arrow keys, etc.
To upgrade dumb shell to fully interactive shell, run this python command to get partially interactive shell:
python -c 'import pty;pty.spawn("/bin/bash");'
<Ctrl-z>
in terminal to background netcat
.
Now with the shell backgrounded, change terminal line settings to type raw and tell it to pass keyboard shortcuts:
stty raw -echo
Foreground the shell:
fg
Reinitialize the terminal to look normal:
reset