Skip to content
Back to search

wx-favorites-report

微信收藏可视化:从加密的微信本地数据库端到端解密、解析,生成交互式 HTML 可视化报告。 触发词:/wx-favorites-report、微信收藏可视化、收藏报告、收藏分析 支持输入:加密/解密后的 Favorite.db(SQLite)或 CSV/JSON 导出文件

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today

Check it deeper on your machine

It has changed since its scan on 11 Nov 2026.

As a Claude Code plugin, install it and then ask Claude Code:

/plugin marketplace add keithmackay/mackayi/plugin install scanskillsafety@mackayiDo a deep scan of https://github.com/zhuyansen/wx-favorites-report with scanskillsafety

Or from a terminal, clone it and run it:

git clone https://github.com/keithmackay/scanskillsafety-skill ~/.claude/skills/scanskillsafetynode ~/.claude/skills/scanskillsafety/cli.cjs --deep 'https://github.com/zhuyansen/wx-favorites-report'

It checks the exact commit: every file, its packages against OSV (api.osv.dev), how it compares with this page's scan (findsafeskills.com receives the repository's address), and, if you agree, Claude reading every file with your own Claude subscription. It never runs the code.

Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/zhuyansen-wx-favorites-report/badge.svg)](/listings/zhuyansen-wx-favorites-report)

HTML

<a href="/listings/zhuyansen-wx-favorites-report"><img src="/api/listings/zhuyansen-wx-favorites-report/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

SKILL.md · Manifest · 189 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

