Simple Python Backdoor

Published

Introduction: Simple Python Backdoor

About: Hello, my name is xp4xbox, a really old name that really has nothing to do with xbox consoles. Anyway I enjoy making programs and have several instructables on some of them. So far, I know VBScript, Batch, P...

So after almost a year since instructable on my Simple Netcat Backdoor, I was inspired to create a similar but more feature-filled version using the Python programming language simply because its a fairly simple language compared to others. So if you don't know what a backdoor is, its basically a way that allows you to connect to and control someone's computer. This one has many advantages over the netcat one, such as a much simpler install, usage and very easy to use outside of your network. I even included a remote cmd, so you can run any commands as before with this one. Also since the server is now cross-platform, you can now accept connections on a Linux server.

Anyway you can download the latest version here (the only files you will need are the server and client).

NOTE: This program is still a little bit in work in progress, I plan hopefully in the future to include a few more features. This project is also available on the github page.

Step 1: Installing Prerequisites...

So since this program is made in Python 3, you go ahead and download the latest version from here. But you will also need a few modules.

So to install them, you can simply run python -m pip install -r requirements.txt in a command prompt. The "requirements.txt" is the file in the main directory that contains all of the modules needed.

Step 2: Setup...

So to configure the client, open up client.py with IDLE or any other editor and you should see the code above as in pic 1.

Anyway, the first thing you need to do is configure to IP address to connect to, so set strHost to be your IP in which the client should connect to such as in pic 2. Or if you plan to use the program with a dns such as from no-ip, which allows you to use the program outside your network, remove the "#" on the line below and fill in your hostname in between the quotes. eg. myserver113.ddns.net.

NOTE: If you plan on using the program outside of your network, you must port forward port 3000. Or if you are using a server though such as one from DigitalOcean, no port forwarding is required :).

Step 3: Build to .exe

In order to allow anyone without python and modules to run the file, you must build the file to an .exe. So to build open up a command prompt and run the following code:

pyinstaller client.py --exclude-module FixTk --exclude-module tcl --exclude-module tk --exclude-module _tkinter --exclude-module tkinter --exclude-module Tkinter --onefile --windowed

What this does is exclude the unused tkinter module to save on file size and then creates a single executable.

NOTE: You can add your own icon by adding --icon="icon path"

Step 4: Usage...

Before you can run the server, you must disable your firewall or allow port 3000 in order to accept upcoming connections. After that you can run the server to listen for connections.

Once you get a connection, you can type "--help", and you should get a prompt as in pic 1. Next you can interact with the user by typing "--i client id".

Next, you should see a menu appear as in pic 2, and now you can run any command you want such as "--m" to send a message, "--e" to open remote cmd, etc. You can also use "--b" so you can move the connection to the background and interact with another computer.

As I said, you can do anything you originally did with the netcat backdoor only more.

NOTE: Its always best to do a graceful shutdown by running "--x" in the main menu instead of closing the window.

NOTE: For using "--x 2" and "--x 3", you can also add a custom shutdown message by adding the message after the command. eg. "--x 3 Windows Shutdown".

Step 5: Uninstalling...

If you ever added this program to the startup and want to remove it, simply open up the registry and navigate to "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run". Then delete the value called "winupdate". I gave it a non-suspicious name so that it won't get deleted by accident ;).

Step 6: Explanation...

So I could spend pages writing on how I made every feature, but instead I will explain generally how this entire program works.

So the program works by first having a server listening on a port for upcoming connections from the client, in this case I chose port 3000. Next the client connects to the server using that port and then waits for the server to send it commands. In my case the commands are just simple strings of text such as "dtaskmgr" which basically tells the client to disable task manager. Its very simple actually. The server never communicates directly with the clients PC, instead it communicates with the client which then runs the commands specified.

One more thing about sending data over a socket, is that the data must be sent as bytes which means you will see the server and the client constantly decoding the messages to standard text.

Anyway, that's pretty much all that comes into making backdoor, you will notice I lightly commented out the code, so if you know a little python, it should be a little easy to understand.

Step 7: Done!

Have fun with this program! It can especially be helpful for helping in friends/relatives who do not live closely.

I hope you found this instructable useful and if you have any questions, or concerns please leave a comment or pm me.

Also if you find any bugs in this program, or feel as a feature is missing or would be useful to include, please report it to me.

Please use this program responsibly and legally, I am not responsible for anything you do.

Share

    Recommendations

    • Water Contest

      Water Contest
    • Creative Misuse Contest

      Creative Misuse Contest
    • Oil Contest

      Oil Contest

    8 Discussions

    You need to open a port in your router settings. There are a million tutorials on how to port forward for every router. But basically just go into your router settings and open the port you wish to allow.

    If I want the client to connect to a remote password (lets say my cousins house to mine) I simply put my public ip in strHost="my-ip" and port forward my router (3000) correct? I have tried this and my cousin ran the client but nothing connected to the server on my side.

    1 more answer

    remote server* not password.

    Necessary if you want others to be able to run the client without installing python and all other modules.

    Could you try to put it in Github? Lots of Instructables users can help to improve it...

    1 reply

    Done, https://github.com/xp4xbox/Simple-Python-Backdoor. I was not really planning on having it on github, but it doesn't hurt.