I'm creating a script that supposed to run virus scan in TotalVirus, on a file/s that given by the user, using TotalVirus's API (https://developers.virustotal.com/reference) .
The goals of my script are:
File Name- The use will give a file name and the file path's, and the script will scan the file in VirusTotal.
A path- The script will scan all of the files from the path that given by the user.
A list- The user will give a path, and list of files in that path. the script will scan the files in the list in VirusToal.
I decided to use the script from here - https://github.com/blacktop/virustotal-api/blob/master/virus_total_apis/api.py
I copy and pasted the code in the link from the above, and when I tried to call the funciton "scan_file", with this code:
tmp = PublicApi.scan_file('MyAPICodeIsHere', '7z.exe', 'C:\\Program Files\\7-Zip\\7z.exe', '7z.exe', '2')
This is the error I received:
Traceback (most recent call last):
File "C:/Users/OSUser/.PyCharmCE2019.1/config/scratches/testtuhs.py", line 877, in <module>
tmp = PublicApi.scan_file('64be7cea7bcabaf2be366253b247a6a1075e2a90a71bbc45058398bb8638f8db', '7z.exe', 'C:\\Program Files\\7-Zip\\7z.exe', '7z.exe', '2')
File "C:/Users/OSUser/.PyCharmCE2019.1/config/scratches/testtuhs.py", line 65, in scan_file
params = {'64be7cea7bcabaf2be366253b247a6a1075e2a90a71bbc45058398bb8638f8db': self.api_key}
AttributeError: 'str' object has no attribute 'api_key'
My guess is that I called the fucntion - "scan_file" incorrectly.
How can I call the function "scan_file" correctly, so when I call it, it will scan the file in VirusTotal? P.S - The code from the link allow many more functions with insturctions but I didn't understand how to use/call them. Thank you.