How to Get a Fully Interactive Reverse Shell

Fahmi J
2 min readMay 25, 2020
Normal reverse shell

It is a pain when you make a typo in your reverse shell and then accidentally close the shell with CTRL+C. It’s also a pain because:

  • It has no arrow-up
  • It has no tab-completion
  • It is just uncomfortable!

In this post, I’ll share a quick tip to make your reverse shell a bit comfortable to use, it’s almost like SSHing the machine!

Step 1: Spawn a TTY shell!

First, we need to upgrade our current non-TTY shell into a TTY shell using the common Python PTY module.

$ python -c "import pty; pty.spawn('/bin/bash')"


$ python3 -c "import pty; pty.spawn('/bin/bash')"

Visit this web for alternative if there’s no python installed in the machine. I also found another way using script just after I published this post.

$ script /dev/null -c bash

Step 2: Upgrade to Full Interactive Shell

Background the process using CTRL + Z, and then type:

$ stty raw -echo 

Once done, type $ fg (you won’t be able to see what you type, but don’t worry) to bring the shell back to foreground and hit enter two times or just use

$ stty raw -echo;fg

Now you should be able to use arrows key and tab completion in the shell.

Since normal Ctrl + C won’t close this shell, you have to kill its process or just type $ exit.

If your shell prompt is messed up after exiting, type $ stty sane.

Note: It won’t work with rlwrap.




Fahmi J

Just curious to learn how things work, especially in digital world.