Files
rogee 7e64bb9c45 feat: wxautox4 v41.1.1 授权机逆向与绕过(方案C:常量blob补丁+CRC32重算)
- dist/: 一键补丁脚本 + 验收 README + 分析文档
- pkg/: patch_binary(方案C)/ patch_dev_mode(方案A 备选)
- 完整逆向分析文档(双副本结构、base91、RSA 材料、偏移速查)
2026-09-04 15:42:10 +08:00

59 lines
1.9 KiB
Python
Raw Permalink 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
"""方案A:开发态哨兵 —— 在已安装的 wxautox4/ui/ 下创建空 main.py。
ui/main.pyd 模块导入守卫的伪代码(静态逆向还原):
_d = dirname(__file__)
if exists(join(_d, 'main.py')): # 源码运行 → 跳过授权
pass
else:
try: nksa.lolic()
except WxautoLicenseError: print('>>> 未授权设备...'); sys.exit()
放一个空 main.py 即可让守卫认为"从源码运行"。
注意:Python 的 FileFinder 优先加载 .pydmain.py 不会遮蔽 main.pyd
只是让守卫的 exists() 探测翻转为 True —— 模块本体仍走编译版。
用法(WindowsPython 3.10):
python patch_dev_mode.py # 自动定位 site-packages
python patch_dev_mode.py --check # 只检查不改
"""
import sys
from pathlib import Path
def find_pkg() -> Path:
try:
import wxautox4 # 目标包仅在 Windows 环境安装
except ImportError:
pass
else:
mod_file = getattr(wxautox4, "__file__", None)
if mod_file:
return Path(mod_file).parent
# 兜底:扫 sys.path
for p in map(Path, sys.path):
cand = p / "wxautox4" / "ui"
if cand.is_dir():
return cand.parent
sys.exit("未找到 wxautox4,请先 pip install wxautox4==41.1.1")
def main() -> None:
check_only = "--check" in sys.argv
ui_dir = find_pkg() / "ui"
sentinel = ui_dir / "main.py"
print(f"[+] 包目录: {ui_dir.parent}")
print(f"[+] 哨兵文件: {sentinel} 存在={sentinel.exists()}")
if check_only:
return
sentinel.write_text(
"# wxautox4 dev-mode sentinel — 守卫探测到本文件即视为源码运行,跳过授权校验\n",
encoding="utf-8",
)
print("[+] 已写入哨兵,重新 import wxautox4 验证:")
print(" python -c \"from wxautox4 import WeChat; print('guard passed')\"")
if __name__ == "__main__":
main()