Today a quick preliminary post about the Python programming language and how to install and configure the environment.
After a few polls and many requests, I realized how much people like the remote hacking series and the undetectable backdoor videos. I decided to put in some work towards it… and came to the conclusion that a new series of videos might be necessary on writing custom backdoors.
In case you’re wondering, why Python? Well, there’s no need for this language to be used specifically. However, it is a simple language (in the sense it’s easy to read), provides pretty much all of the third party libraries you could imagine, is installed by default on most Linux distros, and the list of benefits go on and on… my interest in this section is mainly for programming backdoors and networking related stuff — keep that in mind. Once we get to part two, I’m sure it will make a lot more sense to you. 😉
With that said, in Python we can compile stand alone executables for Windows, Linux and Mac OS X… making it versatile for development. On the other hand, you do have to consider the context your code will be used in. If you had found a vulnerability in a Java application (for example), obviously you would need to program a reverse shell in java.
Ok, so you have never programmed before in your life? Don’t worry, on part two we will get hands on with some code and I will go line by line so that the novice and the expert could benefit from it as well. As far as this segment goes, we will just be installing the programming language, dependencies, compiler and a nice code editor to program in.
The first thing we will need, of course, is Python. Head over to their website and download the latest release for your operating system. If you use linux you probably already have it installed, try this:
If you get a version back, it is installed. If not you will have to install it.
I will be using Windows for the programming environment simply for testing purposes. Since most of the backdoors produced will target mainly Windows, that’s the platform I will be testing first. Of course, once that’s outta the way I will test in other OS’s as well.
Python version I downloaded: 2.7.3 as of July 2012 — in case you’re wondering. If you read this in the future you might have to make some changes as required.
After installing Python you must change the PATH variable to make it accessible anywhere in the DOS prompt. Go ahead and open a command prompt, then type the following command:
Where C:\Python27 represents the your Python installation directory.
Allright, now we need to get Pywin32. Click the link and go ahead and download the version that matches both your Python version and your operating system architecture — I recommend you stick with 32 bits, even if you do have 64 bit architecture.
Next we will need PyInstaller, go ahead and download the *.zip file and extract it to the directory you installed python, so that it should look like this:
Then we need to configure it quickly. Open a command prompt and type the following:
(make sure to type the pyinstaller directory right)
Then run the python configure script:
That’s it! We will be using PyInstaller in the next part to create the stand alone executable.
Finally, we have to install Notepad++, so we have something nice to code in. Go ahead download and install it… and it’s a wrap!
We will pick up in a few — part two is in the oven as I write this. For now, enjoy the vid!