import urllib.request import json import sys # Try both tokens tokens = [ "LfObAyuwjRs_X7Emp-kNl4AFjU1FX0XdLqVwgX0p", "cfat_ub1jXkUJinoJDmhiUJJpwQni2rSVnLnysHzvcwwH351fdff8" ] domains = ["makeanyplace.com", "makeanyplace.org"] for token in tokens: print(f"=== Trying Token: {token[:8]}... ===") for domain in domains: # Get Zone ID req = urllib.request.Request( f'https://api.cloudflare.com/client/v4/zones?name={domain}', headers={'Authorization': f'Bearer {token}', 'Content-Type': 'application/json'} ) try: resp = json.loads(urllib.request.urlopen(req).read()) if not resp.get('result'): print(f"Zone {domain} not found with this token.") continue zone = resp['result'][0] zone_id = zone['id'] status = zone['status'] print(f"Domain: {domain}, Zone ID: {zone_id}, Status: {status}") print(f"Nameservers: {zone.get('name_servers', [])}") # Fetch DNS Records rec_req = urllib.request.Request( f'https://api.cloudflare.com/client/v4/zones/{zone_id}/dns_records', headers={'Authorization': f'Bearer {token}', 'Content-Type': 'application/json'} ) rec_resp = json.loads(urllib.request.urlopen(rec_req).read()) print("DNS Records at Cloudflare:") for rec in rec_resp.get('result', []): print(f" Type: {rec.get('type')}, Name: {rec.get('name')}, Content: {rec.get('content')}, Proxied: {rec.get('proxied')}") except urllib.error.HTTPError as he: print(f"HTTP Error for {domain}: {he.code} {he.reason}") print(he.read().decode()) except Exception as e: print(f"Error for {domain}: {e}") print()