feat: 新增语音 MCP 工具 + macOS 密钥提取修复

- 新增 get_voice_messages / decode_voice / transcribe_voice MCP 工具
  - 语音数据存储在 media_0.db VoiceInfo 表(SILK v3 格式)
  - decode_voice 解码为 WAV 文件(saved to decoded_voices/)
  - transcribe_voice 通过 Whisper 自动识别语言转录
- 新增 get_chat_history oldest_first 参数,支持从最早消息开始分页
- 修复 macOS 下 check_wechat_running / ensure_keys 逻辑
  - 改用 pgrep 检测微信进程,绕过不支持 macOS 的 Python 扫描器
  - 无 all_keys.json 时打印清晰引导,提示运行 C 版扫描器
- 新增 Makefile(build / keys / decrypt / web 快捷命令)
- .gitignore 补充 find_all_keys_macos 二进制和 decoded_voices/
This commit is contained in:
zlab
2026-04-22 15:10:18 -04:00
parent 69a2f44240
commit ea1d1157f8
4 changed files with 223 additions and 7 deletions

12
main.py
View File

@@ -6,7 +6,9 @@ python main.py decrypt # 提取密钥 + 解密全部数据库
"""
import json
import os
import platform
import sys
import subprocess
import functools
print = functools.partial(print, flush=True)
@@ -16,6 +18,8 @@ from key_utils import strip_key_metadata
def check_wechat_running():
"""检查微信是否在运行,返回 True/False"""
if platform.system().lower() == "darwin":
return subprocess.run(["pgrep", "-x", "WeChat"], capture_output=True).returncode == 0
from find_all_keys import get_pids
try:
get_pids()
@@ -44,6 +48,14 @@ def ensure_keys(keys_file, db_dir):
print(f"[+] 已有 {len(keys)} 个数据库密钥")
return
if platform.system().lower() == "darwin":
print("[!] macOS 请先运行 C 版扫描器提取密钥:")
print()
print(" sudo ./find_all_keys_macos")
print()
print(" 完成后再运行 python main.py decrypt")
sys.exit(1)
print("[*] 密钥文件不存在,正在从微信进程提取...")
print()
from find_all_keys import main as extract_keys