Files
workphone-sdk/sdk/tests/test_matrix_classifier_honesty.py

51 lines
1.9 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""WP-WX-HOOK 回归:矩阵生成器 companion 判定诚实性(防 1400 字窗口越界误判复发)
真机铁律口径:
- 真实现_shareMediaToWechat / _shareTextToWechat / _sendMessageInternal / performNow
的函数**不得**被判为 companion 占位;
- 纯 _intentAction 的函数**必须**判为 companion 占位(诚实,不假成功)。
运行python3 sdk/tests/test_matrix_classifier_honesty.py
"""
import sys
from pathlib import Path
ROOT = Path(__file__).resolve().parents[2]
sys.path.insert(0, str(ROOT / "sdk" / "scripts"))
import gen_wechat_capability_matrix as gen # noqa: E402
intent = gen.parse_intent_funcs()
# 真实现(含系统分享 / 验证发送 / DB 写 / performNow—— 绝不能被判 companion
MUST_NOT_BE_COMPANION = [
"sendImage", "sendVideo", "sendFile", "sendLink",
"forwardMessage", "forwardMultiple",
"sendMessage", "searchMessages",
]
# 纯 _intentAction 占位 —— 必须仍判 companion诚实标 ⬜)
# 注likeMoments/commentMoments 实为真 FridarevokeMessage 已加 DB 资格预检(真 Frida),均不在此列
MUST_BE_COMPANION = [
"setNickname", "setSignature", "clearCache",
]
fails = 0
print("[WP-WX-HOOK] 矩阵 companion 判定诚实性回归")
for fn in MUST_NOT_BE_COMPANION:
if fn in intent:
print(f" ✗ FAIL: {fn} 被误判为 companion 占位(真实现不应误报)")
fails += 1
else:
print(f"{fn} 正确:非 companion真 Frida")
for fn in MUST_BE_COMPANION:
if fn not in intent:
print(f" ✗ FAIL: {fn} 未被判 companion纯 _intentAction 应诚实标占位)")
fails += 1
else:
print(f"{fn} 正确companion 占位(待改真 Frida")
print(f"\n[done] companion 占位数 = {len(intent)},失败 {fails}")
sys.exit(1 if fails else 0)