From 3e7b4ed8ee84a1e0e71f9b8a2630f8e46af4a69b Mon Sep 17 00:00:00 2001 From: jackwener Date: Thu, 16 Apr 2026 15:49:35 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=9B=AE=E5=BD=95=E5=92=8C=20pipe=20?= =?UTF-8?q?=E5=90=8D=E7=BB=9F=E4=B8=80=E6=94=B9=E4=B8=BA=20wx-cli=EF=BC=88?= =?UTF-8?q?=E5=8E=9F=20wechat-cli=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 10 +++++----- src/cli/transport.rs | 4 ++-- src/config.rs | 8 ++++---- src/daemon/server.rs | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 72df553..623a55e 100644 --- a/README.md +++ b/README.md @@ -76,8 +76,8 @@ sudo wx init `wx init` 自动完成: 1. 检测微信数据目录(`~/Library/Containers/.../xwechat_files//db_storage`) -2. 扫描微信进程内存,提取所有数据库密钥 → `~/.wechat-cli/all_keys.json` -3. 写入 `~/.wechat-cli/config.json` +2. 扫描微信进程内存,提取所有数据库密钥 → `~/.wx-cli/all_keys.json` +3. 写入 `~/.wx-cli/config.json` ### 使用 @@ -150,11 +150,11 @@ wx daemon logs --follow - **KDF**:PBKDF2-HMAC-SHA512,256,000 次迭代 - **页结构**:4096 bytes/page,reserve = 80(IV 16 + HMAC 64) -WCDB 在进程内存中缓存派生后的 raw key,格式为 `x'<64hex_enc_key><32hex_salt>'`。Rust 扫描器通过 macOS Mach VM API(`mach_vm_region` + `mach_vm_read`)或 Linux `/proc//mem` 扫描微信进程内存,匹配此模式后输出到 `~/.wechat-cli/all_keys.json`。 +WCDB 在进程内存中缓存派生后的 raw key,格式为 `x'<64hex_enc_key><32hex_salt>'`。Rust 扫描器通过 macOS Mach VM API(`mach_vm_region` + `mach_vm_read`)或 Linux `/proc//mem` 扫描微信进程内存,匹配此模式后输出到 `~/.wx-cli/all_keys.json`。 ### DBCache(mtime 感知缓存) -daemon 首次解密后将结果(及 DB/WAL 的 mtime,精度纳秒)持久化到 `~/.wechat-cli/cache/_mtimes.json`。重启时若 mtime 未变,直接复用已解密文件。 +daemon 首次解密后将结果(及 DB/WAL 的 mtime,精度纳秒)持久化到 `~/.wx-cli/cache/_mtimes.json`。重启时若 mtime 未变,直接复用已解密文件。 ### WAL 监听 @@ -163,7 +163,7 @@ daemon 每 500ms 检测 `session.db-wal` 的 mtime,有变化时重新解密并 ### 数据文件路径 ``` -~/.wechat-cli/ +~/.wx-cli/ ├── config.json # 配置(DB 目录、密钥文件路径) ├── all_keys.json # 数据库密钥 ├── daemon.sock # Unix socket diff --git a/src/cli/transport.rs b/src/cli/transport.rs index 9d94627..6afa6e6 100644 --- a/src/cli/transport.rs +++ b/src/cli/transport.rs @@ -40,7 +40,7 @@ pub fn is_alive() -> bool { #[cfg(windows)] { // 通过 named pipe 检测 - let pipe_path = r"\\.\pipe\wechat-cli-daemon"; + let pipe_path = r"\\.\pipe\wx-cli-daemon"; use std::fs::OpenOptions; OpenOptions::new().read(true).write(true).open(pipe_path).is_ok() } @@ -151,7 +151,7 @@ fn send_windows(req: Request) -> Result { use std::fs::OpenOptions; use std::os::windows::fs::OpenOptionsExt; - let pipe_path = r"\\.\pipe\wechat-cli-daemon"; + let pipe_path = r"\\.\pipe\wx-cli-daemon"; let mut pipe = OpenOptions::new() .read(true) .write(true) diff --git a/src/config.rs b/src/config.rs index 2e447a6..1fb59b6 100644 --- a/src/config.rs +++ b/src/config.rs @@ -11,7 +11,7 @@ pub struct Config { pub wechat_process: String, } -/// 从 /config.json 或 $HOME/.wechat-cli/config.json 加载配置 +/// 从 /config.json 或 $HOME/.wx-cli/config.json 加载配置 pub fn load_config() -> Result { let config_path = find_config_file()?; let content = std::fs::read_to_string(&config_path) @@ -85,9 +85,9 @@ fn find_config_file() -> Result { if cwd.exists() { return Ok(cwd); } - // 3. ~/.wechat-cli/config.json + // 3. ~/.wx-cli/config.json if let Some(home) = dirs::home_dir() { - let p = home.join(".wechat-cli").join("config.json"); + let p = home.join(".wx-cli").join("config.json"); if p.exists() { return Ok(p); } @@ -104,7 +104,7 @@ fn find_config_file() -> Result { pub fn cli_dir() -> PathBuf { dirs::home_dir() .unwrap_or_else(|| PathBuf::from("/tmp")) - .join(".wechat-cli") + .join(".wx-cli") } pub fn sock_path() -> PathBuf { diff --git a/src/daemon/server.rs b/src/daemon/server.rs index 9fa0e39..89d81f0 100644 --- a/src/daemon/server.rs +++ b/src/daemon/server.rs @@ -132,7 +132,7 @@ async fn serve_windows( tokio::prelude::*, GenericNamespaced, ListenerOptions, }; - let pipe_name = r"\\.\pipe\wechat-cli-daemon"; + let pipe_name = r"\\.\pipe\wx-cli-daemon"; let name = pipe_name.to_ns_name::()?; let opts = ListenerOptions::new().name(name); let listener = opts.create_tokio()?;