Python代码实现访问VirusTotal,获取杀软结果

代码如下: 

#coding=utf-8
import json
import urllib 
import urllib2

apikey="xxxxd9f21b9e0dabd4dxxxxf017e989bd915ad5e94d4exxxx067d9a08fdxxxx"	#vt账号的key
url = "https://www.virustotal.com/vtapi/v2/file/report"
md5 = "16b704559ffb7a6027e665280a8d20b7"					#样本MD5值

param = {'resource':md5, 'apikey':apikey, 'allinfo': '1'}
data = urllib.urlencode(param)
result = urllib2.urlopen(url, data)
jsondata =  json.loads(result.read())

file=open("./report.json", "w")
json.dump(jsondata, file, indent=4)
file.close()

report.json文件如下,和直接在VirusTotal页面输入md5值搜索结果一样:

vt账号key的查找方式:

1、点击你的vt账号头像,点击Settings

2、跳转到新页面左边看到APIKey,点击就看到了。

猜你喜欢

转载自blog.csdn.net/singleyellow/article/details/86697709