I am using virusTotal API for url scan info. All the results (urls scanned by VirusTotal) are printed in Command Prompt.In that output, there is a data column header called "detected". So what I want to do is put an if statement and print if "detected==true" print("Detected") else if "detected ==false" print("Not detected") I wrote the code and it does not give any errors But I don't get any results
if (response.'detected'=="false"):
print("Malware Not Detected")
elseif(response.'detected'=="true"):
print("Not Detected")
Here is my full code
import csv
import itertools
import requests
import json
domainfile=open('domainsi.csv',newline='',encoding='utf_8')
reader=csv.reader(domainfile)
w=[]
for row in reader:
w.extend(row)
domain = list(itertools.permutations(w,1))
print(domain)
def url_report(domain):
url = 'https://www.virustotal.com/vtapi/v2/url/report'
params = {'apikey': '', 'resource':domain}
response = requests.get(url, params=params)
return response
def pp_json(json_thing, sort=True, indents=4):
if type(json_thing) is str:
print(json.dumps(json.loads(json_thing), sort_keys=sort,
indent=indents))
else:
print(json.dumps(json_thing, sort_keys=sort, indent=indents))
return None
for d in domain:
response = url_report(d)
json_response = response.json()
pretty_json = pp_json(json_response)
print(pretty_json)
input()
Aucun commentaire:
Enregistrer un commentaire