From 9764385617425c828efd3108414f4ec35e0f9ddc Mon Sep 17 00:00:00 2001 From: Belugary <53219544+Belugary@users.noreply.github.com> Date: Tue, 5 May 2026 22:48:05 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20decrypt=5Fdb=20SKIP=20=E4=B8=8E=E5=A4=B1?= =?UTF-8?q?=E8=B4=A5=E5=88=86=E5=BC=80=E8=AE=A1=E6=95=B0,=20=E4=B8=8D?= =?UTF-8?q?=E6=8A=8A=E6=97=A0=E5=AF=86=E9=92=A5=E8=AF=AF=E6=8A=A5=E4=B8=BA?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5=20(#72)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit decrypt_db 在遍历 .db 时, 遇到没匹配 key 的 db (e.g. migrate/ unspportmsg.db 这种迁移残留 / 微信内部不加密的库) print "SKIP: xxx (无密钥)" 后会 failed += 1, summary 里就把这类合理跳过的 db 报成 "失败"。用户每次跑完都得 grep 一下确认那 N 个失败到底是真问题还是 SKIP 噪音。 参照 pytest (passed/failed/skipped) / rsync 的标准做法, SKIP 单独 计数, 不进 failed: - 加 skipped 计数器 - SKIP 分支走 skipped += 1 (其余 HMAC / SQLite 校验失败仍记 failed) - summary 多显示一栏 "K 跳过(无密钥)" 只动这 3 处; main() 末尾本来就没基于 failed 设 exit code, 不影响 退出码语义。 Co-authored-by: Claude Opus 4.7 (1M context) --- decrypt_db.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/decrypt_db.py b/decrypt_db.py index ec1aad8..e952141 100644 --- a/decrypt_db.py +++ b/decrypt_db.py @@ -140,13 +140,14 @@ def main(): success = 0 failed = 0 + skipped = 0 total_bytes = 0 for rel, path, sz in db_files: key_info = get_key_info(keys, rel) if not key_info: print(f"SKIP: {rel} (无密钥)") - failed += 1 + skipped += 1 continue enc_key = bytes.fromhex(key_info["enc_key"]) @@ -176,7 +177,7 @@ def main(): failed += 1 print(f"\n{'='*60}") - print(f"结果: {success} 成功, {failed} 失败, 共 {len(db_files)} 个") + print(f"结果: {success} 成功, {failed} 失败, {skipped} 跳过(无密钥), 共 {len(db_files)} 个") print(f"解密数据量: {total_bytes/1024/1024/1024:.1f}GB") print(f"解密文件在: {OUT_DIR}")