If you get a non-teletype (TTY) shell, you can potentially upgrade it to a teletype shell for more functionality and fewer restrictions using the instructions below.
Note: If you were running a different shell instead of
bash your host machine when you caught the shell, switch the shell to
bash before setting up your listener or these instructions may not work properly.
Upgrading Your Shell
If you have a limited reverse shell, you can try to increase the functionality of the shell by doing the following.
- In the reverse shell, run
python3 -c 'import pty; pty.spawn("/bin/bash")'
- Background the shell with
- Run this command (this will pass through keyboard shortcuts)
stty raw -echo
- Bring the shell back to the foreground by running:
fg #Note: you won't be able to see the input on the screen
- Run this command to set the terminal
Now you should be back in your reverse shell and it should have increased capabilities, like copy/paste shortcuts, the ability to clear the screen, etc.