| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- """Probe candidate AUTH hosts for 996box SMS endpoint.
- Found in 996box asar: phoneLoginCaptcha: '/authApi/auth/v1/login/byPhoneCode'
- Need to find the right host. Test:
- - auth.996hezi.com
- - auth-api.996hezi.com
- - box-auth.996hezi.com
- - api.jiyuhz.cn (existing password login host, unlikely but try)
- """
- import asyncio
- import json
- import sys
- from pathlib import Path
- _HERE = Path(__file__).resolve().parent
- sys.path.insert(0, str(_HERE.parent / "src"))
- from cq2_sdk.env_loader import load_env
- load_env(_HERE.parent / ".env")
- from cq2_sdk.login import Box996Login, ManualGeetestSolver
- CANDIDATE_HOSTS = [
- "https://auth.996hezi.com",
- "https://auth-api.996hezi.com",
- "https://box-auth.996hezi.com",
- "https://auth.box.996hezi.com",
- "https://api.996hezi.com", # 之前没用过这个
- "https://api.jiyuhz.cn", # 已知是密码登录的 v3
- ]
- PATH = "/authApi/auth/v1/login/byPhoneCode"
- async def probe(host: str) -> dict:
- """Returns dict with status, code, msg, signature_present."""
- box = Box996Login(geetest=ManualGeetestSolver(), device_id="00:15:5d:0a:04:00")
- try:
- r = await box._request(
- "POST", host, PATH,
- json_body={"phone": "13800138000",
- "channel_id": "", "game_id": "",
- "inviter_uid": "", "needConfirmLogin": True},
- )
- code = r.get("code", 0) if isinstance(r, dict) else 0
- msg = r.get("msg", "") if isinstance(r, dict) else ""
- return {"host": host, "http": 200, "code": code, "msg": msg[:80],
- "suspicious": "请先登录" in msg or msg == ""}
- except Exception as e:
- from cq2_sdk.login.box_996 import Box996Error
- msg = str(e)[:120]
- if isinstance(e, Box996Error):
- return {"host": host, "http": 200, "code": e.code, "msg": e.msg[:80],
- "suspicious": "请先登录" in e.msg}
- return {"host": host, "http": 0, "code": 0, "msg": msg,
- "suspicious": False}
- async def main() -> int:
- print(f"Probing {len(CANDIDATE_HOSTS)} candidate hosts for {PATH}\n")
- results = []
- for host in CANDIDATE_HOSTS:
- r = await probe(host)
- results.append(r)
- marker = ""
- if r["http"] == 200 and not r["suspicious"]:
- marker = "[!!! REAL !!!]"
- elif r["http"] == 200 and r["suspicious"]:
- marker = "[needs auth]"
- elif r["http"] == 0:
- marker = "[unreachable]"
- else:
- marker = f"[http={r['http']}]"
- print(f" {marker:<16} {host:<35} http={r['http']} code={r.get('code', 0):>4} {r.get('msg', '')}")
- print()
- real = [r for r in results if r["http"] == 200 and not r["suspicious"]]
- if real:
- print(f"[!!!] {len(real)} host(s) returned a non-auth-required response:")
- for r in real:
- print(f" {r['host']} code={r['code']} msg={r['msg']}")
- else:
- print("[!] No host returned a non-auth response. May need to dig deeper.")
- return 0
- if __name__ == "__main__":
- sys.exit(asyncio.run(main()))
|