38 lines
1.4 KiB
Python
38 lines
1.4 KiB
Python
import urllib.request
|
|
import json
|
|
|
|
pb_key = "pk1_6e51c25cc1f0ded78246f0a4cd4a3cef404c47308dcc2f8b66bf8065ec6350bf"
|
|
pb_secret = "sk1_7dc521cdfb1a987285af2b811333e2fed77ba1013559c6671e25f948305d4f29"
|
|
|
|
domains = ["makeanyplace.com", "makeanyplace.org"]
|
|
|
|
for domain in domains:
|
|
print(f"=== Domain: {domain} ===")
|
|
|
|
# Get Nameservers
|
|
ns_req = urllib.request.Request(
|
|
f'https://api.porkbun.com/api/json/v3/domain/getNs/{domain}',
|
|
data=json.dumps({"apikey": pb_key, "secretapikey": pb_secret}).encode(),
|
|
headers={'Content-Type': 'application/json'}
|
|
)
|
|
try:
|
|
ns_resp = json.loads(urllib.request.urlopen(ns_req).read())
|
|
print(f"Nameservers: {ns_resp.get('ns', [])}")
|
|
except Exception as e:
|
|
print(f"Error getting NS: {e}")
|
|
|
|
# Get DNS Records
|
|
dns_req = urllib.request.Request(
|
|
f'https://api.porkbun.com/api/json/v3/domain/dns/retrieve/{domain}',
|
|
data=json.dumps({"apikey": pb_key, "secretapikey": pb_secret}).encode(),
|
|
headers={'Content-Type': 'application/json'}
|
|
)
|
|
try:
|
|
dns_resp = json.loads(urllib.request.urlopen(dns_req).read())
|
|
print("DNS Records:")
|
|
for rec in dns_resp.get('records', []):
|
|
print(f" Type: {rec.get('type')}, Name: {rec.get('name')}, Content: {rec.get('content')}")
|
|
except Exception as e:
|
|
print(f"Error getting DNS: {e}")
|
|
print()
|