Created
July 19, 2024 09:35
-
-
Save Darkflib/918d4fbbf8c6b17fd9c5146c84b326eb to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| 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) |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
python rdap-query.py google.com | jq .nameservers