This file has changed since it was scanned, so this is not exactly the text that was scanned, and no line is marked. The findings are listed with the safety scan above.

  1. ---
  2. name: wx-favorites-report
  3. description: |
  4. 微信收藏可视化:从加密的微信本地数据库端到端解密、解析,生成交互式 HTML 可视化报告。
  5. 触发词:/wx-favorites-report、微信收藏可视化、收藏报告、收藏分析
  6. 支持输入:加密/解密后的 Favorite.db(SQLite)或 CSV/JSON 导出文件
  7. ---
  8. # 微信收藏可视化 Skill
  9. 将微信收藏数据(加密 Favorite.db)端到端解密、解析、生成交互式 HTML 可视化报告。
  10. ## 执行流程
  11. ### Step 1: 确认数据源
  12. 询问用户是否已有解密后的 Favorite.db。
  13. - **已有解密 DB** → 跳到 Step 3
  14. - **未解密** → 进入 Step 2 密钥提取 + 解密
  15. ### Step 2: 密钥提取与数据库解密(macOS)
  16. #### 2a. 准备签名副本
  17. ```bash
  18. # 复制微信到桌面并去掉 Hardened Runtime
  19. cp -R /Applications/WeChat.app ~/Desktop/WeChat.app
  20. codesign --force --deep --sign - ~/Desktop/WeChat.app
  21. ```
  22. #### 2b. 安装 frida
  23. ```bash
  24. pip3 install frida frida-tools
  25. ```
  26. #### 2c. 提取密钥
  27. ```bash
  28. # 关闭原版微信,从桌面副本启动
  29. killall WeChat 2>/dev/null; sleep 2
  30. # 用 frida spawn 模式启动微信并 hook PBKDF2
  31. PYTHONPATH=$(python3 -c "import site; print(site.getusersitepackages())") python3 << 'PYEOF'
  32. import frida, time
  33. JS_CODE = """
  34. function buf2hex(buffer) {
  35. var a = new Uint8Array(buffer); var h = '';
  36. for (var i = 0; i < a.length; i++) h += ('0' + a[i].toString(16)).slice(-2);
  37. return h;
  38. }
  39. var found = false;
  40. Process.enumerateModules().forEach(function(m) {
  41. if (found) return;
  42. m.enumerateExports().forEach(function(exp) {
  43. if (found) return;
  44. if (exp.name === "CCKeyDerivationPBKDF") {
  45. found = true;
  46. send("[*] Hook installed on " + m.name);
  47. Interceptor.attach(exp.address, {
  48. onEnter: function(args) {
  49. this.pwLen = args[2].toInt32();
  50. this.saltLen = args[4].toInt32();
  51. this.rounds = args[6].toInt32();
  52. this.pw = args[1]; this.salt = args[3];
  53. this.dk = args[7]; this.dkLen = args[8].toInt32();
  54. },
  55. onLeave: function(retval) {
  56. if (this.pwLen < 4 || this.pwLen > 256) return;
  57. if (this.saltLen < 4 || this.saltLen > 64) return;
  58. var saltHex = buf2hex(this.salt.readByteArray(this.saltLen));
  59. var dkHex = buf2hex(this.dk.readByteArray(this.dkLen));
  60. var pwHex = buf2hex(this.pw.readByteArray(this.pwLen));
  61. send("[PBKDF2] r=" + this.rounds + " salt=" + saltHex);
  62. var f = new File("/tmp/wechat_frida_keys.log", "a");
  63. f.write("rounds=" + this.rounds + "\\npw=" + pwHex + "\\nsalt=" + saltHex + "\\ndk=" + dkHex + "\\n\\n");
  64. f.flush(); f.close();
  65. }
  66. });
  67. }
  68. });
  69. });
  70. if (!found) send("[!] CCKeyDerivationPBKDF not found");
  71. """
  72. device = frida.get_local_device()
  73. pid = device.spawn(["/Users/" + __import__('os').getenv('USER') + "/Desktop/WeChat.app/Contents/MacOS/WeChat"])
  74. session = device.attach(pid)
  75. script = session.create_script(JS_CODE)
  76. script.on("message", lambda msg, data: print(msg.get("payload", msg)))
  77. script.load()
  78. device.resume(pid)
  79. print("WeChat running. Login → open Favorites → wait 60s...")
  80. time.sleep(120)
  81. session.detach()
  82. print("Done. Check /tmp/wechat_frida_keys.log")
  83. PYEOF
  84. ```
  85. **重要**:微信启动后必须登录并打开「收藏」页面,触发 favorite.db 的密钥加载。
  86. #### 2d. 匹配密钥并解密
  87. 解析 frida 日志,找到 favorite.db 对应的 enc_key(通过 salt 匹配),然后用 Python 解密:
  88. ```python
  89. # 核心解密逻辑(内置在 parse_favorites.py 的上游)
  90. import hashlib, hmac, struct
  91. from Crypto.Cipher import AES
  92. # enc_key = 从 frida 日志中 256000 轮 PBKDF2 输出匹配 DB salt 的 dk
  93. # 逐页 AES-256-CBC 解密,HMAC-SHA512 校验
  94. ```
  95. 安装依赖:`pip3 install pycryptodome`
  96. ### Step 3: 解析数据
  97. ```bash
  98. python3 ~/.claude/skills/wechat-favorites-viz/scripts/parse_favorites.py \
  99. --input "<解密后的 favorite.db 路径>" \
  100. --output "<输出目录>/data.json"
  101. ```
  102. 兼容 WeChat 3.x (FavItems) 和 4.x (fav_db_item) 表结构。
  103. ### Step 4: 生成可视化报告
  104. ```bash
  105. python3 ~/.claude/skills/wechat-favorites-viz/scripts/generate_report.py \
  106. --input "<输出目录>/data.json" \
  107. --output "<输出目录>/report.html"
  108. ```
  109. ### Step 5: 预览
  110. ```bash
  111. # 推荐用 http server(file:// 下部分交互可能受限)
  112. cd <输出目录> && python3 -m http.server 8765 &
  113. open http://localhost:8765/report.html
  114. ```
  115. ## 报告功能
  116. | 区域 | 内容 |
  117. |------|------|
  118. | 统计卡片 | 总数、时间跨度、日均收藏、最忙日 |
  119. | 亮点发现 | 最爱来源、主力类型 |
  120. | 月度趋势 | 折线 + 面积图 |
  121. | 类型分布 | 甜甜圈图 |
  122. | 来源 Top15 | 水平柱状图 |
  123. | 活跃热力图 | 星期 × 小时 |
  124. | 时段分布 | 小时 / 星期柱状图 |
  125. | 词云 | 标题 + 描述提取 |
  126. | 标签云 | 微信收藏标签 |
  127. | **收藏浏览** | 按类型筛选 + 按标签筛选 + 搜索 + 排序 + 分页 |
  128. | **详情弹窗** | 点击卡片展开完整内容、链接、来源、标签 |
  129. ## 收藏类型
  130. | Type | 含义 | 解析字段 |
  131. |------|------|----------|
  132. | 1 | 文本 | desc |
  133. | 2 | 图片 | datafmt + fullsize |
  134. | 4 | 视频 | datatitle + datadesc |
  135. | 5 | 文章/链接 | pagetitle + pagedesc + link + pagethumb_url |
  136. | 8 | 文件 | datatitle + datafmt + fullsize |
  137. | 14 | 聊天记录 | datalist → 逐条 datadesc 拼接 |
  138. | 其他 | 位置/笔记/小程序等 | 通用 title + desc 回退 |
  139. ## 技术依赖
  140. - Python 3.9+ 标准库(sqlite3, json, re, html, collections, datetime)
  141. - PyCryptodome(仅解密步骤需要:`pip3 install pycryptodome`)
  142. - frida(仅密钥提取步骤需要:`pip3 install frida frida-tools`)
  143. - ECharts 5.x + echarts-wordcloud 2.x(CDN 内联,无需安装)
  144. ## 输出文件
  145. ```
  146. <输出目录>/
  147. ├── data.json # 解析后的结构化数据
  148. └── report.html # 单文件可视化报告(可直接分享)
  149. ```
  150. ## 已知限制
  151. - 图片/视频/文件的原始内容存储在微信 CDN(加密内部格式),本地缓存也加密,无法在报告中直接预览
  152. - 文章缩略图来自微信公众号 CDN,需联网加载
  153. - 密钥提取需要 macOS,frida 需要 ad-hoc 签名的微信副本
