Skip to content

Commit

Permalink
添加 x86 版本微信支持 (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
REInject committed Oct 28, 2023
1 parent 183c2a5 commit dda57b2
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 7 deletions.
11 changes: 10 additions & 1 deletion .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,22 @@ jobs:

upload-assets:
needs: create-release
runs-on: windows-latest
strategy:
matrix:
include:
- target: x86_64-pc-windows-msvc
os: windows-latest
- target: i686-pc-windows-msvc
os: windows-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: taiki-e/upload-rust-binary-action@v1
with:
# (required) Comma-separated list of binary names (non-extension portion of filename) to build and upload.
# Note that glob pattern is not supported yet.
bin: wechat-dump-rs
# (optional) Target triple, default is host triple.
target: ${{ matrix.target }}
# (required) GitHub token for uploading assets to GitHub Releases.
token: ${{ secrets.GITHUB_TOKEN }}
14 changes: 8 additions & 6 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -245,12 +245,14 @@ fn dump_wechat_info(pid: u32, special_data_dir: Option::<&PathBuf>) -> WechatInf
println!("[+] login phone type is {}", phone_type_string);
println!("[+] wechat data dir is {}", data_dir);

let align = std::mem::size_of::<usize>(); // x64 -> 16, x86 -> 8

// account_name 在 phone_type 前面,并且是 16 位补齐的,所以向前找,离得比较近不用找太远的
let mut start = phone_type_string_addr - 16;
let mut start = phone_type_string_addr - align;
let mut account_name_addr = start;
let mut account_name: Option<String> = None;
let mut count = 0;
while start >= phone_type_string_addr - 16 * 20 {
while start >= phone_type_string_addr - align * 20 {
// 名字长度>=16,就会变成指针,不直接存放字符串
let account_name_point_address = read_number::<usize>(pid, start)
.expect("read account name point address failed");
Expand All @@ -259,7 +261,7 @@ fn dump_wechat_info(pid: u32, special_data_dir: Option::<&PathBuf>) -> WechatInf
}) {
read_string(pid, account_name_point_address, 100)
} else {
read_string(pid, start, 16)
read_string(pid, start, align)
};

if result.is_ok() {
Expand All @@ -278,7 +280,7 @@ fn dump_wechat_info(pid: u32, special_data_dir: Option::<&PathBuf>) -> WechatInf
}
}

start -= 16;
start -= align;
}

if account_name.is_none() {
Expand All @@ -302,7 +304,7 @@ fn dump_wechat_info(pid: u32, special_data_dir: Option::<&PathBuf>) -> WechatInf
// key 在微信号前面找
let mut key: Option<String> = None;
let mem_base = phone_type_str_match.base;
let mut key_point_addr = account_name_addr - 16;
let mut key_point_addr = account_name_addr - align;
while key_point_addr >= mem_base {
let key_addr = read_number::<usize>(pid, key_point_addr).expect("find key addr failed in memory");

Expand Down Expand Up @@ -351,7 +353,7 @@ fn dump_wechat_info(pid: u32, special_data_dir: Option::<&PathBuf>) -> WechatInf
}
}

key_point_addr -= 16;
key_point_addr -= align;
}

if key.is_none() {
Expand Down

0 comments on commit dda57b2

Please sign in to comment.