添加进入微信接口
This commit is contained in:
parent
158da3fb64
commit
88e89c4836
@ -1,6 +1,7 @@
|
|||||||
#include "pch.h"
|
#include "pch.h"
|
||||||
#include "account_mgr.h"
|
#include "account_mgr.h"
|
||||||
#include "wechat_function.h"
|
#include "wechat_function.h"
|
||||||
|
#include "spdlog/spdlog.h"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
namespace wxhelper {
|
namespace wxhelper {
|
||||||
@ -217,18 +218,30 @@ int AccountMgr::Logout() {
|
|||||||
|
|
||||||
int AccountMgr::EnterWeChat() {
|
int AccountMgr::EnterWeChat() {
|
||||||
int success = -1;
|
int success = -1;
|
||||||
//base::FunctionResolver resolver(base_addr_);
|
DWORD enter_wechat_callback_addr = base_addr_ + WX_ENTER_WECHAT_CALLBACK_OFFSET;
|
||||||
//auto cb = base::CastFunction<__OnLoginBtnClick>(resolver, kOnLoginBtnClick);
|
std::vector<DWORD> vec;
|
||||||
//auto vec =
|
bool found = Utils::ScanAndMatchValue(base_addr_ + 0x2A66A18, vec);
|
||||||
// base::memory::ScanAndMatchValue(base_addr + 0x4ecedf8, 0x1000, 0x8);
|
if (found) {
|
||||||
//for (int i = 0; i < vec.size(); i++) {
|
HANDLE handle = GetCurrentProcess();
|
||||||
// int64_t ptr = vec.at(i);
|
for (int i = 0; i < vec.size(); i++) {
|
||||||
// if (*(int64_t*)ptr == base_addr + 0x4ecedf8) {
|
DWORD ptr = vec.at(i);
|
||||||
// int64_t login_wnd = ptr;
|
DWORD value;
|
||||||
// success = cb(ptr);
|
if (ReadProcessMemory(handle, (LPVOID)ptr, &value, sizeof(value), NULL)) {
|
||||||
// break;
|
if (value == base_addr_ + 0x2A66A18) {
|
||||||
// }
|
DWORD login_wnd = ptr;
|
||||||
//}
|
__asm {
|
||||||
|
PUSHAD
|
||||||
|
MOV ECX, login_wnd
|
||||||
|
CALL enter_wechat_callback_addr
|
||||||
|
POPAD
|
||||||
|
}
|
||||||
|
success = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,6 +81,7 @@ typedef enum HTTP_API_ROUTE {
|
|||||||
WECHAT_REFUSE,
|
WECHAT_REFUSE,
|
||||||
WECHAT_GET_HEAD_IMG,
|
WECHAT_GET_HEAD_IMG,
|
||||||
WECHAT_MOD_CONTACT_REMARK,
|
WECHAT_MOD_CONTACT_REMARK,
|
||||||
|
WECHAT_ENTER_WECHAT,
|
||||||
} WECHAT_HTTP_APIS,
|
} WECHAT_HTTP_APIS,
|
||||||
*PWECHAT_HTTP_APIS;
|
*PWECHAT_HTTP_APIS;
|
||||||
|
|
||||||
|
@ -685,6 +685,12 @@ string Dispatch(struct mg_connection *c, struct mg_http_message *hm) {
|
|||||||
ret = ret_data.dump();
|
ret = ret_data.dump();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case WECHAT_ENTER_WECHAT: {
|
||||||
|
int success = g_context.account_mgr->EnterWeChat();
|
||||||
|
json ret_data = { {"code", success}, {"result", "OK"} };
|
||||||
|
ret = ret_data.dump();
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
json ret_data = {{"result", "ERROR"}, {"msg", "not support api"}};
|
json ret_data = {{"result", "ERROR"}, {"msg", "not support api"}};
|
||||||
ret = ret_data.dump();
|
ret = ret_data.dump();
|
||||||
|
32
src/utils.cc
32
src/utils.cc
@ -211,4 +211,36 @@ bool Utils::IsTextUtf8(const char *str,int length) {
|
|||||||
}
|
}
|
||||||
return (bytes_num == 0);
|
return (bytes_num == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Utils::ScanAndMatchValue(DWORD value, std::vector<DWORD>& result) {
|
||||||
|
SYSTEM_INFO sys_info;
|
||||||
|
GetSystemInfo(&sys_info);
|
||||||
|
|
||||||
|
LPVOID current_addr = sys_info.lpMinimumApplicationAddress;
|
||||||
|
DWORD pageSize = sys_info.dwPageSize;
|
||||||
|
|
||||||
|
MEMORY_BASIC_INFORMATION mem_info = {};
|
||||||
|
HANDLE handle = GetCurrentProcess();
|
||||||
|
while (current_addr < sys_info.lpMaximumApplicationAddress) {
|
||||||
|
if (VirtualQueryEx(handle, current_addr, &mem_info, sizeof(MEMORY_BASIC_INFORMATION))) {
|
||||||
|
if (mem_info.State == MEM_COMMIT && (mem_info.Protect & (PAGE_READONLY | PAGE_READWRITE | PAGE_EXECUTE_READ | PAGE_EXECUTE_READWRITE))) {
|
||||||
|
// 读取内存并搜索值
|
||||||
|
LPVOID pBuffer = new BYTE[mem_info.RegionSize];
|
||||||
|
if (ReadProcessMemory(handle, mem_info.BaseAddress, pBuffer, mem_info.RegionSize, NULL)) {
|
||||||
|
for (DWORD i = 0; i < mem_info.RegionSize; i += sizeof(DWORD)) {
|
||||||
|
if (*(PDWORD)((LPBYTE)pBuffer + i) == value) {
|
||||||
|
result.push_back((DWORD)mem_info.BaseAddress + i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
delete[] pBuffer;
|
||||||
|
}
|
||||||
|
current_addr = (LPBYTE)mem_info.BaseAddress + mem_info.RegionSize;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
current_addr = (LPBYTE)current_addr + pageSize;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
return !result.empty();
|
||||||
|
}
|
||||||
} // namespace wxhelper
|
} // namespace wxhelper
|
@ -49,6 +49,8 @@ class Utils {
|
|||||||
|
|
||||||
static bool IsTextUtf8(const char * str,int length) ;
|
static bool IsTextUtf8(const char * str,int length) ;
|
||||||
|
|
||||||
|
static bool ScanAndMatchValue(DWORD value, std::vector<DWORD>& result);
|
||||||
|
|
||||||
template <typename T1, typename T2>
|
template <typename T1, typename T2>
|
||||||
static std::vector<T1> split(T1 str, T2 letter) {
|
static std::vector<T1> split(T1 str, T2 letter) {
|
||||||
std::vector<T1> arr;
|
std::vector<T1> arr;
|
||||||
|
@ -127,6 +127,7 @@
|
|||||||
#define WX_GET_CURRENT_DATA_PATH_OFFSET 0xc872c0
|
#define WX_GET_CURRENT_DATA_PATH_OFFSET 0xc872c0
|
||||||
#define WX_QR_CODE_LOGIN_MGR_OFFSET 0xae9db0
|
#define WX_QR_CODE_LOGIN_MGR_OFFSET 0xae9db0
|
||||||
#define WX_GET_QR_CODE_IMAGE_OFFSET 0xcda6f0
|
#define WX_GET_QR_CODE_IMAGE_OFFSET 0xcda6f0
|
||||||
|
#define WX_ENTER_WECHAT_CALLBACK_OFFSET 0xaf5050
|
||||||
|
|
||||||
//forward
|
//forward
|
||||||
#define WX_FORWARD_MSG_OFFSET 0xce6730
|
#define WX_FORWARD_MSG_OFFSET 0xce6730
|
||||||
|
Loading…
Reference in New Issue
Block a user