From 1680acb22c3e6b39ce196d0b8c24bbf6d9f3259c Mon Sep 17 00:00:00 2001 From: H3CoF6 Date: Tue, 17 Mar 2026 04:05:50 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E4=BF=AE=E5=A4=8D=E4=B8=80=E4=BA=9Bbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- electron/services/config.ts | 2 +- electron/services/keyServiceLinux.ts | 21 ++++++++++++++++----- src/pages/WelcomePage.tsx | 18 +++++++++++------- 3 files changed, 28 insertions(+), 13 deletions(-) diff --git a/electron/services/config.ts b/electron/services/config.ts index d783c49..141d216 100644 --- a/electron/services/config.ts +++ b/electron/services/config.ts @@ -16,7 +16,7 @@ interface ConfigSchema { imageXorKey: number imageAesKey: string wxidConfigs: Record - + exportPath?: string; // 缓存相关 cachePath: string lastOpenedDb: string diff --git a/electron/services/keyServiceLinux.ts b/electron/services/keyServiceLinux.ts index 733019c..abca0d6 100644 --- a/electron/services/keyServiceLinux.ts +++ b/electron/services/keyServiceLinux.ts @@ -74,7 +74,6 @@ export class KeyServiceLinux { public async getDbKey(pid: number): Promise { try { const helperPath = this.getHelperPath() - const { stdout: scanOut } = await execFileAsync(helperPath, ['db_scan', pid.toString()]) const scanRes = JSON.parse(scanOut.trim()) @@ -109,8 +108,13 @@ export class KeyServiceLinux { } } - public async autoGetImageKey(_accountPath: string, wxid?: string): Promise { + public async autoGetImageKey( + accountPath?: string, + onProgress?: (msg: string) => void, + wxid?: string + ): Promise { try { + if (onProgress) onProgress('正在初始化...'); const helperPath = this.getHelperPath() const { stdout } = await execFileAsync(helperPath, ['image_local']) const res = JSON.parse(stdout.trim()) @@ -121,6 +125,7 @@ export class KeyServiceLinux { if (!account && accounts.length > 0) account = accounts[0] if (account && account.keys && account.keys.length > 0) { + if (onProgress) onProgress('已找到匹配的图片密钥'); const keyObj = account.keys[0] return { success: true, xorKey: keyObj.xorKey, aesKey: keyObj.aesKey } } @@ -130,23 +135,30 @@ export class KeyServiceLinux { } } - public async autoGetImageKeyByMemoryScan(accountPath: string): Promise { + public async autoGetImageKeyByMemoryScan( + accountPath: string, + onProgress?: (msg: string) => void + ): Promise { try { + if (onProgress) onProgress('正在获取微信进程...'); const { stdout } = await execAsync('pidof wechat wechat-bin xwechat').catch(() => ({ stdout: '' })) const pids = stdout.trim().split(/\s+/).filter(p => p) if (pids.length === 0) return { success: false, error: '微信未运行,无法扫描内存' } const pid = parseInt(pids[0], 10) + if (onProgress) onProgress('正在提取图片特征码...'); const ciphertextHex = this.findAnyDatCiphertext(accountPath) if (!ciphertextHex) { - return { success: false, error: '未在 FileStorage/Image 中找到 .dat 图片,请在微信中随便点开一张大图后重试' } + return { success: false, error: '未在 FileStorage/Image 找到缓存图片,请在微信中随便点开一张大图后重试' } } + if (onProgress) onProgress('正在提权扫描进程内存...'); const helperPath = this.getHelperPath() const { stdout: memOut } = await execFileAsync(helperPath, ['image_mem', pid.toString(), ciphertextHex]) const res = JSON.parse(memOut.trim()) if (res.success) { + if (onProgress) onProgress('内存扫描成功'); return { success: true, aesKey: res.key } } return { success: false, error: res.result } @@ -154,7 +166,6 @@ export class KeyServiceLinux { return { success: false, error: err.message } } } - private findAnyDatCiphertext(accountPath: string): string | null { try { const imgDir = join(accountPath, 'FileStorage', 'Image') diff --git a/src/pages/WelcomePage.tsx b/src/pages/WelcomePage.tsx index 9b44fae..5331e36 100644 --- a/src/pages/WelcomePage.tsx +++ b/src/pages/WelcomePage.tsx @@ -647,7 +647,7 @@ function WelcomePage({ standalone = false }: WelcomePageProps) { setDbPath(e.target.value)} /> @@ -898,13 +898,17 @@ function WelcomePage({ standalone = false }: WelcomePageProps) { setShowDbKeyConfirm(false)} +【⚠️ Linux 用户特别注意】 +如果您在微信里勾选了“自动登录”,请务必先打开微信设置 取消勾选自动登录,然后再点击下方确认! +(因为授权弹窗输入密码需要时间,若自动登录太快,会导致获取密钥失败并卡死微信) + +当 WeFlow 内的提示条变为绿色显示“允许登录”或看到来自 WeFlow 的登录通知时,请在手机上确认登录微信。`} + onConfirm={handleDbKeyConfirm} + onCancel={() => setShowDbKeyConfirm(false)} />