Created
October 11, 2022 22:52
-
-
Save ssnkhan/7bc3a58c9fefe94f6eda368ce200c421 to your computer and use it in GitHub Desktop.
Uses the RiskIQ API to return passive DNS information for an IP or FQDN, on a given date
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import json | |
import requests | |
username = "" | |
key = "" | |
def get_pDNS(ip, date): | |
auth = (username, key) | |
url = "https://api.passivetotal.org/v2/dns/passive" | |
data = {"query": ip, "start": date} | |
response = requests.get(url, auth=auth, json=data) | |
response = response.json() | |
pDNS = [] | |
if len(response["results"]) > 0: | |
for resolution in response["results"]: | |
if resolution["resolveType"] != "email": | |
pDNS.append(resolution["resolve"]) | |
return pDNS |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment