Have you ever created your own virus scanner? If you want to do it but don’t know where to start or feel you can’t do it, don’t worry. Because in this article, I will guide you to make your own an extremely simple virus scanner in python.
You don’t have to write a virus scanner from scratch, I mean re-code everything. If you can do that that’s great, but most people can’t do it but it’s also very time consuming. Instead, you can use libraries and APIs available from famous virus scanning websites like Virus Total.
What is Virus Total?
Virus Total checks your files with more than 70 anti-virus scanners and lists of dangerous URLs/domains, it also extracts the file’s contents for research. Any user can select a file from their computer using a browser and send it to VirusTotal. VirusTotal provides various ways for you to send files such as web apps, PC apps, browser extensions and APIs. The web application has the highest scan priority among the rest. Which programming language can you use to send files using HTTP based API.
When submitting a file or URL, the results are shared with both the sender and the scanning party, who uses the results to improve their own systems. Therefore, by submitting files, URLs, domains, etc. to VirusTotal, you are also contributing to the improvement of IT security worldwide.
How to create a simple Virus scanner in Python
Since VirusTotal has API support and documents for both Python and Golang, implementing the API is also very easy. But first, you need to make sure your system has python 3 installed first. If you have not installed it, you can install it at the wire. For the interface, I use the PySimpleGUI library to make the interface simple and easy to use. In addition, if you are familiar with CLI, you can edit the code a bit.
Then login to Virus Total here and select API Key.
Next, you copy the API key by clicking the copy icon below.
So the preparation step is done, you do a few more steps below to install the system.
Step 1: Download the application to your system by cloning the following repo:
git clone https://github.com/ellyx13/Virus-Scanner-With-Python.git
Step 2: Open the virus_Scanner.py file and paste the copied API key into the variable API_KEY.
Step 3: Open cmd at the path of the virus_total.py file and install the necessary libraries with the command below:
python install -r requirements.txt
Step 4: Run the file virus_Total.py.
On the software interface, you press the . button Browse and select the file you want to scan and press Scan.
Wait a few seconds for the program to receive the results from Virus Total. Here are the results I got, a lot of problems :v.