mirror of https://github.com/jackwener/wx-cli.git
fix: 目录和 pipe 名统一改为 wx-cli(原 wechat-cli)
parent
6e599dbe33
commit
3e7b4ed8ee
10
README.md
10
README.md
|
|
@ -76,8 +76,8 @@ sudo wx init
|
||||||
|
|
||||||
`wx init` 自动完成:
|
`wx init` 自动完成:
|
||||||
1. 检测微信数据目录(`~/Library/Containers/.../xwechat_files/<wxid>/db_storage`)
|
1. 检测微信数据目录(`~/Library/Containers/.../xwechat_files/<wxid>/db_storage`)
|
||||||
2. 扫描微信进程内存,提取所有数据库密钥 → `~/.wechat-cli/all_keys.json`
|
2. 扫描微信进程内存,提取所有数据库密钥 → `~/.wx-cli/all_keys.json`
|
||||||
3. 写入 `~/.wechat-cli/config.json`
|
3. 写入 `~/.wx-cli/config.json`
|
||||||
|
|
||||||
### 使用
|
### 使用
|
||||||
|
|
||||||
|
|
@ -150,11 +150,11 @@ wx daemon logs --follow
|
||||||
- **KDF**:PBKDF2-HMAC-SHA512,256,000 次迭代
|
- **KDF**:PBKDF2-HMAC-SHA512,256,000 次迭代
|
||||||
- **页结构**:4096 bytes/page,reserve = 80(IV 16 + HMAC 64)
|
- **页结构**: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 感知缓存)
|
### DBCache(mtime 感知缓存)
|
||||||
|
|
||||||
daemon 首次解密后将结果(及 DB/WAL 的 mtime,精度纳秒)持久化到 `~/.wechat-cli/cache/_mtimes.json`。重启时若 mtime 未变,直接复用已解密文件。
|
daemon 首次解密后将结果(及 DB/WAL 的 mtime,精度纳秒)持久化到 `~/.wx-cli/cache/_mtimes.json`。重启时若 mtime 未变,直接复用已解密文件。
|
||||||
|
|
||||||
### WAL 监听
|
### WAL 监听
|
||||||
|
|
||||||
|
|
@ -163,7 +163,7 @@ daemon 每 500ms 检测 `session.db-wal` 的 mtime,有变化时重新解密并
|
||||||
### 数据文件路径
|
### 数据文件路径
|
||||||
|
|
||||||
```
|
```
|
||||||
~/.wechat-cli/
|
~/.wx-cli/
|
||||||
├── config.json # 配置(DB 目录、密钥文件路径)
|
├── config.json # 配置(DB 目录、密钥文件路径)
|
||||||
├── all_keys.json # 数据库密钥
|
├── all_keys.json # 数据库密钥
|
||||||
├── daemon.sock # Unix socket
|
├── daemon.sock # Unix socket
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ pub fn is_alive() -> bool {
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
{
|
{
|
||||||
// 通过 named pipe 检测
|
// 通过 named pipe 检测
|
||||||
let pipe_path = r"\\.\pipe\wechat-cli-daemon";
|
let pipe_path = r"\\.\pipe\wx-cli-daemon";
|
||||||
use std::fs::OpenOptions;
|
use std::fs::OpenOptions;
|
||||||
OpenOptions::new().read(true).write(true).open(pipe_path).is_ok()
|
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::fs::OpenOptions;
|
||||||
use std::os::windows::fs::OpenOptionsExt;
|
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()
|
let mut pipe = OpenOptions::new()
|
||||||
.read(true)
|
.read(true)
|
||||||
.write(true)
|
.write(true)
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ pub struct Config {
|
||||||
pub wechat_process: String,
|
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> {
|
pub fn load_config() -> Result<Config> {
|
||||||
let config_path = find_config_file()?;
|
let config_path = find_config_file()?;
|
||||||
let content = std::fs::read_to_string(&config_path)
|
let content = std::fs::read_to_string(&config_path)
|
||||||
|
|
@ -85,9 +85,9 @@ fn find_config_file() -> Result<PathBuf> {
|
||||||
if cwd.exists() {
|
if cwd.exists() {
|
||||||
return Ok(cwd);
|
return Ok(cwd);
|
||||||
}
|
}
|
||||||
// 3. ~/.wechat-cli/config.json
|
// 3. ~/.wx-cli/config.json
|
||||||
if let Some(home) = dirs::home_dir() {
|
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() {
|
if p.exists() {
|
||||||
return Ok(p);
|
return Ok(p);
|
||||||
}
|
}
|
||||||
|
|
@ -104,7 +104,7 @@ fn find_config_file() -> Result<PathBuf> {
|
||||||
pub fn cli_dir() -> PathBuf {
|
pub fn cli_dir() -> PathBuf {
|
||||||
dirs::home_dir()
|
dirs::home_dir()
|
||||||
.unwrap_or_else(|| PathBuf::from("/tmp"))
|
.unwrap_or_else(|| PathBuf::from("/tmp"))
|
||||||
.join(".wechat-cli")
|
.join(".wx-cli")
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn sock_path() -> PathBuf {
|
pub fn sock_path() -> PathBuf {
|
||||||
|
|
|
||||||
|
|
@ -132,7 +132,7 @@ async fn serve_windows(
|
||||||
tokio::prelude::*, GenericNamespaced, ListenerOptions,
|
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 name = pipe_name.to_ns_name::<GenericNamespaced>()?;
|
||||||
let opts = ListenerOptions::new().name(name);
|
let opts = ListenerOptions::new().name(name);
|
||||||
let listener = opts.create_tokio()?;
|
let listener = opts.create_tokio()?;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue