| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- """Decode the FULL EnterGameClient response (session 753) from the SAZ —
- it may contain the launch URL that 996box passes to cq.exe."""
- import gzip
- import json
- from pathlib import Path
- import brotli
- def decode_response(path: Path) -> str:
- raw = path.read_bytes()
- idx = raw.find(b"\r\n\r\n")
- head = raw[:idx].decode("latin1")
- body = raw[idx + 4 :]
- enc = "br" if "Content-Encoding: br" in head else ("gzip" if "gzip" in head else "")
- chunked = "chunked" in head
- if chunked:
- out = b""
- rest = body
- while rest:
- le = rest.find(b"\r\n")
- if le < 0:
- break
- try:
- sz = int(rest[:le].split(b";")[0], 16)
- except ValueError:
- break
- if sz == 0:
- break
- out += rest[le + 2 : le + 2 + sz]
- rest = rest[le + 2 + sz + 2 :]
- body = out
- if enc == "br":
- body = brotli.decompress(body)
- elif enc == "gzip":
- body = gzip.decompress(body)
- return body.decode("utf-8", errors="replace")
- raw_dir = Path(r"C:\Users\ADMINI~1\AppData\Local\Temp\opencode\saz_dec\raw")
- txt = decode_response(raw_dir / "753_s.txt")
- print("=== EnterGameClient FULL response ===")
- try:
- data = json.loads(txt)
- # dump ALL keys recursively, looking for url/launch fields
- def walk(obj, path=""):
- if isinstance(obj, dict):
- for k, v in obj.items():
- p = f"{path}.{k}" if path else k
- if isinstance(v, (dict, list)):
- walk(v, p)
- else:
- kl = k.lower()
- if any(s in kl for s in ("url", "launch", "path", "exe", "start", "open")):
- print(f" *** {p} = {str(v)[:120]}")
- elif isinstance(v, str) and len(v) < 80:
- print(f" {p} = {v}")
- elif isinstance(obj, list):
- for i, item in enumerate(obj[:3]):
- walk(item, f"{path}[{i}]")
- walk(data)
- print()
- print("download_info keys:", list((data.get("data", {}).get("download_info") or {}).keys()))
- except json.JSONDecodeError:
- print(txt[:2000])
|