Skip to content

Commit d7f6f48

Browse files
committed
Print more informations.
1 parent 9959cc0 commit d7f6f48

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "wechat-dump-rs"
3-
version = "1.0.21"
3+
version = "1.0.22"
44
edition = "2021"
55

66
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

src/main.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ fn read_string(pid: u32, addr: usize, size: usize) -> Result<String> {
195195
};
196196

197197
if buf_str.len() != size {
198-
Err(anyhow::anyhow!("invalid utf8 string"))
198+
Err(anyhow::anyhow!(format!("except {} characters, but found: {} --> {}", size, buf_str.len(), buf_str)))
199199
} else {
200200
Ok(buf_str)
201201
}
@@ -205,9 +205,9 @@ fn read_string(pid: u32, addr: usize, size: usize) -> Result<String> {
205205
fn read_string_or_ptr(pid: u32, addr: usize, size: usize) -> Result<String> {
206206
match read_string(pid, addr, size) {
207207
Ok(ss) => Ok(ss),
208-
Err(_) => {
208+
Err(e) => {
209209
let str_ptr = read_number::<usize>(pid, addr)?;
210-
Ok(read_string(pid, str_ptr, size)?)
210+
Ok(read_string(pid, str_ptr, size).map_err(|_| e)?)
211211
}
212212
}
213213
}
@@ -529,6 +529,7 @@ fn dump_wechat_info_v4(
529529
let nick_name_length = u64::from_le_bytes(phone_str_match.data[..8].try_into().unwrap());
530530
let phone_str_address = phone_str_match.base + phone_str_match.offset + 0x10;
531531
let phone_str = read_string(pid, phone_str_address, 11).unwrap();
532+
println!("[+] found phone at 0x{:x} --> {}********", phone_str_address, &phone_str[..3]);
532533
let nick_name =
533534
read_string_or_ptr(pid, phone_str_address - 0x20, nick_name_length as usize).unwrap();
534535

@@ -1076,7 +1077,7 @@ fn cli() -> clap::Command {
10761077
use clap::{arg, value_parser, Command};
10771078

10781079
Command::new("wechat-dump-rs")
1079-
.version("1.0.21")
1080+
.version("1.0.22")
10801081
.about("A wechat db dump tool")
10811082
.author("REinject")
10821083
.help_template("{name} ({version}) - {author}\n{about}\n{all-args}")

0 commit comments

Comments
 (0)