# Yichen Wecom Local Vault

Read, decrypt, query, search, and export local WeCom/企业微信 5.x desktop databases on...

- Repository: https://github.com/mcncarl/yichen-skills (5140 stars)
- Category: Data and ML
- License: see repository
- Last updated: 2026-11-01
- Runs scripts: yes, review before use

## Install

Claude Code: `npx skills add mcncarl/yichen-skills --skill yichen-wecom-local-vault -g -a claude-code -y`
Codex: `npx skills add mcncarl/yichen-skills --skill yichen-wecom-local-vault -g -a codex -y`
Cursor: `npx skills add mcncarl/yichen-skills --skill yichen-wecom-local-vault -g -a cursor -y`
Gemini CLI: `npx skills add mcncarl/yichen-skills --skill yichen-wecom-local-vault -g -a gemini-cli -y`

## Description

Read, decrypt, query, search, and export local WeCom/企业微信 5.x desktop databases on macOS into a private read-only vault, and match message images, files, voice and video to the client's local cache. Use when the user asks to parse 企业微信本地数据、企微聊天记录、企微图片/文件/原图、WeCom/WXWork contacts, sessions, groups, customers, message history, local database backup, structured export, or a Mac enterprise-WeChat data analysis workflow.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

# yichen-wecom-local-vault：企业微信本地数据 Vault

只读取 Mac 企业微信5.x本地数据库，生成新的私密明文快照，再从快照查询联系人、会话和消息。把它与个人微信 `yichen-wechat-local-vault` 分开使用；两者的容器、加密算法和表结构不兼容。

## 强制边界

- 绝不点击、退出、重启、重签原始 `/Applications/企业微信.app`，也绝不发送企业微信消息。
- 允许在用户明确要求“修改边界 / 用重签副本抓企微 key / 继续完整解密”时，复制一份企业微信到私密 Vault，对副本做 ad-hoc 重签，并通过 Frida 启动这个副本捕获 key。
- 重签副本只能用于本机 owner 授权的数据解析；默认不复用旧副本、不覆盖已有副本、不写进项目或云盘。
- 默认不附加企业微信进程。只有用户明确要求“抓企微 key / 捕获密钥 / 继续解密”时，才可运行带 `--confirm-attach` 的捕获命令；系统拒绝 attach 时优先改用签名副本路线。
- 只读源数据库和 WAL；不写回企业微信容器。
- 不删除或覆盖任何文件。每次解密建立新的时间戳快照；每次导出建立新文件。
- 不在回复或日志中显示 raw key、完整账号目录、联系人内部 ID 或整段私聊原文。
- 明文快照、密钥和导出文件都属于敏感数据；不要放进项目、桌面、云盘或 Git。

## 入口

```bash
SKILL_DIR="${CODEX_HOME:-$HOME/.codex}/skills/yichen-wecom-local-vault"
python3 "$SKILL_DIR/scripts/vault_cli.py" status
```

依赖：日常发现与查询只需要 Python 3；解密需要 `pycryptodome`；Mac 被动捕获 key 另外需要 `frida`。不要自动安装依赖，先报告缺项。

## 自动选择工作流

1. 第一次使用或用户问“能不能解析”：运行 `status`，只检查数据库，不附加进程。
2. 已有私密 key 文件：运行 `decrypt` 创建新快照；默认合并已提交的 WAL 帧。
3. 缺少 key：先说明需要明确授权捕获；可选只读 attach，若 macOS 拒绝 `task_for_pid`，再使用重签副本捕获。
4. 已有快照：直接用 `sessions`、`contacts`、`history`、`search`、`export`，不要重新解密。
5. 用户指定会话或时间范围：只查询该范围；消息较多时先落 Markdown/JSON 文件。
6. 用户要图片、文件、语音、视频本体，或问哪些图还没下载：用 `history/search/export --media` 或 `media` 命令；只读本机缓存，不打开客户端。

## 数据库发现与检查

```bash
python3 "$SKILL_DIR/scripts/vault_cli.py" discover
python3 "$SKILL_DIR/scripts/vault_cli.py" status
python3 "$SKILL_DIR/scripts/vault_cli.py" status --show-paths
python3 "$SKILL_DIR/scripts/capture_key_macos.py" list
python3 "$SKILL_DIR/scripts/capture_key_macos.py" doctor
python3 "$SKILL_DIR/scripts/scan_dbkey_manager_macos.py" scan
```

只有用户明确需要看真实路径时才使用 `--show-paths`。多账号时用 `--data-dir` 指定包含 `message.db`、`session.db`、`user.db` 的数据集。

## 捕获 Mac 企业微信 key

此步骤只被动附加已经运行的进程，不启动或操作客户端。必须获得用户当轮明确授权：

```bash
python3 "$SKILL_DIR/scripts/capture_key_macos.py" capture \
  --confirm-attach \
  --duration 60
```

The rest: https://github.com/mcncarl/yichen-skills/blob/HEAD/yichen-wecom-local-vault/SKILL.md
