mirror of
https://github.com/ttttupup/wxhelper.git
synced 2024-11-22 18:29:23 +08:00
修复个人信息获取错误
This commit is contained in:
parent
861a04e7a0
commit
82a5ca28db
11
README.md
11
README.md
@ -197,17 +197,16 @@ vcpkg
|
|||||||
|result|string|成功提示|
|
|result|string|成功提示|
|
||||||
|data|object|响应内容|
|
|data|object|响应内容|
|
||||||
|account|string|账号|
|
|account|string|账号|
|
||||||
|bigImage|string|头像大图|
|
|headImage|string|头像|
|
||||||
|city|string|城市|
|
|city|string|城市|
|
||||||
|country|string|国家|
|
|country|string|国家|
|
||||||
|currentDataPath|string|当前数据目录|
|
|currentDataPath|string|当前数据目录,登录的账号目录|
|
||||||
|dataRootPath|string|根目录|
|
|dataSavePath|string|微信保存目录|
|
||||||
|dataSavePath|string|保存目录|
|
|
||||||
|mobile|string|手机|
|
|mobile|string|手机|
|
||||||
|name|string|昵称|
|
|name|string|昵称|
|
||||||
|province|string|省|
|
|province|string|省|
|
||||||
|smallImage|string|小头像|
|
|
||||||
|wxid|string|wxid|
|
|wxid|string|wxid|
|
||||||
|
|signature|string|个人签名|
|
||||||
|
|
||||||
###### 接口示例
|
###### 接口示例
|
||||||
入参:
|
入参:
|
||||||
@ -215,7 +214,7 @@ vcpkg
|
|||||||
```
|
```
|
||||||
响应:
|
响应:
|
||||||
``` javascript
|
``` javascript
|
||||||
{"code":1,"data":{"account":"xx","bigImage":"https://wx.qlogo.cn/mmhead/ver_1xx","city":"xx","country":"CN","currentDataPath":"xxx","dataRootPath":"C:\\xx","dataSavePath":"C:\\xx","mobie":"13949175447","name":"xx","province":"xx","smallImage":"xx","wxid":"xx"},"result":"OK"}
|
{"code":1,"data":{"account":"xx","headImage":"https://wx.qlogo.cn/mmhead/ver_1xx","city":"xx","country":"CN","currentDataPath":"C:\\xx\\wxid_xxxxx","dataSavePath":"C:\\xx","mobie":"13812345678","name":"xx","province":"xx","signature":"xx","wxid":"xx"},"result":"OK"}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
@ -221,9 +221,8 @@ void api_handle(mg_http_message *hm, struct mg_connection *c, string &ret) {
|
|||||||
{"account", self_info.account},
|
{"account", self_info.account},
|
||||||
{"wxid", self_info.wxid},
|
{"wxid", self_info.wxid},
|
||||||
{"mobile", self_info.mobile},
|
{"mobile", self_info.mobile},
|
||||||
{"smallImage", self_info.small_img},
|
{"headImage", self_info.head_img},
|
||||||
{"bigImage", self_info.big_img},
|
{"signature",self_info.signature},
|
||||||
{"dataRootPath",self_info.data_root_path},
|
|
||||||
{"dataSavePath",self_info.data_save_path},
|
{"dataSavePath",self_info.data_save_path},
|
||||||
{"currentDataPath",self_info.current_data_path},
|
{"currentDataPath",self_info.current_data_path},
|
||||||
};
|
};
|
||||||
|
221
src/self_info.cc
221
src/self_info.cc
@ -21,123 +21,140 @@ using namespace std;
|
|||||||
#define WX_CURRENT_DATA_PATH_OFFSET 0x2E4F290
|
#define WX_CURRENT_DATA_PATH_OFFSET 0x2E4F290
|
||||||
|
|
||||||
#define WX_LOGOUT_OFFSET 0xdd5c90
|
#define WX_LOGOUT_OFFSET 0xdd5c90
|
||||||
#define WX_ACCOUT_SERVICE_OFFSET 0x707960
|
#define WX_ACCOUNT_SERVICE_OFFSET 0x707960
|
||||||
|
#define WX_GET_APP_DATA_SAVE_PATH_OFFSET 0xeb4b00
|
||||||
|
#define WX_GET_CURRENT_DATA_PATH_OFFSET 0xc11140
|
||||||
int GetSelfInfo(SelfInfoInner &out) {
|
int GetSelfInfo(SelfInfoInner &out) {
|
||||||
DWORD base = GetWeChatWinBase();
|
DWORD base = GetWeChatWinBase();
|
||||||
#ifdef _DEBUG
|
DWORD accout_service_addr = base + WX_ACCOUNT_SERVICE_OFFSET;
|
||||||
cout << "mobile:" << (char *)(base + WX_SELF_MOBILE_OFFSET) << endl;
|
DWORD get_app_save_addr = base + WX_GET_APP_DATA_SAVE_PATH_OFFSET;
|
||||||
cout << "name:" << (char *)(base + WX_SELF_NAME_OFFSET) << endl;
|
DWORD get_current_data_path_addr = base + WX_GET_CURRENT_DATA_PATH_OFFSET;
|
||||||
cout << "city:" << (char *)(base + WX_SELF_CITY_OFFSET) << endl;
|
DWORD service_addr = NULL;
|
||||||
cout << "city:" << (char *)(base + WX_SELF_CITY_OFFSET) << endl;
|
__asm {
|
||||||
cout << "province:" << (char *)(base + WX_SELF_PROVINCE_OFFSET) << endl;
|
PUSHAD
|
||||||
cout << "country:" << (char *)(base + WX_SELF_COUNTRY_OFFSET) << endl;
|
CALL accout_service_addr
|
||||||
cout << "account:" << (char *)(base + WX_SELF_ACCOUNT_OFFSET) << endl;
|
MOV service_addr,EAX
|
||||||
cout << "wxid:" << (char *)(base + WX_SELF_ID_OFFSET) << endl;
|
POPAD
|
||||||
cout << "small_img:" << (char *)(base + WX_SELF_SMALL_IMG_OFFSET) << endl;
|
|
||||||
cout << "big_img:" << (char *)(base + WX_SELF_BIG_IMG_OFFSET) << endl;
|
|
||||||
#endif
|
|
||||||
if (*(DWORD *)(base + WX_SELF_NAME_OFFSET) == 0 ||
|
|
||||||
*(DWORD *)(base + WX_SELF_NAME_OFFSET + 0x10) == 0) {
|
|
||||||
out.name = string();
|
|
||||||
} else {
|
|
||||||
out.name = string((char *)(base + WX_SELF_NAME_OFFSET),
|
|
||||||
*(DWORD *)(base + WX_SELF_NAME_OFFSET + 0x10));
|
|
||||||
}
|
}
|
||||||
if (*(DWORD *)(base + WX_SELF_MOBILE_OFFSET) == 0 ||
|
if (service_addr) {
|
||||||
*(DWORD *)(base + WX_SELF_MOBILE_OFFSET + 0x10) == 0) {
|
if (*(DWORD *)(service_addr + 0x44) == 0 ||
|
||||||
out.mobile = string();
|
*(DWORD *)(service_addr + 0x44 + 0x10) == 0) {
|
||||||
} else {
|
out.wxid = string();
|
||||||
out.mobile = string((char *)(base + WX_SELF_MOBILE_OFFSET),
|
} else {
|
||||||
*(DWORD *)(base + WX_SELF_MOBILE_OFFSET + 0x10));
|
out.wxid = string(*(char **)(service_addr + 0x44),
|
||||||
|
*(DWORD *)(service_addr + 0x44 + 0x10));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (*(DWORD *)(service_addr + 0xA8) == 0 ||
|
||||||
|
*(DWORD *)(service_addr + 0xA8 + 0x10) == 0) {
|
||||||
|
out.account = string();
|
||||||
|
} else {
|
||||||
|
out.account = string(*(char **)(service_addr + 0xA8),
|
||||||
|
*(DWORD *)(service_addr + 0xA8 + 0x10));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (*(DWORD *)(service_addr + 0xC0) == 0 ||
|
||||||
|
*(DWORD *)(service_addr + 0xC0 + 0x10) == 0) {
|
||||||
|
out.mobile = string();
|
||||||
|
} else {
|
||||||
|
out.mobile = string((char *)(service_addr + 0xC0),
|
||||||
|
*(DWORD *)(service_addr + 0xC0 + 0x10));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (*(DWORD *)(service_addr + 0xD8) == 0 ||
|
||||||
|
*(DWORD *)(service_addr + 0xD8 + 0x10) == 0) {
|
||||||
|
out.signature = string();
|
||||||
|
} else {
|
||||||
|
out.signature = string((char *)(service_addr + 0xD8),
|
||||||
|
*(DWORD *)(service_addr + 0xD8 + 0x10));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (*(DWORD *)(service_addr + 0xF0) == 0 ||
|
||||||
|
*(DWORD *)(service_addr + 0xF0 + 0x10) == 0) {
|
||||||
|
out.country = string();
|
||||||
|
} else {
|
||||||
|
out.country = string((char *)(service_addr + 0xF0),
|
||||||
|
*(DWORD *)(service_addr + 0xF0 + 0x10));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (*(DWORD *)(service_addr + 0x108) == 0 ||
|
||||||
|
*(DWORD *)(service_addr + 0x108 + 0x10) == 0) {
|
||||||
|
out.province = string();
|
||||||
|
} else {
|
||||||
|
out.province = string((char *)(service_addr + 0x108),
|
||||||
|
*(DWORD *)(service_addr + 0x108 + 0x10));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (*(DWORD *)(service_addr + 0x120) == 0 ||
|
||||||
|
*(DWORD *)(service_addr + 0x120 + 0x10) == 0) {
|
||||||
|
out.city = string();
|
||||||
|
} else {
|
||||||
|
out.city = string((char *)(service_addr + 0x120),
|
||||||
|
*(DWORD *)(service_addr + 0x120 + 0x10));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (*(DWORD *)(service_addr + 0x150) == 0 ||
|
||||||
|
*(DWORD *)(service_addr + 0x150 + 0x10) == 0) {
|
||||||
|
out.name = string();
|
||||||
|
} else {
|
||||||
|
out.name = string((char *)(service_addr + 0x150),
|
||||||
|
*(DWORD *)(service_addr + 0x150 + 0x10));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (*(DWORD *)(service_addr + 0x304) == 0 ||
|
||||||
|
*(DWORD *)(service_addr + 0x304 + 0x10) == 0) {
|
||||||
|
out.head_img = string();
|
||||||
|
} else {
|
||||||
|
out.head_img = string(*(char **)(service_addr + 0x304),
|
||||||
|
*(DWORD *)(service_addr + 0x304 + 0x10));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*(DWORD *)(base + WX_SELF_CITY_OFFSET) == 0 ||
|
WeChatString data_save_path;
|
||||||
*(DWORD *)(base + WX_SELF_CITY_OFFSET + 0x10) == 0) {
|
WeChatString current_data_path;
|
||||||
out.city = string();
|
|
||||||
} else {
|
__asm {
|
||||||
out.city = string((char *)(base + WX_SELF_CITY_OFFSET),
|
PUSHAD
|
||||||
*(DWORD *)(base + WX_SELF_CITY_OFFSET + 0x10));
|
LEA ECX,data_save_path
|
||||||
|
CALL get_app_save_addr
|
||||||
|
LEA ECX,current_data_path
|
||||||
|
CALL get_current_data_path_addr
|
||||||
|
POPAD
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*(DWORD *)(base + WX_SELF_PROVINCE_OFFSET) == 0 ||
|
if (data_save_path.ptr) {
|
||||||
*(DWORD *)(base + WX_SELF_PROVINCE_OFFSET + 0x10) == 0) {
|
out.data_save_path =
|
||||||
out.province = string();
|
Wstring2String(wstring(data_save_path.ptr, data_save_path.length));
|
||||||
} else {
|
}else {
|
||||||
out.province = string((char *)(base + WX_SELF_PROVINCE_OFFSET),
|
|
||||||
*(DWORD *)(base + WX_SELF_PROVINCE_OFFSET + 0x10));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (*(DWORD *)(base + WX_SELF_COUNTRY_OFFSET) == 0 ||
|
|
||||||
*(DWORD *)(base + WX_SELF_COUNTRY_OFFSET + 0x10) == 0) {
|
|
||||||
out.country = string();
|
|
||||||
} else {
|
|
||||||
out.country = string((char *)(base + WX_SELF_COUNTRY_OFFSET),
|
|
||||||
*(DWORD *)(base + WX_SELF_COUNTRY_OFFSET + 0x10));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (*(DWORD *)(base + WX_SELF_ACCOUNT_OFFSET) == 0 ||
|
|
||||||
*(DWORD *)(base + WX_SELF_ACCOUNT_OFFSET + 0x10) == 0) {
|
|
||||||
out.account = string();
|
|
||||||
} else {
|
|
||||||
out.account = string(*(char **)(base + WX_SELF_ACCOUNT_OFFSET),
|
|
||||||
*(DWORD *)(base + WX_SELF_ACCOUNT_OFFSET + 0x10));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (*(DWORD *)(base + WX_SELF_ID_OFFSET) == 0 ||
|
|
||||||
*(DWORD *)(base + WX_SELF_ID_OFFSET + 0x10) == 0) {
|
|
||||||
out.wxid = string();
|
|
||||||
} else {
|
|
||||||
out.wxid = string(*(char **)(base + WX_SELF_ID_OFFSET),
|
|
||||||
*(DWORD *)(base + WX_SELF_ID_OFFSET + 0x10));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (*(DWORD *)(base + WX_SELF_SMALL_IMG_OFFSET) == 0 ||
|
|
||||||
*(DWORD *)(base + WX_SELF_SMALL_IMG_OFFSET + 0x10) == 0) {
|
|
||||||
out.small_img = string();
|
|
||||||
} else {
|
|
||||||
out.small_img = string(*(char **)(base + WX_SELF_SMALL_IMG_OFFSET),
|
|
||||||
*(DWORD *)(base + WX_SELF_SMALL_IMG_OFFSET + 0x10));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (*(DWORD *)(base + WX_SELF_BIG_IMG_OFFSET) == 0 ||
|
|
||||||
*(DWORD *)(base + WX_SELF_BIG_IMG_OFFSET + 0x10) == 0) {
|
|
||||||
out.big_img = string();
|
|
||||||
} else {
|
|
||||||
out.big_img = string(*(char **)(base + WX_SELF_BIG_IMG_OFFSET),
|
|
||||||
*(DWORD *)(base + WX_SELF_BIG_IMG_OFFSET + 0x10));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (*(DWORD *)(base + WX_APP_DATA_ROOT_PATH_OFFSET) == 0 ||
|
|
||||||
*(DWORD *)(base + WX_APP_DATA_ROOT_PATH_OFFSET + 0x4) == 0) {
|
|
||||||
out.data_root_path = string();
|
|
||||||
} else {
|
|
||||||
out.data_root_path = Wstring2String(wstring(*(wchar_t **)(base + WX_APP_DATA_ROOT_PATH_OFFSET),
|
|
||||||
*(DWORD *)(base + WX_APP_DATA_ROOT_PATH_OFFSET + 0x4)));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (*(DWORD *)(base + WX_APP_DATA_SAVE_PATH_OFFSET) == 0 ||
|
|
||||||
*(DWORD *)(base + WX_APP_DATA_SAVE_PATH_OFFSET + 0x4) == 0) {
|
|
||||||
out.data_save_path = string();
|
out.data_save_path = string();
|
||||||
} else {
|
|
||||||
out.data_save_path = Wstring2String(wstring(*(wchar_t **)(base + WX_APP_DATA_SAVE_PATH_OFFSET),
|
|
||||||
*(DWORD *)(base + WX_APP_DATA_SAVE_PATH_OFFSET + 0x4)));
|
|
||||||
}
|
|
||||||
if (*(DWORD *)(base + WX_CURRENT_DATA_PATH_OFFSET) == 0 ||
|
|
||||||
*(DWORD *)(base + WX_CURRENT_DATA_PATH_OFFSET + 0x4) == 0) {
|
|
||||||
out.current_data_path = string();
|
|
||||||
} else {
|
|
||||||
out.current_data_path = Wstring2String(wstring(*(wchar_t **)(base + WX_CURRENT_DATA_PATH_OFFSET),
|
|
||||||
*(DWORD *)(base + WX_CURRENT_DATA_PATH_OFFSET + 0x4)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (current_data_path.ptr) {
|
||||||
|
out.current_data_path =
|
||||||
|
Wstring2String(wstring(current_data_path.ptr, current_data_path.length));
|
||||||
|
}else {
|
||||||
|
out.current_data_path = string();
|
||||||
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int CheckLogin(){
|
int CheckLogin(){
|
||||||
DWORD base = GetWeChatWinBase();
|
DWORD base = GetWeChatWinBase();
|
||||||
return *(DWORD*) (base + WX_LOGIN_STATUS_OFFSET);
|
DWORD accout_service_addr = base + WX_ACCOUNT_SERVICE_OFFSET;
|
||||||
|
DWORD service_addr = NULL;
|
||||||
|
__asm {
|
||||||
|
PUSHAD
|
||||||
|
CALL accout_service_addr
|
||||||
|
MOV service_addr,EAX
|
||||||
|
POPAD
|
||||||
|
}
|
||||||
|
if (service_addr) {
|
||||||
|
return *(DWORD *)(service_addr + 0x4C8);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -147,7 +164,7 @@ int Logout(){
|
|||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
DWORD base = GetWeChatWinBase();
|
DWORD base = GetWeChatWinBase();
|
||||||
DWORD account_service_addr = base + WX_ACCOUT_SERVICE_OFFSET;
|
DWORD account_service_addr = base + WX_ACCOUNT_SERVICE_OFFSET;
|
||||||
DWORD logout_addr = base + WX_LOGOUT_OFFSET;
|
DWORD logout_addr = base + WX_LOGOUT_OFFSET;
|
||||||
__asm{
|
__asm{
|
||||||
PUSHAD
|
PUSHAD
|
||||||
|
@ -149,10 +149,9 @@ struct SelfInfoInner{
|
|||||||
std::string account;
|
std::string account;
|
||||||
std::string wxid;
|
std::string wxid;
|
||||||
std::string mobile;
|
std::string mobile;
|
||||||
std::string small_img;
|
std::string head_img;
|
||||||
std::string big_img;
|
|
||||||
std::string data_root_path;
|
|
||||||
std::string data_save_path;
|
std::string data_save_path;
|
||||||
|
std::string signature;
|
||||||
std::string current_data_path;
|
std::string current_data_path;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user