利用virustotal公共API获取病毒样本扫描结果

virustotal.com网站允许用户上传恶意样本,然后返回46个病毒扫描器的扫描报告。

利用virustotal.com网站提供的公共API,可以编写python脚本自动获取这个扫描报告。

官方网站就有详细的教程 https://www.virustotal.com/en/documentation/public-api/

首先要注册一个帐号,登录后在帐号Profile下可以发现自己的apikey。

然后教程依次介绍了:

上传和扫描文件

重新扫描已提交的文件 (直接利用文件hash值)

检索文件扫描报告(重点)

此外还介绍

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 7
    评论
加入这些API可以增强你的搜索和安全分析能力。以下是每个API的简要介绍和如何使用它们: 1. fofa API:可以使用 Fofa API 来搜索互联网上的设备和服务。在使用之前,你需要注册并获取 API 密钥。然后,你可以使用 API 来执行各种查询,例如根据 IP 地址、端口、协议、地理位置等来搜索设备。示例代码如下: ```python import requests api_email = 'your_email' api_key = 'your_api_key' query = 'title="admin" && country="CN"' res = requests.get(f"https://fofa.so/api/v1/search/all?email={api_email}&key={api_key}&qbase64={query}") print(res.json()) ``` 2. Shodan API:与 Fofa API 类似,Shodan API 也可以用来搜索互联网上的设备和服务。你需要注册并获取 API 密钥,然后可以使用 API 来执行各种查询。例如,根据 IP 地址、端口、协议、服务等搜索设备。示例代码如下: ```python import shodan api_key = 'your_api_key' api = shodan.Shodan(api_key) query = 'apache' results = api.search(query) for result in results['matches']: print(result['ip_str']) ``` 3. GitHub API:GitHub API 可以用来搜索代码库、获取代码库信息、获取提交历史记录等。你需要注册并获取 API 密钥,然后可以使用 API 来执行各种查询。例如,搜索代码仓库、获取仓库信息、获取提交历史记录等。示例代码如下: ```python import requests api_key = 'your_api_key' headers = {'Authorization': f'token {api_key}'} # Search repositories query = 'language:python' res = requests.get(f'https://api.github.com/search/repositories?q={query}', headers=headers) print(res.json()) # Get repository information repo_name = 'torvalds/linux' res = requests.get(f'https://api.github.com/repos/{repo_name}', headers=headers) print(res.json()) # Get commit history res = requests.get(f'https://api.github.com/repos/{repo_name}/commits', headers=headers) print(res.json()) ``` 4. VirusTotal APIVirusTotal API 可以用来分析文件、URL 和 IP 地址的恶意程度。你需要注册并获取 API 密钥,然后可以使用 API 来执行各种分析。例如,分析文件、URL 和 IP 地址的恶意程度,获取恶意软件样本等。示例代码如下: ```python import requests api_key = 'your_api_key' headers = {'x-apikey': api_key} # Analyze file file_hash = 'e8f91b8e4b9f0dbd382bfe6c9f776b2c' res = requests.get(f'https://www.virustotal.com/api/v3/files/{file_hash}', headers=headers) print(res.json()) # Analyze URL url = 'https://www.google.com' res = requests.post(f'https://www.virustotal.com/api/v3/urls', headers=headers, json={'url': url}) print(res.json()) # Analyze IP address ip_address = '8.8.8.8' res = requests.get(f'https://www.virustotal.com/api/v3/ip_addresses/{ip_address}', headers=headers) print(res.json()) ``` 以上是如何使用 fofa、shodan、github 和 virustotalAPI 进行搜索和分析的示例代码。注意,在使用这些 API 时需要遵守相应的使用条款和政策。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 7
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值