This time, however, I decided to expand on its methods and basically make an all-in-one stop for encryption / decryption.
So its something I wanted to make for my own use and figured I might as well share it with you guys. 🙂
Beware though: recursion can be dangerous if used without knowledge. You could end up encrypting your entire system. Also this script will automatically delete the old files after encryption / decryption.
Download link is at the bottom of the post!
Script Requirements
I won’t go into any details regarding the code since I’ve already made a blog post and video going into detail for this exact code.
Anyway, you will need to install pyAesCrypt. This is easiest using pip:
In this part we’ll be implementing file transfer and encryption.
I use these programs on my own system and you absolutely have to be able to download and upload files in order to get anything done.
Now some of you might remember in part three I mentioned that our encrypted channel wasn’t stable enough to handle several megabytes of data without any mishaps.
Because of that, I had to implement file encryption and decryption in the client as well, since we’re already working with pyAesCrypt anyway.
This allows us to, at the very least, encrypt files locally before sending them over a standard tcp tunnel – or keep them encrypted on the system.
Like much of the functionality we’re going through here, these functions could be copied and used in other code without much hassle.
Welcome to part two of the Python control server series.
In the first part of the series we made a simple plaintext control server. It allows you to run commands and control your systems from a distance.
This time we’re stepping it up and adding AES encryption to it.
Traffic Encryption
Since the plan is to eventually add more functionality to our server such as file transfer and reading documents over public networks, traffic encryption is definitely essential to the project.
Imagine you are downloading a file from your computer at home to your laptop using a hotel’s public wireless connection. It’s hard to feel safe about it without using some form of encryption.
For this and other reasons, we’ll be using pyAesCrypt to encrypt the connection to our server using AES both ways (server and client).
We’re off to another series: Python Control Server.
Yes, there’s three series going on at once in the blog, so what! 😀
I like having multiple things going so that I don’t have to think much whenever I have some free time to code. I can just sit down and choose whichever series/project to work on at the moment.
Anyway, many people emailed me to post my old videos (from like 10 years ago) from this same series – written in Python 2.X.
It’s also worth mentioning that some of the libraries I used back then have not been properly ported over to Python 3. Overall it just makes a lot of sense to redo the project using more current libraries.
Control Server
Why make a Python Control Server?
For many (ahem, very educational) reasons of course! Like for example, we are two days away from Christmas and many people enjoy taking vacations around this time. Well, why not setup a nice control server to have access to your systems while your away?
Sounds like a good idea time to me!
About Christmas though, I had my first batch of family visiting and let me tell you… its rather easy to get a cold when there’s a lot of people in the same household for hours at a time. So pardon my voice in the video.
Recent Comments