fix: 目录和 pipe 名统一改为 wx-cli(原 wechat-cli)

This commit is contained in:
jackwener
2026-04-16 15:49:35 +08:00
parent 6e599dbe33
commit 3e7b4ed8ee
4 changed files with 12 additions and 12 deletions
+5 -5
View File
@@ -76,8 +76,8 @@ sudo wx init
`wx init` 自动完成:
1. 检测微信数据目录(`~/Library/Containers/.../xwechat_files/<wxid>/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/<pid>/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/<pid>/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
+2 -2
View File
@@ -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<Response> {
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)
+4 -4
View File
@@ -11,7 +11,7 @@ pub struct Config {
pub wechat_process: String,
}
/// 从 <exe_dir>/config.json 或 $HOME/.wechat-cli/config.json 加载配置
/// 从 <exe_dir>/config.json 或 $HOME/.wx-cli/config.json 加载配置
pub fn load_config() -> Result<Config> {
let config_path = find_config_file()?;
let content = std::fs::read_to_string(&config_path)
@@ -85,9 +85,9 @@ fn find_config_file() -> Result<PathBuf> {
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<PathBuf> {
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 {
+1 -1
View File
@@ -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::<GenericNamespaced>()?;
let opts = ListenerOptions::new().name(name);
let listener = opts.create_tokio()?;