51 lines
1.9 KiB
Python
51 lines
1.9 KiB
Python
#!/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 实为真 Frida;revokeMessage 已加 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)
|