import urllib.request, ssl, concurrent.futures, json, sys
ctx = ssl.create_default_context(); ctx.check_hostname=False; ctx.verify_mode=ssl.CERT_NONE
eps = [l.strip() for l in open('co_endpoints.txt') if l.strip()]
# dedupe trailing slash variants to a canonical path with sample id
seen = {}
for e in eps:
    seen[e] = e
def probe(path):
    url = "https://www.fansky.co" + path
    try:
        req = urllib.request.Request(url, method="GET", headers={"User-Agent":"Mozilla/5.0"})
        r = urllib.request.urlopen(req, timeout=15, context=ctx)
        body = r.read(400)
        return path, r.status, body[:200].decode('utf-8','replace')
    except urllib.error.HTTPError as e:
        b = e.read(400).decode('utf-8','replace')
        return path, e.code, b[:200]
    except Exception as e:
        return path, 'ERR', str(e)[:100]

results = {}
with concurrent.futures.ThreadPoolExecutor(max_workers=20) as ex:
    for path, code, body in ex.map(probe, list(seen.keys())):
        results[path] = (code, body)

# print non-401/404 endpoints (interesting anonymous-reachable)
print("=== Non-401/404 GET endpoints on .co ===")
for path in sorted(results):
    code, body = results[path]
    if code not in (401, 404):
        print(f"{code}  {path}  -> {body[:120].replace(chr(10),' ')}")
