Files
gfil-blog/diagnose_domains.py

62 lines
2.1 KiB
Python
Raw Normal View History

2026-06-28 17:19:47 +00:00
"""Diagnose gfil-lab.com redirect loop and gfil-intel.xyz bot blocking"""
import urllib.request
import http.client
# Test gfil-lab.com
print("=== gfil-lab.com ===")
try:
r = urllib.request.urlopen("https://gfil-lab.com", timeout=15)
print(f"Status: {r.status}")
print(f"URL after redirects: {r.url}")
print(f"Headers: {dict(r.headers)}")
except urllib.error.HTTPError as e:
print(f"HTTPError: {e.code} {e.reason}")
print(f"Headers: {dict(e.headers)}")
print(f"Redirect location: {e.headers.get('Location', 'N/A')}")
except Exception as e:
print(f"Error: {type(e).__name__}: {e}")
# Test with manual redirect following
print("\n=== Manual redirect trace for gfil-lab.com ===")
url = "https://gfil-lab.com"
for i in range(10):
try:
req = urllib.request.Request(url, headers={"User-Agent": "Mozilla/5.0"})
r = urllib.request.urlopen(req, timeout=10)
print(f"Hop {i}: {url} -> {r.url} (status {r.status})")
break
except urllib.error.HTTPError as e:
loc = e.headers.get("Location", "")
print(f"Hop {i}: {url} -> {e.code} {e.reason}, Location: {loc}")
if loc:
url = loc
else:
break
except Exception as e:
print(f"Hop {i}: {url} -> Error: {e}")
break
# Test gfil-intel.xyz
print("\n=== gfil-intel.xyz ===")
try:
req = urllib.request.Request("https://gfil-intel.xyz", headers={"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36"})
r = urllib.request.urlopen(req, timeout=15)
print(f"Status: {r.status}")
print(f"Size: {len(r.read())} bytes")
except urllib.error.HTTPError as e:
print(f"HTTPError: {e.code} {e.reason}")
body = e.read().decode()[:500]
print(f"Body: {body}")
except Exception as e:
print(f"Error: {type(e).__name__}: {e}")
# Check DNS
print("\n=== DNS Check ===")
import socket
for domain in ["gfil-lab.com", "gfil-intel.xyz"]:
try:
ips = socket.getaddrinfo(domain, 443, socket.AF_INET)
print(f"{domain}: {[x[4][0] for x in ips[:3]]}")
except Exception as e:
print(f"{domain}: DNS error - {e}")