-
Notifications
You must be signed in to change notification settings - Fork 13
/
domain_info.py
29 lines (20 loc) · 744 Bytes
/
domain_info.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
"""
The examples in this file are for virustotal-python version >=0.1.0
Retrieve information about a domain from the VirusTotal API.
Documentation:
* v3 documentation - https://developers.virustotal.com/reference/domain-info
* v2 documentation - https://developers.virustotal.com/v2.0/reference/domain-report
"""
from virustotal_python import Virustotal
from pprint import pprint
API_KEY = "<VirusTotal API Key>"
domain = "virustotal.com"
# v3 example
vtotal = Virustotal(API_KEY=API_KEY)
resp = vtotal.request(f"domains/{domain}")
pprint(resp.data)
# v2 example
vtotal = Virustotal(API_KEY=API_KEY, API_VERSION=2)
resp = vtotal.request("domain/report", params={"domain": domain})
print(resp.response_code)
pprint(resp.json())