Hier ist eine Beispiel Funktion.
import requests
apikey = "xxxxxxxxxxx"
def check_file_with_virustotal(file_path):
url = 'https://www.virustotal.com/vtapi/v2/file/scan'
params = {'apikey': apikey}
files = {'file': (file_path, open(file_path, 'rb'))}
response = requests.post(url, files=files, params=params)
json_response = response.json()
return json_response["resource"]
def get_scan_report(scan_id):
url = f'https://www.virustotal.com/vtapi/v2/file/report'
params = {'apikey': apikey, 'resource': scan_id}
response = requests.get(url, params=params)
json_response = response.json()
return json_response
res = check_file_with_virustotal("file.bin")
rep = get_scan_report(res)
print(rep)