URL 发送并扫描URL
首先发送扫描url,然后访问https://www.virustotal.com/vt API/v2/URL/scan
发送http post请求,
其中,api接受请求的两个参数。
url:要扫描的url
API密钥:注册virus用户,并且在登录后获得公共密钥。 这是使用api的关键。
对于批量扫描,url参数接受最大长度为4的urls列表,并在每个url之间使用“ n”作为分隔符
如果请求速率超过了api限定速率,将被返回http 204状态码,若尝试执行没有所需权限的函数调用,将被返回http 403异常
e.g.
parameters={“URL”:”http://www.virustotal.comn http://www.virustotal.com,“apikey”: your api-key}
定义(URLs, apikey ) : printurl surl=' https://www.virustotal.com/vt API/v2/URL/scan ' parameters={ ' ura meters } ' API key ' data=urllib.urlencode (parameters ) try:req=urllib2.request ) URL, data ) response=urllib2.urlopen(req ) JSON=response.read # printjsonexcepturlib2. httperror,error 3360 print ' head
上图是返回的json数据。
参数解读:
San _ id :在urlscanreportretrievingapi中搜索扫描报告所需的参数
response_code :如果搜索项不在VirusTotals目录中,则返回0; 如果请求项仍入队并请求分析,则会返回-2。 如果请求项存在且可以检索,则返回1。
提供有关verbose_msg:response_code的详细信息。
检索URL扫描报告
获取url的扫描报告,并向http://www.virustotal.com/vt API/v2/URL/report提交开机自检请求
http post请求参数:
resource :如果指定了URL,则检索指定URL的最新报告。 也可以通过指定SCAN_ID访问相应的报告。 您也可以指定包含散列和scan_ids的CSV列表来运行批处理请求。 标准费率最多为4个请求。 如果多次发送,则必须用新的行字符分隔scan_ids或URL。
如果将scan (可选参数)设置为1,则会自动发送URL进行分析。 如果在VirusTotal服务数据库中找不到现有报告,则结果将包含SCAN_ID字段,您可以稍后查询分析报告。
API密钥:你的API密钥。
efreportURL(URLS,apikey ) : printurl surl=' https://www.virustotal.com/vt API/v2/URL/report ' parameters={ ' } ' scan ' :1 } data=urllib.urlencode (parameters ) try : req=urllib2. request (URL, data ) response=urllib2.urlopen(req ) JSON=response.read # printjsonexcepturlib2. httperror,error 3360 print ' head