From 0987167c4a7bab2563cbbe937cbfb805211d2148 Mon Sep 17 00:00:00 2001 From: 2977094657 <2977094657@qq.com> Date: Thu, 23 Apr 2026 21:32:02 +0800 Subject: [PATCH] =?UTF-8?q?fix(key):=20=E6=94=AF=E6=8C=81=E6=89=8B?= =?UTF-8?q?=E5=8A=A8=E6=8C=87=E5=AE=9A=E5=BE=AE=E4=BF=A1=E5=AE=89=E8=A3=85?= =?UTF-8?q?=E7=9B=AE=E5=BD=95=E5=B9=B6=E6=A0=A1=E9=AA=8C=20db=20key=20?= =?UTF-8?q?=E6=9D=A5=E6=BA=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - /api/get_keys 支持传入 wechat_install_path,兼容安装目录与 Weixin.exe / WeChat.exe - 解密完成后保存 db key 的来源路径与别名,避免历史密钥被错误账号复用 - 解密页按 account + db_storage_path 回填已保存密钥,并补充相关测试覆盖 --- frontend/composables/useApi.js | 8 +- frontend/lib/wechat-install-path.js | 24 +++ frontend/pages/decrypt.vue | 25 ++- frontend/pages/detection-result.vue | 76 ++++++++ src/wechat_decrypt_tool/key_service.py | 97 ++++++++-- src/wechat_decrypt_tool/key_store.py | 49 +++++- src/wechat_decrypt_tool/routers/decrypt.py | 42 ++++- src/wechat_decrypt_tool/routers/keys.py | 166 +++++++++++++++++- src/wechat_decrypt_tool/wechat_decrypt.py | 2 + tests/test_decrypt_stream_sse.py | 95 +++++----- ..._key_service_manual_wechat_install_path.py | 115 ++++++++++++ ...est_keys_saved_db_key_source_validation.py | 107 +++++++++++ 12 files changed, 729 insertions(+), 77 deletions(-) create mode 100644 frontend/lib/wechat-install-path.js create mode 100644 tests/test_key_service_manual_wechat_install_path.py create mode 100644 tests/test_keys_saved_db_key_source_validation.py diff --git a/frontend/composables/useApi.js b/frontend/composables/useApi.js index fd0c747..87a7798 100644 --- a/frontend/composables/useApi.js +++ b/frontend/composables/useApi.js @@ -397,6 +397,7 @@ export const useApi = () => { const getSavedKeys = async (params = {}) => { const query = new URLSearchParams() if (params && params.account) query.set('account', params.account) + if (params && params.db_storage_path) query.set('db_storage_path', params.db_storage_path) const url = '/keys' + (query.toString() ? `?${query.toString()}` : '') return await request(url) } @@ -547,8 +548,11 @@ export const useApi = () => { } // 获取数据库密钥 - const getKeys = async () => { - return await request('/get_keys') + const getKeys = async (params = {}) => { + const query = new URLSearchParams() + if (params && params.wechat_install_path) query.set('wechat_install_path', params.wechat_install_path) + const url = '/get_keys' + (query.toString() ? `?${query.toString()}` : '') + return await request(url) } // 获取图片密钥 diff --git a/frontend/lib/wechat-install-path.js b/frontend/lib/wechat-install-path.js new file mode 100644 index 0000000..8d13b97 --- /dev/null +++ b/frontend/lib/wechat-install-path.js @@ -0,0 +1,24 @@ +export const WECHAT_INSTALL_PATH_STORAGE_KEY = 'decrypt.wechatInstallPath' + +export const normalizeWechatInstallPath = (value) => String(value || '').trim() + +export const readStoredWechatInstallPath = () => { + if (!process.client || typeof window === 'undefined') return '' + try { + return normalizeWechatInstallPath(window.localStorage.getItem(WECHAT_INSTALL_PATH_STORAGE_KEY) || '') + } catch { + return '' + } +} + +export const writeStoredWechatInstallPath = (value) => { + if (!process.client || typeof window === 'undefined') return + try { + const normalized = normalizeWechatInstallPath(value) + if (normalized) { + window.localStorage.setItem(WECHAT_INSTALL_PATH_STORAGE_KEY, normalized) + } else { + window.localStorage.removeItem(WECHAT_INSTALL_PATH_STORAGE_KEY) + } + } catch {} +} diff --git a/frontend/pages/decrypt.vue b/frontend/pages/decrypt.vue index 3502c4a..c4521f3 100644 --- a/frontend/pages/decrypt.vue +++ b/frontend/pages/decrypt.vue @@ -73,6 +73,12 @@ 点击按钮将自动获取【数据库解密密钥】。您也可以手动输入已知的64位密钥。

+

+ + + + 当前将使用第一步检测时保存的微信安装目录:{{ formData.wechat_install_path }} +

@@ -655,6 +661,7 @@