wx_core/wx_scanner/
mod.rs

1use std::fmt::{Debug, Formatter};
2
3#[cfg(windows)]
4mod on_windows;
5#[cfg(target_os = "macos")]
6mod on_macos;
7#[cfg(target_os = "linux")]
8mod on_linux;
9
10/// 微信个人数据
11#[derive(Default)]
12pub struct WeChatProfile {
13    /// 微信版本号
14    pub version: String,
15    /// 微信用户名
16    pub user_name: String,
17    /// 微信昵称
18    pub nick_name: String,
19    /// 微信手机号
20    pub mobile: String,
21    /// 微信邮箱
22    pub email: String,
23    /// 微信加密秘钥
24    pub aes256: [u8; 32],
25}
26
27/// 微信扫描器
28#[cfg(windows)]
29#[derive(Debug, Default)]
30pub struct WxScanner {
31    /// 微信个人数据
32    pub profile: WeChatProfile,
33    process: windows::Win32::System::Diagnostics::ToolHelp::PROCESSENTRY32,
34    handle: windows::Win32::Foundation::HANDLE,
35    module: windows::Win32::System::Diagnostics::ToolHelp::MODULEENTRY32,
36}
37
38#[cfg(target_os = "macos")]
39#[derive(Debug, Default)]
40pub struct WxScanner {
41    /// 微信个人数据
42    pub profile: WeChatProfile,
43}
44
45
46#[cfg(target_os = "linux")]
47#[derive(Debug, Default)]
48pub struct WxScanner {
49    /// 微信个人数据
50    pub profile: WeChatProfile,
51}
52
53impl Debug for WeChatProfile {
54    fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
55        let hex_string: String = self.aes256.iter().map(|byte| format!("{:02X}", byte)).collect();
56        f.debug_struct("WeChatProfile")
57            .field("version", &self.version)
58            .field("user_name", &self.user_name)
59            .field("nick_name", &self.nick_name)
60            .field("mobile", &self.mobile)
61            .field("email", &self.email)
62            .field("key", &hex_string)
63            .finish()
64    }
65}