Gaining an Interactive Reverse Shell w/ Python

Before performing the following steps make sure you have a remote shell created from your target machine (any shell should work including those dumb ones)!

The biggest issue that can be faced while having a remote shell on your TryHackMe, HackTheBox or any other target machine is that those reverse shells are dumb.

Because of that dumb shell you can’t autocomplete, use arrow keys to get your previous entered command or correct some typo in your current long command. But the worst part is you can’t AUTOCOMPLETE!

To resolve this issue, we can use a really awesome method using python . All that is needed is python to be present on both local and target machine. And you are good to go!

So, here are the steps to resolve one of the biggest issues in our lives!

  1. Check if python is installed on both your target and local machine using the command:
$ which python

2. If you get an output similar to /usr/bin/python then you are good to go!

3. Git clone the repository python-pty-shells.

4. Open the cloned repository and edit the script to add your local IP and port on which you want to receive the interactive shell.

5. Once, you’ve updated the lhost and lport in the script, you can send it to your target machine by starting an python server on your local machine and obtaining the file on your target machine using wget .

6. Next we need to run the script by passing it our local IP and port (same as the one entered in backconnectscript) as parameters on our local machine.

└─$ python -b <local_ip>:<listening_port>

7. After that start the on target machine.

$ python

8. And we have a fully interactive reverse shell!

Note: As of now, this only works with python and not with python3.

Do check out my other work and write-ups at

Just another CyberSec Guy

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store