feat: 根据502647092提供的偏移,新增登录二维码

This commit is contained in:
hugy 2023-05-25 22:10:03 +08:00
parent 581aacb8ce
commit aaada266df
6 changed files with 49 additions and 12 deletions

View File

@ -34,3 +34,4 @@
55.获取联系人或者群名称
56.获取消息附件(图片,视频,文件)
57.获取消息语音文件
58.登录二维码

View File

@ -1,21 +1,16 @@
#include "pch.h"
#include "account_mgr.h"
#include "wechat_function.h"
using namespace std;
namespace wxhelper {
AccountMgr::AccountMgr(DWORD base):BaseMgr(base){
}
AccountMgr::~AccountMgr(){
}
AccountMgr::AccountMgr(DWORD base) : BaseMgr(base) {}
AccountMgr::~AccountMgr() {}
int AccountMgr::GetSelfInfo(SelfInfoInner &out) {
DWORD accout_service_addr = base_addr_ + WX_ACCOUNT_SERVICE_OFFSET;
DWORD get_app_save_addr = base_addr_ + WX_GET_APP_DATA_SAVE_PATH_OFFSET;
DWORD get_current_data_path_addr = base_addr_ + WX_GET_CURRENT_DATA_PATH_OFFSET;
DWORD get_current_data_path_addr =
base_addr_ + WX_GET_CURRENT_DATA_PATH_OFFSET;
DWORD service_addr = NULL;
__asm {
PUSHAD
@ -215,4 +210,35 @@ int AccountMgr::Logout() {
return success;
}
/// @brief 根据 502647092 提供的偏移 获取二维码url
/// @return
std::string AccountMgr::GetQRCodeUrl() {
DWORD qr_code_login_addr = base_addr_ + WX_QR_CODE_LOGIN_MGR_OFFSET ;
DWORD get_qr_code_img_addr = base_addr_ + WX_GET_QR_CODE_IMAGE_OFFSET ;
DWORD temp;
__asm {
PUSHAD
PUSHFD
CALL qr_code_login_addr
MOV temp,EAX
POPFD
POPAD
}
std::string pre("https://weixin.qq.com/x/");
DWORD ptr = temp + 0x8;
DWORD len = *(DWORD*)(ptr+0x10);
if (*(DWORD *)(ptr) == 0) {
return std::string();
} else {
if( *(DWORD*) (temp+0x1c) > 0xf){
std::string suff(*(char **)ptr,len);
return pre + suff;
}else{
std::string suff((char *)ptr,len);
return pre + suff;
}
}
}
} // namespace wxhelper

View File

@ -13,6 +13,8 @@ namespace wxhelper{
int CheckLogin();
int Logout();
std::string GetQRCodeUrl();
};
}

View File

@ -71,6 +71,7 @@ typedef enum HTTP_API_ROUTE {
WECHAT_CONTACT_NAME,
WECHAT_ATTACH_DOWNLOAD,
WECHAT_GET_VOICE,
WECHAT_GET_QRCODE,
} WECHAT_HTTP_APIS,
*PWECHAT_HTTP_APIS;

View File

@ -572,6 +572,12 @@ string Dispatch(struct mg_connection *c, struct mg_http_message *hm) {
ret = ret_data.dump();
break;
}
case WECHAT_GET_QRCODE: {
string url = g_context.account_mgr->GetQRCodeUrl();
json ret_data = {{"code", 1}, {"result", "OK"},{"qrCodeUrl",url}};
ret = ret_data.dump();
break;
}
default:
break;
}

View File

@ -118,7 +118,8 @@
#define WX_ACCOUNT_SERVICE_OFFSET 0x769720
#define WX_GET_APP_DATA_SAVE_PATH_OFFSET 0xf3bbd0
#define WX_GET_CURRENT_DATA_PATH_OFFSET 0xc88120
#define WX_QR_CODE_LOGIN_MGR_OFFSET 0xaeab70
#define WX_GET_QR_CODE_IMAGE_OFFSET 0xcdb560
//forward
#define WX_FORWARD_MSG_OFFSET 0xce75a0