| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 |
- """Targeted probe of pc-api.996hezi.com/sms/send with format-valid phones.
- The wide probe found 1 non-404 hit: this endpoint returned 500 'phone format
- invalid' for '00000000000'. Now try valid-format fake phones to see what
- the server does for an actual SMS send attempt.
- """
- 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
- HOST = "https://pc-api.996hezi.com"
- PATH = "/sms/send"
- # 用不同格式的假号探: 全 0 / 全 1 / 11 位 1 开头 / 13 位 +86
- TEST_PHONES = [
- ("00000000000", "全 0 (格式错, 基线)"),
- ("11111111111", "11 位 1 开头 (格式过, 但不存在)"),
- ("13800138000", "标准 11 位 138 开头 (格式过, 不存在)"),
- ("+8613800138000", "E.164 +86 格式"),
- ("17756576757", "用户真实号 (会真发短信! 跳过这行)"),
- ]
- async def try_phone(box, phone: str) -> dict:
- """Returns dict with status, code, msg."""
- try:
- r = await box._request("POST", HOST, PATH,
- json_body={"phone": phone,
- "channel_id": "",
- "game_id": "",
- "inviter_uid": "",
- "needConfirmLogin": True})
- return {"http": 200, "code": r.get("code", 0),
- "msg": r.get("msg", "")[:100],
- "data_keys": list(r.get("data", {}).keys()) if isinstance(r.get("data"), dict) else []}
- except Exception as e:
- from cq2_sdk.login.box_996 import Box996Error, CaptchaRequiredError
- msg = str(e)[:120]
- if "404" in msg:
- return {"http": 404, "code": 0, "msg": "404"}
- if isinstance(e, CaptchaRequiredError):
- return {"http": 200, "code": 101000, "msg": "geetest required"}
- if isinstance(e, Box996Error):
- return {"http": 200, "code": e.code, "msg": e.msg[:100]}
- return {"http": 0, "code": 0, "msg": msg}
- async def main() -> int:
- box = Box996Login(geetest=ManualGeetestSolver(), device_id="00:15:5d:0a:04:00")
- print(f"Probing {HOST}{PATH} with format-valid fake phones:\n")
- for phone, desc in TEST_PHONES:
- if phone == "17756576757":
- print(f" [SKIP] 真实号, 跳过避免真发短信")
- continue
- r = await try_phone(box, phone)
- print(f" phone={phone:<15} {desc:<30} http={r['http']} code={r.get('code', 0):>4} {r.get('msg', '')}")
- return 0
- if __name__ == "__main__":
- sys.exit(asyncio.run(main()))
|