README.md · README · 171 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

This file has changed since it was scanned, so this is not exactly the text that was scanned, and no line is marked. The findings are listed with the safety scan above.

  1. # 微信收藏可视化 (wechat-favorites-viz)
  2. 从加密的微信 Mac 本地数据库中提取收藏数据,生成交互式可视化 HTML 报告。
  3. [![Security-graded by Agent Skills Hub](https://agentskillshub.top/badge/zhuyansen/wx-favorites-report.svg)](https://agentskillshub.top/skill/zhuyansen/wx-favorites-report/)
  4. ## 效果预览
  5. 报告包含:统计仪表盘、月度趋势、类型分布、来源排行、活跃热力图、词云、标签云,以及可按类型/标签筛选的收藏浏览区。
  6. > 截图请打开 `report.html` 后自行截取(数据含个人信息,不宜公开分享截图)
  7. ## 快速开始(macOS)
  8. ### 前置条件
  9. - macOS (Apple Silicon 或 Intel)
  10. - 微信 Mac 4.x 已登录
  11. - Python 3.9+
  12. - Claude Code(推荐,自动执行全流程)
  13. ### 方式一:用 Claude Code 一键执行
  14. ```bash
  15. # 在 Claude Code 中说:
  16. 微信收藏可视化
  17. ```
  18. Claude 会自动完成密钥提取、解密、解析、报告生成全流程。
  19. ### 方式二:手动分步执行
  20. #### Step 1: 安装依赖
  21. ```bash
  22. pip3 install frida frida-tools pycryptodome
  23. ```
  24. #### Step 2: 准备签名副本
  25. 微信 App Store 版有 Hardened Runtime 保护,需要复制一份去掉签名限制:
  26. ```bash
  27. cp -R /Applications/WeChat.app ~/Desktop/WeChat.app
  28. codesign --force --deep --sign - ~/Desktop/WeChat.app
  29. ```
  30. #### Step 3: 提取加密密钥
  31. 关闭当前微信,用 frida 启动桌面版微信:
  32. ```bash
  33. killall WeChat 2>/dev/null; sleep 2
  34. # 运行 frida hook 脚本(见 SKILL.md 中完整代码)
  35. # 微信启动后:登录 → 打开「收藏」页面 → 等待 60 秒
  36. ```
  37. frida 会 hook `CCKeyDerivationPBKDF` 函数,捕获所有 PBKDF2 密钥派生调用。
  38. 输出文件:`/tmp/wechat_frida_keys.log`
  39. #### Step 4: 解密数据库
  40. 从 frida 日志中找到 favorite.db 对应的 enc_key(通过 salt 匹配),用 Python 解密:
  41. ```python
  42. # favorite.db 路径:
  43. # ~/Library/Containers/com.tencent.xinWeChat/Data/Documents/
  44. # xwechat_files/<wxid>/db_storage/favorite/favorite.db
  45. # 解密参数: SQLCipher 4
  46. # AES-256-CBC, HMAC-SHA512, PBKDF2 256000 轮, page_size=4096, reserve=80
  47. ```
  48. #### Step 5: 生成报告
  49. ```bash
  50. # 解析数据
  51. python3 parse_favorites.py --input favorite_decrypted.db --output data.json
  52. # 生成 HTML 报告
  53. python3 generate_report.py --input data.json --output report.html
  54. # 打开(推荐用 http server)
  55. cd <输出目录> && python3 -m http.server 8765
  56. open http://localhost:8765/report.html
  57. ```
  58. ## 踩坑记录
  59. 在实现过程中经历了 6 轮迭代,以下是关键经验:
  60. ### 密钥提取(最难的部分)
  61. | 尝试 | 方法 | 结果 | 原因 |
  62. |------|------|------|------|
  63. | 1 | C 内存扫描 x'hex' 格式 | 0 keys | WeChat 4.x 不用此格式存密钥 |
  64. | 2 | 搜索原始 salt 字节 | 误匹配 | 匹配到 ASCII 字符串不是真密钥 |
  65. | 3 | HMAC 暴力验证 (8B对齐) | 未找到 | 过滤条件跳过了真正位置 |
  66. | 4 | 无过滤暴力 (4B对齐) | 未找到 | 密钥经 PBKDF2 派生后存储,不是原始 enc_key |
  67. | 5 | DYLD hook / lldb | 被阻止 | macOS SIP + Hardened Runtime |
  68. | **6** | **frida + CCKeyDerivationPBKDF** | **成功** | hook 系统 PBKDF2 函数捕获派生过程 |
  69. ### 关键踩坑
  70. **坑 1: SIP 阻止签名 /Applications 下的微信**
  71. 复制到 ~/Desktop 再签名。
  72. **坑 2: sudo 启动微信导致数据目录变成 /var/root**
  73. 不用 sudo,以普通用户身份运行 frida。
  74. **坑 3: favorite.db 密钥在启动时不加载**
  75. 微信只在用户打开「收藏」页面时才加载 favorite.db。frida 运行期间必须手动打开收藏。
  76. **坑 4: WeChat 4.x 表结构变化**
  77. 3.x 用 `FavItems` + `FavDataItem`,4.x 改为 `fav_db_item` 单表,content 是 XML。
  78. **坑 5: XML 字段名不统一**
  79. 文章标题在 `<pagetitle>` 不是 `<title>`,聊天记录在 `<datalist><dataitem><datadesc>`,视频标题在 `<dataitem>` 内部的 `<datatitle>`。
  80. **坑 6: JS 引号嵌套**
  81. `onerror="this.style.display='none'"` 在 Python f-string + JS 模板字符串中会导致语法错误。用 `&quot;` 替代。
  82. **坑 7: file:// 协议下 onclick 不工作**
  83. 改用 event delegation(addEventListener on parent element)。
  84. **坑 8: ECharts 图表间距**
  85. 图表容器需要明确的 height,否则部分区域渲染为空白。
  86. ## 项目结构
  87. ```
  88. ~/.claude/skills/wechat-favorites-viz/
  89. ├── SKILL.md # Skill 定义(触发词、流程、参数)
  90. └── scripts/
  91. ├── parse_favorites.py # 解析器(SQLite/CSV/JSON → 统一 JSON)
  92. ├── generate_report.py # 报告生成器(JSON → 单文件 HTML)
  93. └── demo_data.py # 模拟数据生成(测试用)
  94. ```
  95. ## 报告功能一览
  96. - 统计卡片:总数、跨越天数、日均、来源数
  97. - 亮点发现:最忙日、最爱来源、主力类型
  98. - 月度趋势:折线 + 面积图
  99. - 内容类型分布:甜甜圈图
  100. - 来源 Top 15:水平柱状图
  101. - 活跃热力图:星期 x 小时
  102. - 时段分布:小时柱状图、星期柱状图
  103. - 词云:从标题 + 描述提取关键词
  104. - 标签云:微信收藏标签
  105. - 收藏浏览:按类型筛选 + 按标签筛选 + 全文搜索 + 排序 + 分页
  106. - 详情弹窗:点击卡片查看完整内容、原文链接、来源、标签
  107. ## 已知限制
  108. - 图片/视频/文件原始内容存在微信 CDN(加密格式),无法在报告中预览
  109. - 文章缩略图来自微信公众号 CDN,需联网
  110. - 密钥提取仅支持 macOS,需要 frida
  111. - 每次微信更新后需要重新签名桌面副本
  112. ## 技术栈
  113. | 组件 | 技术 |
  114. |------|------|
  115. | 密钥提取 | frida 17.x, CCKeyDerivationPBKDF hook |
  116. | 数据库解密 | PyCryptodome AES-256-CBC, HMAC-SHA512 |
  117. | 数据解析 | Python sqlite3 + regex XML |
  118. | 可视化 | ECharts 5.x CDN, echarts-wordcloud 2.x |
  119. | 报告格式 | 单文件 HTML,暗色主题,内联所有依赖 |

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.