Commit Graph

5 Commits

Author SHA1 Message Date
ylytdeng
e9ff0d3287 fix(app_gui): _run_subprocess 漏 __file__ 导致开发模式 GUI 所有按钮失效
## 问题

GUI 点任何子任务按钮 (⑤ 企微解密 / ③ 导出 / 等), 日志报:

  unknown option --task
  usage: ... python.exe [option] ... [-c cmd | -m mod | file | -] [arg]...

返回码 2, 任务失败。

## 根因

`_run_subprocess` 构造的命令是:

  cmd = [sys.executable, "--task", task]

打包成 exe (sys.frozen=True) 时 sys.executable 就是 WeChatDecrypt.exe
本身, `--task` 是它的 argparse 子命令, 命令变成
`WeChatDecrypt.exe --task find_wxwork_keys` —— OK。

开发模式 (`python app_gui.py`) 时 sys.executable 是 python.exe,
命令变成 `python.exe --task find_wxwork_keys`, 但 `--task` 不是 python
解释器的选项, 直接报 unknown option。

## 修复

判断是否打包:

  if getattr(sys, "frozen", False):
      cmd = [sys.executable, "--task", task]
  else:
      cmd = [sys.executable, os.path.abspath(__file__), "--task", task]

加注释说明两种模式下命令行长什么样。

## 影响

- 开发模式 GUI 之前完全废, 任何按钮点了都报错。修复后恢复正常。
- 打包成 exe 路径未受影响 (该分支保持原行为)。

## 实测

本地 (Windows) 跑 `python app_gui.py`, 点 ⑤ 企业微信解密 现在能正常调
find_wxwork_keys 并解出 17 个 db。

发现路径: code review (4 个 reviewer 之一) 提到 GUI subprocess 调用方式
但没指出具体 bug, 用户实测点按钮时通过日志 `unknown option --task` 暴露。
2026-05-17 17:15:24 +08:00
xincheng
16940a8771 update 2026-05-17 06:50:11 +08:00
xincheng
ecc1cfca64 增加企业微信的解密 2026-05-17 06:24:08 +08:00
xincheng
b9f3161f84 Add SNS/image export and GUI contact export
Introduce SNS (朋友圈) and batch image tooling and enhance the GUI export workflow. Added new scripts: decrypt_sns.py (decrypt WeChat SNS cache) and batch_decrypt_images.py (bulk .dat image decrypt). Update build scripts and PyInstaller spec to include the new files. app_gui.py: add contact discovery, contact selection/export options dialog, new buttons (find image key, SNS), orchestrate combined export/voice/SNS tasks via subprocesses and env flags, and auto-run export after decryption. config.py: add output_base_dir, auto-detect WeChat Files path, and expose msgattach/xwechat cache dirs. export_messages.py: switch to output_base_dir, add image resource lookup and .dat locating/decryption helpers, and support environment-driven contact/format/image filters. Misc: update build.bat and packaging datas to include the new modules.

Co-Authored-By: Copilot <198982749+Copilot@users.noreply.github.com>
2026-04-06 23:57:51 +08:00
xincheng
a84698b9fc Add GUI, packaging and export/voice tools
Introduce a tkinter GUI and tooling to produce a single executable and export/convert message data. Adds app_gui.py (GUI launcher that runs decrypt/export/voice subtasks), export_messages.py (export messages to CSV/HTML/JSON), voice_to_mp3.py (extract SILK_V3 voice blobs and convert to MP3 via pilk + ffmpeg), WeChatDecrypt.spec and build.bat (PyInstaller spec and convenience build script), and EXE_USAGE.md (usage for the standalone exe). Update config.py to detect the application base directory when packaged, update README.md to document the GUI and packaging flow, and add pilk/pyinstaller to requirements.txt. Also expand .gitignore with common IDE/build/temp patterns and add output/data directories to ignore. These changes enable one-file packaging and provide end-user tools for decrypting, exporting and converting audio.
2026-04-04 06:12:03 +08:00