Skip to content

Instantly share code, notes, and snippets.

@Darkflib
Created July 19, 2024 09:35
Show Gist options
  • Select an option

  • Save Darkflib/918d4fbbf8c6b17fd9c5146c84b326eb to your computer and use it in GitHub Desktop.

Select an option

Save Darkflib/918d4fbbf8c6b17fd9c5146c84b326eb to your computer and use it in GitHub Desktop.
import requests
import sys
import json
def rdap_lookup(domain):
url = f"https://rdap.verisign.com/net/v1/domain/{domain}"
response = requests.get(url)
if response.status_code == 200:
data = response.json()
return data
else:
return f"Error: {response.status_code} - {response.reason}"
if __name__ == "__main__":
if len(sys.argv) != 2:
print("Usage: python rdap_lookup.py <domain>")
else:
domain = sys.argv[1]
result = rdap_lookup(domain)
if isinstance(result, dict):
print(json.dumps(result, indent=4))
else:
print(result)
@Darkflib
Copy link
Author

python rdap-query.py google.com | jq .nameservers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment