AGENT SKILL

wecom-local-vault

Inspect authorized local WeCom databases on macOS, create private plaintext snapshots, and query or export contacts, conversations, and messages without modifying the source account store. Use when the user asks to parse 企业微信/WeCom local data, recover a private database snapshot, inspect local contacts or sessions, search chat history, or export a bounded conversation.

License 许可
MIT
最近更新
2026-11-03
Stars
★ 1
Forks
0

01 前言 Front Matter

name
wecom-local-vault
description
Inspect authorized local WeCom databases on macOS, create private plaintext snapshots, and query or export contacts, conversations, and messages without modifying the source account store. Use when the user asks to parse 企业微信/WeCom local data, recover a private database snapshot, inspect local contacts or sessions, search chat history, or export a bounded conversation.

02 资源文件 10

03 SKILL.md 正文

WeCom local vault

Use this Skill only for data the user is entitled to inspect. The operating model is source read-only: discover an account store, validate a captured 16-byte secret against encrypted page one, materialize a new protected snapshot, then run every query against that snapshot.

Read references/examples.md for complete positive, boundary, and recovery cases. Read references/database-notes.md only when inspecting or adapting database schemas.

Inputs and prerequisites

  • Confirm the user is entitled to inspect the local dataset and select a passive inspection, secret capture, snapshot, bounded query, or export.
  • Provide or choose an exact dataset label/data directory; multiple discovered accounts must be resolved by the user, not by inspecting private contents.
  • Snapshot/decrypt requires a candidate secret that validates against page one. Query/export requires a pinned private snapshot, exact conversation, time bounds/timezone, and a new owner-only destination.
  • Process attachment, a copied signed app, and sudo scanning are distinct authorization gates. Failure of one route does not authorize the next.

Safety contract

  • Never drive the WeCom interface or send a message.
  • discover, status, list, and doctor are passive. Process attachment, launching a re-signed copy, and sudo memory reading each require their own explicit flag in the current run.
  • Never change a source database or its WAL. Snapshot, key, diagnostic, and export files stay under the private vault unless the user explicitly supplies another private destination.
  • Existing outputs are not replaced. Secrets never appear in terminal output. Do not paste internal IDs or unrelated private-message bodies into the response.
  • Do not disable SIP, alter task-port policy, or install dependencies automatically.

The default vault is ~/Library/Application Support/wecom-local-vault. WECOM_LOCAL_VAULT_HOME can select a different private root. A JSON config at ~/.config/wecom-local-vault.json may set vault_dir and data_dir.

First inspection

Set SKILL_DIR to this directory, then run:

VAULT_CLI="$SKILL_DIR/scripts/vault_cli.py"
CAPTURE_HELPER="$SKILL_DIR/scripts/capture_key_macos.py"
python3 "$VAULT_CLI" status
python3 "$VAULT_CLI" discover
python3 "$CAPTURE_HELPER" doctor

Paths are omitted from discovery output unless --show-paths is requested. When more than one account is found, choose one with --data-dir.

Secret acquisition

Attaching to an already-running process requires explicit authorization:

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

If macOS blocks attachment, stop. With a separate user instruction permitting a copied and ad-hoc-signed application, use:

python3 "$CAPTURE_HELPER" capture --duration 240 \
  --confirm-signed-copy --mode=spawn-signed-copy

The capture agent observes known CommonCrypto/SQLite key paths. A candidate is saved at mode 0600 only after it decrypts a supported database first page and yields a valid SQLite B-tree marker.

As a separate fallback, the Mach scanner reads a known WeCom 5.x DbKeyManager object layout without code injection. It is version-sensitive and asks for administrator credentials in the local terminal:

python3 "$SKILL_DIR/scripts/scan_dbkey_manager_macos.py" scan --confirm-sudo

Never infer that a timeout means the database is unsupported; the application may simply not have exercised a hooked path during the observation window.

Snapshot creation

python3 "$VAULT_CLI" decrypt --key-file "/private/location/key.json"
python3 "$VAULT_CLI" decrypt

Every run creates a new 0700 timestamp directory. Database files and manifest.json are 0600. By default, complete frames through the final commit marker in a matching-salt WAL are decrypted into the new SQLite image. --no-wal is available when an evidence workflow intentionally excludes WAL state.

Read and export

CLI=(python3 "$SKILL_DIR/scripts/vault_cli.py")
"${CLI[@]}" contacts --query "name"
"${CLI[@]}" sessions --limit 50
"${CLI[@]}" search "term" --chat "room" --limit 200
"${CLI[@]}" history "room or conversation_id" --start "2026-08-01" --limit 500
"${CLI[@]}" export "room" --format markdown

Pass --snapshot to pin a specific evidence version. Export refuses an existing destination. Read references/database-notes.md before adapting schemas, and references/examples.md for acceptance evidence.

Known limits

  • The supported page codec is the observed 4096-byte wxSQLite3-style AES-128 layout. Unknown headers fail closed.
  • Message text extraction handles direct UTF-8 and conservative protobuf length-delimited strings; media payloads remain labeled binary content.
  • The Frida agent intentionally avoids private, build-specific symbol offsets. The memory scanner retains one known 5.x object layout and must be revalidated after a client update.
  • Direction labels such as “me” are not inferred without a separately verified self identifier.

Operational acceptance

  • The selected dataset label, snapshot directory, manifest and query/export bounds are explicit.
  • Source database and WAL metadata remain unchanged; all generated material is owner-only and no output was overwritten.
  • Conversation resolution, time bounds, message counts and media/binary limitations are reported without exposing secrets or unrelated internal IDs.
  • Partial or unsupported results are labeled as such; a readable SQLite header alone is not claimed as a complete successful export.

Offline verification

python3 -m unittest discover -s "$SKILL_DIR/tests" -v
python3 -m py_compile "$SKILL_DIR"/scripts/*.py "$SKILL_DIR"/tests/*.py
VALIDATOR="$HOME/.codex/skills/.system/skill-creator/scripts/quick_validate.py"
python3 "$VALIDATOR" "$SKILL_DIR"

Failure and recovery

Unsupported headers, schemas, page layouts, WAL state, or memory layouts fail closed. Preserve the diagnostic and require fixture-based compatibility tests before retrying live data; never reinterpret unknown bytes as plaintext or infer that a capture timeout proves an invalid key.

04 同仓库更多 Skills

siuserxiaowei
siuserxiaowei/xiaowei-ai-tools

x-article-draft-uploader

把本地 Markdown 转为经核验的 X Articles 新草稿。适用于需要保留首图封面、正文图片相对位置,并在独立 Playwright 会话中复用用户已授权 Chrome 登录态的任务;不负责公开发布。

★ 1
siuserxiaowei
siuserxiaowei/xiaowei-ai-tools

wecom-operations

通过用户已配置的官方 wecom-cli 管理企业微信文档、智能文档、待办、会议和日程。适合创建或查询这些云端对象、把本地 Markdown 转为智能文档,以及在明确确认后更新或取消对象;不发送消息、不控制桌面客户端。

★ 1
siuserxiaowei
siuserxiaowei/xiaowei-ai-tools

wechat-reading

Read and analyze WeRead/微信读书 search results, book metadata, bookshelf entries, progress, notes, highlights, public reviews, recommendations, and reading statistics through the official read-only Agent Gateway. Use for WeRead account questions or exports; do not imply that the current Gateway can add, remove, upload, rate, like, or edit content.

★ 1
siuserxiaowei
siuserxiaowei/xiaowei-ai-tools

wechat-mp-batch-exporter

Build a bounded, private archive from known WeChat Official Account article URLs or an owner-authorized account-history export, with explicit reconciliation of article, publish-group, and platform-marked-original counts. Use for batch body capture, history normalization, or enhanced metrics/comments workflows. Do not use for a one-page summary or to automate the WeChat client.

★ 1
siuserxiaowei
siuserxiaowei/xiaowei-ai-tools

wechat-local-vault

在 macOS 本机建立并查询私有微信数据快照。适用于盘点数据库、离线校验已有密钥候选、创建全量或增量明文快照、查会话与联系人、按时间检索消息、导出指定聊天、查看朋友圈或收藏,以及准备群聊摘要素材。所有查询只读,默认隐藏内部账号标识,不操控微信界面,也不发送任何内容。

★ 1
siuserxiaowei
siuserxiaowei/xiaowei-ai-tools

web-research

Plan and route an internet-research request that spans discovery, source verification, authorized collection, archiving, and optional transcription. Use when the request crosses stages or platforms and the correct research capability is not yet clear. Route a single known action directly to its specialist Skill instead of invoking this coordinator.

★ 1