| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- """Side-effect-free probe: OPTIONS preflight on EnterGameClient host variants.
- The captures show the web client always sends an OPTIONS preflight before
- cross-site POSTs. OPTIONS has no business side effect, so it's safe for
- probing which host actually serves the endpoint:
- - pc-api.996hezi.com (current SDK host)
- - api.996hezi.com (getTodayOpen's real host)
- Path variants from the app.asar JS map (/pcApi/v1/homeapi/gameindex/...)
- and the SDK's current path.
- """
- import asyncio
- import sys
- from pathlib import Path
- _HERE = Path(__file__).resolve().parent
- sys.path.insert(0, str(_HERE.parent / "src"))
- import httpx
- CANDIDATES = [
- ("https://pc-api.996hezi.com", "/v1/homeapi/gameindex/EnterGameClient", "SDK current (lowercase g)"),
- ("https://pc-api.996hezi.com", "/v1/homeapi/Gameindex/EnterGameClient", "capture style (capital G)"),
- ("https://api.996hezi.com", "/v1/homeapi/gameindex/EnterGameClient", "api host, lowercase"),
- ("https://api.996hezi.com", "/v1/homeapi/Gameindex/EnterGameClient", "api host, capital"),
- ]
- HEADERS = {
- "Origin": "https://pc.hzwlan.com",
- "Referer": "https://pc.hzwlan.com/",
- "User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) 996Box/5.1.1 Chrome/108.0.5359.215 Electron/",
- "Access-Control-Request-Method": "POST",
- }
- async def main() -> int:
- async with httpx.AsyncClient(timeout=10, verify=False) as c:
- for host, path, note in CANDIDATES:
- url = host + path
- try:
- r = await c.options(url, headers=HEADERS)
- # CORS preflight: 204/200 = endpoint routed (allowed);
- # 404 = no such route on this host
- allow = r.headers.get("access-control-allow-methods", "")
- print(f" [{r.status_code}] {url:<68} allow={allow[:30]!r:<34} ({note})")
- except Exception as e:
- print(f" [ERR ] {url:<68} {type(e).__name__}: {str(e)[:40]} ({note})")
- return 0
- if __name__ == "__main__":
- sys.exit(asyncio.run(main()))
|