fix: handle exited PIDs and narrow message DB keys

feat/daemon-cli
PeanutSplash 2026-03-06 16:15:17 +08:00 committed by ylytdeng
parent f9c338b48d
commit 872e3f58dc
2 changed files with 26 additions and 21 deletions

View File

@ -146,6 +146,9 @@ def main():
except PermissionError:
print(f"[WARN] 无法读取 /proc/{pid}/maps权限不足跳过")
continue
except (FileNotFoundError, ProcessLookupError):
print(f"[WARN] PID {pid} 已退出,跳过")
continue
total_bytes = sum(s for _, s in regions)
total_mb = total_bytes / 1024 / 1024
@ -157,6 +160,9 @@ def main():
except PermissionError:
print(f"[WARN] 无法打开 /proc/{pid}/mem权限不足跳过")
continue
except (FileNotFoundError, ProcessLookupError):
print(f"[WARN] PID {pid} 已退出,跳过")
continue
try:
for reg_idx, (base, size) in enumerate(regions):

View File

@ -5,7 +5,7 @@ Based on FastMCP (stdio transport), reuses existing decryption.
Runs on Windows Python (needs access to D:\ WeChat databases).
"""
import os, sys, json, time, sqlite3, tempfile, struct, hashlib, atexit
import os, sys, json, time, sqlite3, tempfile, struct, hashlib, atexit, re
import hmac as hmac_mod
from datetime import datetime
from Crypto.Cipher import AES
@ -335,8 +335,7 @@ def _parse_message_content(content, local_type, is_group):
MSG_DB_KEYS = sorted([
k for k in ALL_KEYS
if any(v.startswith("message/") for v in key_path_variants(k))
and any(v.endswith(".db") for v in key_path_variants(k))
and "fts" not in k and "resource" not in k
and any(re.search(r"message_\d+\.db$", v) for v in key_path_variants(k))
])