diff --git a/doc/3.9.2.26.md b/doc/3.9.2.26.md index e4dfdbf..c5bf00e 100644 --- a/doc/3.9.2.26.md +++ b/doc/3.9.2.26.md @@ -33,4 +33,5 @@ 54.朋友圈下一页 55.获取联系人或者群名称 56.获取消息附件(图片,视频,文件) -57.获取消息语音文件 \ No newline at end of file +57.获取消息语音文件 +58.登录二维码 \ No newline at end of file diff --git a/src/account_mgr.cc b/src/account_mgr.cc index 2c57c36..d047bc9 100644 --- a/src/account_mgr.cc +++ b/src/account_mgr.cc @@ -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 \ No newline at end of file diff --git a/src/account_mgr.h b/src/account_mgr.h index 67da58d..2554a03 100644 --- a/src/account_mgr.h +++ b/src/account_mgr.h @@ -13,6 +13,8 @@ namespace wxhelper{ int CheckLogin(); int Logout(); + + std::string GetQRCodeUrl(); }; } diff --git a/src/api_route.h b/src/api_route.h index 224b7fe..0946953 100644 --- a/src/api_route.h +++ b/src/api_route.h @@ -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; diff --git a/src/http_handler.cc b/src/http_handler.cc index 43f33e0..5206a4f 100644 --- a/src/http_handler.cc +++ b/src/http_handler.cc @@ -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; } diff --git a/src/wechat_function.h b/src/wechat_function.h index de7e4af..35c7039 100644 --- a/src/wechat_function.h +++ b/src/wechat_function.h @@ -118,8 +118,9 @@ #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 // send file