From d7f6f4885076062ef2f24414bc1c2ee22113b5ec Mon Sep 17 00:00:00 2001 From: REinject <22788893+0xlane@users.noreply.github.com> Date: Thu, 5 Dec 2024 11:00:01 +0800 Subject: [PATCH] Print more informations. --- Cargo.toml | 2 +- src/main.rs | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 8e0a8e2..8a00dd5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "wechat-dump-rs" -version = "1.0.21" +version = "1.0.22" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html diff --git a/src/main.rs b/src/main.rs index 9ab1201..ed37693 100644 --- a/src/main.rs +++ b/src/main.rs @@ -195,7 +195,7 @@ fn read_string(pid: u32, addr: usize, size: usize) -> Result { }; if buf_str.len() != size { - Err(anyhow::anyhow!("invalid utf8 string")) + Err(anyhow::anyhow!(format!("except {} characters, but found: {} --> {}", size, buf_str.len(), buf_str))) } else { Ok(buf_str) } @@ -205,9 +205,9 @@ fn read_string(pid: u32, addr: usize, size: usize) -> Result { fn read_string_or_ptr(pid: u32, addr: usize, size: usize) -> Result { match read_string(pid, addr, size) { Ok(ss) => Ok(ss), - Err(_) => { + Err(e) => { let str_ptr = read_number::(pid, addr)?; - Ok(read_string(pid, str_ptr, size)?) + Ok(read_string(pid, str_ptr, size).map_err(|_| e)?) } } } @@ -529,6 +529,7 @@ fn dump_wechat_info_v4( let nick_name_length = u64::from_le_bytes(phone_str_match.data[..8].try_into().unwrap()); let phone_str_address = phone_str_match.base + phone_str_match.offset + 0x10; let phone_str = read_string(pid, phone_str_address, 11).unwrap(); + println!("[+] found phone at 0x{:x} --> {}********", phone_str_address, &phone_str[..3]); let nick_name = read_string_or_ptr(pid, phone_str_address - 0x20, nick_name_length as usize).unwrap(); @@ -1076,7 +1077,7 @@ fn cli() -> clap::Command { use clap::{arg, value_parser, Command}; Command::new("wechat-dump-rs") - .version("1.0.21") + .version("1.0.22") .about("A wechat db dump tool") .author("REinject") .help_template("{name} ({version}) - {author}\n{about}\n{all-args}")