WeChatFerry/spy/user_info.cpp

49 lines
1.2 KiB
C++
Raw Normal View History

2023-03-10 23:47:24 +08:00
#include "user_info.h"
#include "load_calls.h"
#include "log.h"
#include "util.h"
extern WxCalls_t g_WxCalls;
extern DWORD g_WeChatWinDllAddr;
2023-06-07 15:50:12 +08:00
static char home[MAX_PATH] = { 0 };
string GetHomePath()
{
if (home[0] == 0) {
2023-06-11 17:56:54 +08:00
string path = Wstring2String(GET_WSTRING(g_WeChatWinDllAddr + g_WxCalls.ui.home)) + "\\WeChat Files\\";
2023-06-07 15:50:12 +08:00
strncpy_s(home, path.c_str(), path.size());
}
return string(home);
}
2023-04-10 23:39:57 +08:00
string GetSelfWxid()
2023-03-10 23:47:24 +08:00
{
DWORD wxidType = 0;
try {
wxidType = GET_DWORD(g_WeChatWinDllAddr + g_WxCalls.ui.wxid + 0x14);
if (wxidType == 0xF) {
return GET_STRING_FROM_P(g_WeChatWinDllAddr + g_WxCalls.ui.wxid);
} else {
return GET_STRING(g_WeChatWinDllAddr + g_WxCalls.ui.wxid);
}
} catch (...) {
LOG_ERROR("wxid type: {:#x}", wxidType);
LOG_BUFFER((uint8_t *)(g_WeChatWinDllAddr + g_WxCalls.ui.wxid), 20);
return "empty_wxid";
}
}
2023-04-11 23:26:38 +08:00
UserInfo_t GetUserInfo()
{
UserInfo_t ui;
ui.wxid = GetSelfWxid();
ui.name = GET_STRING_FROM_P(g_WeChatWinDllAddr + g_WxCalls.ui.nickName);
ui.mobile = GET_STRING_FROM_P(g_WeChatWinDllAddr + g_WxCalls.ui.mobile);
2023-06-07 15:50:12 +08:00
ui.home = GetHomePath();
2023-04-11 23:26:38 +08:00
return ui;
}