Skip to content

Instantly share code, notes, and snippets.

@ssnkhan
Created October 11, 2022 22:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ssnkhan/7bc3a58c9fefe94f6eda368ce200c421 to your computer and use it in GitHub Desktop.
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
#!/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