feat:3.9.10.19

This commit is contained in:
ttttupup 2024-04-27 22:46:18 +08:00
parent efb5dba007
commit 227a296624
8 changed files with 1118 additions and 428 deletions

View File

@ -30,7 +30,7 @@ add_subdirectory(../base base)
add_library(wxhelper SHARED ${CPP_FILES} ${ASM_FILES})
target_compile_definitions(wxhelper PRIVATE WECHAT_VERSION=39943)
target_compile_definitions(wxhelper PRIVATE WECHAT_VERSION=391019)
# target_include_directories(wxhelper
# PRIVATE ../base/src/include

View File

@ -2,184 +2,68 @@
#include "json_utils.h"
#include "nlohmann/json.hpp"
#include "offset.h"
#include "spdlog/spdlog.h"
#include "utils.h"
#include "wechat_interface.h"
#include "wxutils.h"
namespace offset = wechat::offset;
namespace prototype = wechat::prototype;
namespace func = wechat::function;
namespace utils = base::utils;
#include "wechat_service.h"
namespace jsonutils = wxhelper::jsonutils;
namespace wxhelper {
prototype::WeChatString* BuildWechatString(const std::wstring& ws) {
prototype::WeChatString* p =
base::utils::WxHeapAlloc<prototype::WeChatString>(
sizeof(prototype::WeChatString));
wchar_t* p_chat_room_id =
base::utils::WxHeapAlloc<wchar_t>((ws.size() + 1) * 2);
wmemcpy(p_chat_room_id, ws.c_str(), ws.size() + 1);
p->ptr = p_chat_room_id;
p->length = static_cast<int32_t>(ws.size());
p->max_length = static_cast<int32_t>(ws.size());
p->c_len = 0;
p->c_ptr = 0;
return p;
}
std::string ChatController::SendTextMsg(std::string params) {
int64_t base_addr = wxutils::GetWeChatWinBase();
nlohmann::json jp = nlohmann::json::parse(params);
SPDLOG_INFO("sendTextMsg wxid={},msg={}", jp["wxid"], jp["msg"]);
std::wstring wxid = jsonutils::GetWStringParam(jp, "wxid");
std::wstring msg = jsonutils::GetWStringParam(jp, "msg");
prototype::WeChatString to_user(wxid);
prototype::WeChatString text_msg(msg);
uint64_t send_message_mgr_addr = base_addr + offset::kGetSendMessageMgr;
uint64_t send_text_msg_addr = base_addr + offset::kSendTextMsg;
uint64_t free_chat_msg_addr = base_addr + offset::kFreeChatMsg;
char chat_msg[0x460] = {0};
uint64_t temp[3] = {0};
func::__GetSendMessageMgr mgr;
mgr = (func::__GetSendMessageMgr)send_message_mgr_addr;
func::__SendTextMsg send;
send = (func::__SendTextMsg)send_text_msg_addr;
func::__FreeChatMsg free;
free = (func::__FreeChatMsg)free_chat_msg_addr;
mgr();
uint64_t success = send(reinterpret_cast<uint64_t>(&chat_msg),
reinterpret_cast<uint64_t>(&to_user),
reinterpret_cast<uint64_t>(&text_msg),
reinterpret_cast<uint64_t>(&temp), 1, 1, 0, 0);
free(reinterpret_cast<uint64_t>(&chat_msg));
int64_t success = wechat::WeChatService::GetInstance().SendTextMsg(wxid, msg);
nlohmann::json ret_data = {
{"code", success}, {"data", {}}, {"msg", "success"}};
return ret_data.dump();
}
std::string ChatController::SendImageMsg(std::string params) {
int64_t success = -1;
int64_t base_addr = wxutils::GetWeChatWinBase();
nlohmann::json jp = nlohmann::json::parse(params);
std::wstring wxid = jsonutils::GetWStringParam(jp, "wxid");
std::wstring image_path = jsonutils::GetWStringParam(jp, "imagePath");
prototype::WeChatString to_user(wxid);
prototype::WeChatString image_full_path(image_path);
uint64_t send_message_mgr_addr = base_addr + offset::kGetSendMessageMgr;
uint64_t send_img_addr = base_addr + offset::kSendImageMsg;
uint64_t new_chat_msg_addr = base_addr + offset::kChatMsgInstanceCounter;
uint64_t free_chat_msg_addr = base_addr + offset::kFreeChatMsg;
func::__NewChatMsg new_chat_msg = (func::__NewChatMsg)new_chat_msg_addr;
func::__GetSendMessageMgr mgr =
(func::__GetSendMessageMgr)send_message_mgr_addr;
func::__SendImageMsg send_img = (func::__SendImageMsg)send_img_addr;
func::__FreeChatMsg free = (func::__FreeChatMsg)free_chat_msg_addr;
char chat_msg[0x460] = {0};
char chat_msg_temp[0x460] = {0};
uint64_t p_chat_msg_temp =
new_chat_msg(reinterpret_cast<uint64_t>(&chat_msg_temp));
uint64_t temp1 = 0;
uint64_t temp2 = 0;
uint64_t* flag[10] = {};
flag[8] = &temp1;
flag[9] = &temp2;
flag[1] = reinterpret_cast<uint64_t*>(p_chat_msg_temp);
uint64_t p_chat_msg = new_chat_msg(reinterpret_cast<uint64_t>(&chat_msg));
uint64_t send_mgr = mgr();
send_img(send_mgr, p_chat_msg, reinterpret_cast<uint64_t>(&to_user),
reinterpret_cast<uint64_t>(&image_full_path),
reinterpret_cast<uint64_t>(&flag));
free(p_chat_msg);
free(p_chat_msg_temp);
success = 1;
int64_t success =
wechat::WeChatService::GetInstance().SendImageMsg(wxid, image_path);
nlohmann::json ret = {{"code", success}, {"data", {}}, {"msg", "success"}};
return ret.dump();
}
std::string ChatController::SendFileMsg(std::string params) {
int64_t success = -1;
int64_t base_addr = wxutils::GetWeChatWinBase();
nlohmann::json jp = nlohmann::json::parse(params);
std::wstring wxid = jsonutils::GetWStringParam(jp, "wxid");
std::wstring file_path = jsonutils::GetWStringParam(jp, "filePath");
prototype::WeChatString* to_user = (prototype::WeChatString*)HeapAlloc(
GetProcessHeap(), 0, sizeof(prototype::WeChatString));
wchar_t* ptr_wxid =
(wchar_t*)HeapAlloc(GetProcessHeap(), 0, (wxid.length() + 1) * 2);
wmemcpy(ptr_wxid, wxid.c_str(), wxid.length() + 1);
to_user->ptr = ptr_wxid;
to_user->length = static_cast<DWORD>(wxid.length());
to_user->max_length = static_cast<DWORD>(wxid.length());
to_user->c_len = 0;
to_user->c_ptr = 0;
prototype::WeChatString* file_full_path = (prototype::WeChatString*)HeapAlloc(
GetProcessHeap(), 0, sizeof(prototype::WeChatString));
wchar_t* ptr_path =
(wchar_t*)HeapAlloc(GetProcessHeap(), 0, (file_path.length() + 1) * 2);
wmemcpy(ptr_path, file_path.c_str(), file_path.length() + 1);
file_full_path->ptr = ptr_path;
file_full_path->length = static_cast<DWORD>(file_path.length());
file_full_path->max_length = static_cast<DWORD>(file_path.length());
file_full_path->c_len = 0;
file_full_path->c_ptr = 0;
uint64_t get_app_msg_mgr_addr = base_addr + offset::kGetAppMsgMgr;
uint64_t send_file_addr = base_addr + offset::kSendFileMsg;
uint64_t new_chat_msg_addr = base_addr + offset::kChatMsgInstanceCounter;
uint64_t free_chat_msg_addr = base_addr + offset::kFreeChatMsg;
func::__NewChatMsg new_chat_msg = (func::__NewChatMsg)new_chat_msg_addr;
func::__GetAppMsgMgr get_app_mgr = (func::__GetAppMsgMgr)get_app_msg_mgr_addr;
func::__SendFile send_file = (func::__SendFile)send_file_addr;
func::__FreeChatMsg free = (func::__FreeChatMsg)free_chat_msg_addr;
char* chat_msg = (char*)HeapAlloc(GetProcessHeap(), 0, 0x460);
uint64_t* temp1 =
(uint64_t*)HeapAlloc(GetProcessHeap(), 0, sizeof(uint64_t) * 4);
uint64_t* temp2 =
(uint64_t*)HeapAlloc(GetProcessHeap(), 0, sizeof(uint64_t) * 4);
uint64_t* temp3 =
(uint64_t*)HeapAlloc(GetProcessHeap(), 0, sizeof(uint64_t) * 4);
uint64_t* temp4 =
(uint64_t*)HeapAlloc(GetProcessHeap(), 0, sizeof(uint64_t) * 4);
ZeroMemory(temp1, sizeof(uint64_t) * 4);
ZeroMemory(temp2, sizeof(uint64_t) * 4);
ZeroMemory(temp3, sizeof(uint64_t) * 4);
ZeroMemory(temp4, sizeof(uint64_t) * 4);
*temp4 = 0x1F;
uint64_t app_mgr = get_app_mgr();
send_file(app_mgr, reinterpret_cast<uint64_t>(chat_msg),
reinterpret_cast<uint64_t>(to_user),
reinterpret_cast<uint64_t>(file_full_path), 1,
reinterpret_cast<uint64_t>(temp1), 0,
reinterpret_cast<uint64_t>(temp2), 0,
reinterpret_cast<uint64_t>(temp3), 0, 0);
free(reinterpret_cast<uint64_t>(chat_msg));
HeapFree(GetProcessHeap(), 0, to_user);
HeapFree(GetProcessHeap(), 0, file_full_path);
HeapFree(GetProcessHeap(), 0, temp1);
HeapFree(GetProcessHeap(), 0, temp2);
HeapFree(GetProcessHeap(), 0, temp3);
HeapFree(GetProcessHeap(), 0, temp4);
success = 1;
int64_t success =
wechat::WeChatService::GetInstance().SendFileMsg(wxid, file_path);
nlohmann::json ret = {{"code", success}, {"data", {}}, {"msg", "success"}};
return ret.dump();
}
std::string ChatController::SendAtText(std::string params) {
nlohmann::json ret = {
{"code", 200}, {"data", {}}, {"msg", "Not Implemented"}};
nlohmann::json jp = nlohmann::json::parse(params);
std::wstring chat_room_id = jsonutils::GetWStringParam(jp, "chatRoomId");
std::vector<std::wstring> wxids = jsonutils::GetArrayParam(jp, "wxids");
std::wstring msg = jsonutils::GetWStringParam(jp, "msg");
int64_t success =
wechat::WeChatService::GetInstance().SendAtText(chat_room_id, wxids, msg);
nlohmann::json ret = {{"code", success}, {"data", {}}, {"msg", "success"}};
return ret.dump();
}
std::string ChatController::SendMultiAtText(std::string params) {
nlohmann::json ret = {
{"code", 200}, {"data", {}}, {"msg", "Not Implemented"}};
nlohmann::json jp = nlohmann::json::parse(params);
nlohmann::json array = jp["at"];
std::vector<std::pair<std::wstring, std::wstring>> at;
if (array.is_array()) {
for (const auto& item : array) {
at.push_back(std::make_pair(jsonutils::GetWStringParam(item, "wxid"),
jsonutils::GetWStringParam(item, "msg")));
}
}
std::wstring chat_room_id = jsonutils::GetWStringParam(jp, "chatRoomId");
int64_t success =
wechat::WeChatService::GetInstance().SendMultiAtText(chat_room_id, at);
nlohmann::json ret = {{"code", success}, {"data", {}}, {"msg", "success"}};
return ret.dump();
}
@ -196,25 +80,24 @@ std::string ChatController::SendApplet(std::string params) {
}
std::string ChatController::SendPatMsg(std::string params) {
int64_t success = -1;
int64_t base_addr = wxutils::GetWeChatWinBase();
nlohmann::json jp = nlohmann::json::parse(params);
std::wstring room_id = jsonutils::GetWStringParam(jp, "receiver");
std::wstring wxid = jsonutils::GetWStringParam(jp, "wxid");
UINT64 send_pat_msg_addr = base_addr + offset::kSendPatMsg;
func::__SendPatMsg send_pat_msg = (func::__SendPatMsg)send_pat_msg_addr;
prototype::WeChatString chat_room(room_id);
prototype::WeChatString target(wxid);
success = send_pat_msg(reinterpret_cast<UINT64>(&chat_room),
reinterpret_cast<UINT64>(&target));
int64_t success =
wechat::WeChatService::GetInstance().SendPatMsg(room_id, wxid);
nlohmann::json ret_data = {
{"code", success}, {"msg", "success"}, {"data", {}}};
return ret_data.dump();
}
std::string ChatController::ForwardMsg(std::string params) {
nlohmann::json jp = nlohmann::json::parse(params);
std::wstring wxid = jsonutils::GetWStringParam(jp, "wxid");
int64_t msg_id = jsonutils::GetInt64Param(jp, "msgId");
int64_t success =
wechat::WeChatService::GetInstance().ForwardMsg(msg_id, wxid);
nlohmann::json ret = {
{"code", 200}, {"data", {}}, {"msg", "Not Implemented"}};
{"code", success}, {"data", {}}, {"msg", "Not Implemented"}};
return ret.dump();
}
@ -231,8 +114,16 @@ std::string ChatController::ForwardPublicMsg(std::string params) {
}
std::string ChatController::GetContactOrChatRoomNickname(std::string params) {
nlohmann::json ret = {
{"code", 200}, {"data", {}}, {"msg", "Not Implemented"}};
int64_t success = -1;
nlohmann::json jp = nlohmann::json::parse(params);
std::wstring wxid = jsonutils::GetWStringParam(jp, "wxid");
std::wstring nickname =
wechat::WeChatService::GetInstance().GetContactOrChatRoomNickname(wxid);
nlohmann::json ret = {{"code", success},
{"data", {"nickname", nickname}},
{"msg", "Not Implemented"}};
return ret.dump();
}
} // namespace wxhelper

View File

@ -1,55 +1,15 @@
#include "contacts_controller.h"
#include "nlohmann/json.hpp"
#include "offset.h"
#include "spdlog/spdlog.h"
#include "utils.h"
#include "wechat_interface.h"
#include "wxutils.h"
#include "json_utils.h"
namespace offset = wechat::offset;
namespace prototype = wechat::prototype;
namespace func = wechat::function;
namespace utils = base::utils;
#include "wechat_service.h"
namespace jsonutils = wxhelper::jsonutils;
std::string wxhelper::ContactsController::GetContactList(std::string params) {
int64_t success = -1;
int64_t base_addr = wxutils::GetWeChatWinBase();
uint64_t get_contact_mgr_addr = base_addr + offset::kGetContactMgr;
uint64_t get_contact_list_addr = base_addr + offset::kGetContactList;
func::__GetContactMgr get_contact_mgr =
(func::__GetContactMgr)get_contact_mgr_addr;
func::__GetContactList get_contact_list =
(func::__GetContactList)get_contact_list_addr;
uint64_t mgr = get_contact_mgr();
uint64_t contact_vec[3] = {0, 0, 0};
success = get_contact_list(mgr, reinterpret_cast<uint64_t>(&contact_vec));
uint64_t start = contact_vec[0];
uint64_t end = contact_vec[2];
std::vector<wechat::ContactInner> vec;
while (start < end) {
wechat::ContactInner temp;
temp.wxid = wxutils::ReadWstringThenConvert(start + 0x10);
temp.custom_account = wxutils::ReadWstringThenConvert(start + 0x30);
temp.encrypt_name = wxutils::ReadWstringThenConvert(start + 0x50);
temp.remark = wxutils::ReadWstringThenConvert(start + 0x80);
temp.remark_pinyin = wxutils::ReadWstringThenConvert(start + 0x148);
temp.remark_pinyin_all = wxutils::ReadWstringThenConvert(start + 0x168);
temp.label_ids = wxutils::ReadWstringThenConvert(start + 0xc0);
temp.nickname = wxutils::ReadWstringThenConvert(start + 0xA0);
temp.pinyin = wxutils::ReadWstringThenConvert(start + 0x108);
temp.pinyin_all = wxutils::ReadWstringThenConvert(start + 0x128);
temp.verify_flag = *(int32_t *)(start + 0x70);
temp.type = *(int32_t *)(start + 0x74);
temp.reserved1 = *(int32_t *)(start + 0x1F0);
temp.reserved2 = *(int32_t *)(start + 0x1F4);
vec.push_back(temp);
start += 0x6A8;
}
int64_t success = wechat::WeChatService::GetInstance().GetContacts(vec);
nlohmann::json ret_data = {
{"code", success}, {"data", {}}, {"msg", "success"}};
for (unsigned int i = 0; i < vec.size(); i++) {

View File

@ -1,210 +1,22 @@
#include "misc_controller.h"
#include "json_utils.h"
#include "memory.h"
#include "nlohmann/json.hpp"
#include "offset.h"
#include "spdlog/spdlog.h"
#include "tinyxml2.h"
#include "utils.h"
#include "wechat_db.h"
#include "wechat_interface.h"
#include "wxutils.h"
#include "wechat_service.h"
namespace offset = wechat::offset;
namespace prototype = wechat::prototype;
namespace func = wechat::function;
namespace utils = base::utils;
namespace jsonutils = wxhelper::jsonutils;
namespace wxhelper {
std::string MiscController::CheckLogin(std::string params) {
int64_t success = -1;
int64_t base_addr = wxutils::GetWeChatWinBase();
uint64_t accout_service_addr = base_addr + offset::kGetAccountServiceMgr;
func::__GetAccountService GetSevice =
(func::__GetAccountService)accout_service_addr;
uint64_t service_addr = GetSevice();
if (service_addr) {
success = *(uint64_t *)(service_addr + 0x7F8);
}
int64_t success = wechat::WeChatService::GetInstance().CheckLogin();
nlohmann::json ret = {{"code", success}, {"data", {}}, {"msg", "success"}};
return ret.dump();
}
std::string MiscController::GetUserInfo(std::string params) {
int64_t success = -1;
int64_t base_addr = wxutils::GetWeChatWinBase();
uint64_t accout_service_addr = base_addr + offset::kGetAccountServiceMgr;
uint64_t get_app_data_save_path_addr =
base_addr + offset::kGetAppDataSavePath;
uint64_t get_current_data_path_addr = base_addr + offset::kGetCurrentDataPath;
func::__GetAccountService GetSevice =
(func::__GetAccountService)accout_service_addr;
func::__GetDataSavePath GetDataSavePath =
(func::__GetDataSavePath)get_app_data_save_path_addr;
func::__GetCurrentDataPath GetCurrentDataPath =
(func::__GetCurrentDataPath)get_current_data_path_addr;
wechat::SelfInfoInner out;
uint64_t service_addr = GetSevice();
if (service_addr) {
if (*(int64_t *)(service_addr + 0x80) == 0 ||
*(int64_t *)(service_addr + 0x80 + 0x10) == 0) {
out.wxid = std::string();
} else {
if (*(int64_t *)(service_addr + 0x80 + 0x18) == 0xF) {
out.wxid = std::string((char *)(service_addr + 0x80),
*(int64_t *)(service_addr + 0x80 + 0x10));
} else {
out.wxid = std::string(*(char **)(service_addr + 0x80),
*(int64_t *)(service_addr + 0x80 + 0x10));
}
}
if (*(int64_t *)(service_addr + 0x108) == 0 ||
*(int64_t *)(service_addr + 0x108 + 0x10) == 0) {
out.account = std::string();
} else {
if (*(int64_t *)(service_addr + 0x108 + 0x18) == 0xF) {
out.account = std::string((char *)(service_addr + 0x108),
*(int64_t *)(service_addr + 0x108 + 0x10));
} else {
out.account = std::string(*(char **)(service_addr + 0x108),
*(int64_t *)(service_addr + 0x108 + 0x10));
}
}
if (*(int64_t *)(service_addr + 0x128) == 0 ||
*(int64_t *)(service_addr + 0x128 + 0x10) == 0) {
out.mobile = std::string();
} else {
if (*(int64_t *)(service_addr + 0x128 + 0x18) == 0xF) {
out.mobile = std::string((char *)(service_addr + 0x128),
*(int64_t *)(service_addr + 0x128 + 0x10));
} else {
out.mobile = std::string(*(char **)(service_addr + 0x128),
*(int64_t *)(service_addr + 0x128 + 0x10));
}
}
if (*(int64_t *)(service_addr + 0x148) == 0 ||
*(int64_t *)(service_addr + 0x148 + 0x10) == 0) {
out.signature = std::string();
} else {
if (*(int64_t *)(service_addr + 0x148 + 0x18) == 0xF) {
out.signature = std::string((char *)(service_addr + 0x148),
*(int64_t *)(service_addr + 0x148 + 0x10));
} else {
out.signature = std::string(*(char **)(service_addr + 0x148),
*(int64_t *)(service_addr + 0x148 + 0x10));
}
}
if (*(int64_t *)(service_addr + 0x168) == 0 ||
*(int64_t *)(service_addr + 0x168 + 0x10) == 0) {
out.country = std::string();
} else {
if (*(int64_t *)(service_addr + 0x168 + 0x18) == 0xF) {
out.country = std::string((char *)(service_addr + 0x168),
*(int64_t *)(service_addr + 0x168 + 0x10));
} else {
out.country = std::string(*(char **)(service_addr + 0x168),
*(int64_t *)(service_addr + 0x168 + 0x10));
}
}
if (*(int64_t *)(service_addr + 0x188) == 0 ||
*(int64_t *)(service_addr + 0x188 + 0x10) == 0) {
out.province = std::string();
} else {
if (*(int64_t *)(service_addr + 0x188 + 0x18) == 0xF) {
out.province = std::string((char *)(service_addr + 0x188),
*(int64_t *)(service_addr + 0x188 + 0x10));
} else {
out.province = std::string(*(char **)(service_addr + 0x188),
*(int64_t *)(service_addr + 0x188 + 0x10));
}
}
if (*(int64_t *)(service_addr + 0x1A8) == 0 ||
*(int64_t *)(service_addr + 0x1A8 + 0x10) == 0) {
out.city = std::string();
} else {
if (*(int64_t *)(service_addr + 0x1A8 + 0x18) == 0xF) {
out.city = std::string((char *)(service_addr + 0x1A8),
*(int64_t *)(service_addr + 0x1A8 + 0x10));
} else {
out.city = std::string(*(char **)(service_addr + 0x1A8),
*(int64_t *)(service_addr + 0x1A8 + 0x10));
}
}
if (*(int64_t *)(service_addr + 0x1E8) == 0 ||
*(int64_t *)(service_addr + 0x1E8 + 0x10) == 0) {
out.name = std::string();
} else {
if (*(int64_t *)(service_addr + 0x1E8 + 0x18) == 0xF) {
out.name = std::string((char *)(service_addr + 0x1E8),
*(int64_t *)(service_addr + 0x1E8 + 0x10));
} else {
out.name = std::string(*(char **)(service_addr + 0x1E8),
*(int64_t *)(service_addr + 0x1E8 + 0x10));
}
}
if (*(int64_t *)(service_addr + 0x450) == 0 ||
*(int64_t *)(service_addr + 0x450 + 0x10) == 0) {
out.head_img = std::string();
} else {
out.head_img = std::string(*(char **)(service_addr + 0x450),
*(int64_t *)(service_addr + 0x450 + 0x10));
}
if (*(int64_t *)(service_addr + 0x7B8) == 0 ||
*(int64_t *)(service_addr + 0x7B8 + 0x10) == 0) {
out.public_key = std::string();
} else {
out.public_key = std::string(*(char **)(service_addr + 0x7B8),
*(int64_t *)(service_addr + 0x7B8 + 0x10));
}
if (*(int64_t *)(service_addr + 0x7D8) == 0 ||
*(int64_t *)(service_addr + 0x7D8 + 0x10) == 0) {
out.private_key = std::string();
} else {
out.private_key = std::string(*(char **)(service_addr + 0x7D8),
*(int64_t *)(service_addr + 0x7D8 + 0x10));
}
if (*(int64_t *)(service_addr + 0x6E0) == 0 ||
*(int64_t *)(service_addr + 0x6E8) == 0) {
out.db_key = std::string();
} else {
int64_t byte_addr = *(int64_t *)(service_addr + 0x6E0);
int64_t len = *(int64_t *)(service_addr + 0x6E8);
out.db_key =
base::utils::Bytes2Hex((BYTE *)byte_addr, static_cast<int>(len));
}
uint64_t flag = *(uint64_t *)(service_addr + 0x7F8);
if (flag == 1) {
prototype::WeChatString current_data_path;
GetCurrentDataPath(reinterpret_cast<ULONG_PTR>(&current_data_path));
if (current_data_path.ptr) {
out.current_data_path = base::utils::WstringToUtf8(
std::wstring(current_data_path.ptr, current_data_path.length));
} else {
out.current_data_path = std::string();
}
}
}
prototype::WeChatString data_save_path;
GetCurrentDataPath(reinterpret_cast<ULONG_PTR>(&data_save_path));
if (data_save_path.ptr) {
out.data_save_path = base::utils::WstringToUtf8(
std::wstring(data_save_path.ptr, data_save_path.length));
} else {
out.data_save_path = std::string();
}
success = 1;
int64_t success = wechat::WeChatService::GetInstance().GetSelfInfo(out);
nlohmann::json ret = {{"code", success}, {"data", {}}, {"msg", "success"}};
nlohmann::json j_info = {
{"name", out.name},
@ -261,65 +73,50 @@ std::string MiscController::DoOcrTask(std::string params) {
return ret.dump();
}
std::string MiscController::LockWeChat(std::string params) {
int64_t success = -1;
int64_t base_addr = wxutils::GetWeChatWinBase();
uint64_t lock_mgr_addr = base_addr + offset::kGetLockWechatMgr;
uint64_t request_lock_addr = base_addr + offset::kRequestLockWechat;
func::__GetLockWechatMgr get_lock_mgr =
(func::__GetLockWechatMgr)lock_mgr_addr;
func::__RequestLockWechat request_lock =
(func::__RequestLockWechat)request_lock_addr;
uint64_t mgr = get_lock_mgr();
success = request_lock(mgr);
int64_t success = wechat::WeChatService::GetInstance().LockWeChat();
nlohmann::json ret = {{"code", success}, {"data", {}}, {"msg", "success"}};
return ret.dump();
}
std::string MiscController::UnlockWeChat(std::string params) {
int64_t success = -1;
int64_t base_addr = wxutils::GetWeChatWinBase();
uint64_t lock_mgr_addr = base_addr + offset::kGetLockWechatMgr;
uint64_t request_unlock_addr = base_addr + offset::kRequestUnLockWechat;
func::__GetLockWechatMgr get_lock_mgr =
(func::__GetLockWechatMgr)lock_mgr_addr;
func::__RequestUnLockWechat request_unlock =
(func::__RequestUnLockWechat)request_unlock_addr;
uint64_t mgr = get_lock_mgr();
success = request_unlock(mgr);
int64_t success = wechat::WeChatService::GetInstance().UnlockWeChat();
nlohmann::json ret = {{"code", success}, {"data", {}}, {"msg", "success"}};
return ret.dump();
}
std::string MiscController::ClickEnterWeChat(std::string params) {
nlohmann::json ret = {
{"code", 200}, {"data", {}}, {"msg", "Not Implemented"}};
int64_t success = wechat::WeChatService::GetInstance().EnterWeChat();
nlohmann::json ret = {{"code", success}, {"data", {}}, {"msg", "success"}};
return ret.dump();
}
std::string MiscController::GetLoginUrl(std::string params) {
int64_t success = -1;
int64_t base_addr = wxutils::GetWeChatWinBase();
uint64_t login_mgr_addr = base_addr + offset::kGetQRCodeLoginMgr;
func::__GetQRCodeLoginMgr get = (func::__GetQRCodeLoginMgr)login_mgr_addr;
uint64_t addr = get();
std::string login_url = wxutils::ReadWeChatStr(addr + 0x68);
success = 1;
std::string login_url = wechat::WeChatService::GetInstance().GetLoginUrl();
nlohmann::json ret = {
{"code", success},
{"data", {"loginUrl", "http://weixin.qq.com/x/" + login_url}},
{"msg", "success"}};
{"code", 1}, {"data", {"loginUrl", login_url}}, {"msg", "success"}};
return ret.dump();
}
std::string MiscController::TranslateVoice(std::string params) {
nlohmann::json ret = {
{"code", 200}, {"data", {}}, {"msg", "Not Implemented"}};
nlohmann::json jp = nlohmann::json::parse(params);
int64_t msg_id = jsonutils::GetInt64Param(jp, "msgId");
int64_t success = wechat::WeChatService::GetInstance().TranslateVoice(msg_id);
nlohmann::json ret = {{"code", success}, {"data", {}}, {"msg", "success"}};
return ret.dump();
}
std::string MiscController::GetTranslateVoiceText(std::string params) {
nlohmann::json ret = {
{"code", 200}, {"data", {}}, {"msg", "Not Implemented"}};
return ret.dump();
nlohmann::json jp = nlohmann::json::parse(params);
int64_t msg_id = jsonutils::GetInt64Param(jp, "msgId");
std::string content =
wechat::WeChatService::GetInstance().GetTranslateVoiceText(msg_id);
nlohmann::json ret_data = {
{"code", 1}, {"msg", "success"}, {"data", {{"transtext", content}}}};
return ret_data.dump();
}
std::string MiscController::OpenUrlByWeChat(std::string params) {
nlohmann::json jp = nlohmann::json::parse(params);
std::wstring url = jsonutils::GetWStringParam(jp, "url");
int flag = jsonutils::GetIntParam(jp, "flag");
int64_t success =
wechat::WeChatService::GetInstance().OpenUrlByWeChatBrowser(url, flag);
nlohmann::json ret = {
{"code", 200}, {"data", {}}, {"msg", "Not Implemented"}};
{"code", success}, {"data", {}}, {"msg", "Not Implemented"}};
return ret.dump();
}
std::string MiscController::ConfirmReceipt(std::string params) {

View File

@ -4,6 +4,7 @@
namespace wechat {
#define V_3_9_8_25 39825
#define V_3_9_9_43 39943
#define V_3_9_10_19 391019
#ifndef WECHAT_VERSION
#error " WECHAT_VERSION not defined ."
#endif
@ -187,7 +188,124 @@ const uint64_t kHookLog = 0x1304e60;
const uint64_t kCreateChatRoom = 0xe63340;
const uint64_t kQuitChatRoom = 0xe6e3b0;
const uint64_t kForwardMsg = 0x1091660;
const uint64_t kForwardMsg = 0x11dd780;
const uint64_t kOnSnsTimeLineSceneFinish = 0x1a73150;
const uint64_t kSNSGetFirstPage = 0x1a51dd0;
const uint64_t kSNSGetNextPageScene = 0x1a77240;
const uint64_t kSNSDataMgr = 0xeebda0;
const uint64_t kSNSTimeLineMgr = 0x19e83a0;
const uint64_t kGetMgrByPrefixLocalId = 0x105a010;
const uint64_t kAddFavFromMsg = 0x1601520;
const uint64_t kGetChatMgr = 0xaafd90;
const uint64_t kGetFavoriteMgr = 0x8c69b0;
const uint64_t kAddFavFromImage = 0x160b920;
const uint64_t kGetContact = 0xf67060;
const uint64_t kNewContact = 0x12e01f0;
const uint64_t kFreeContact = 0x12e08a0;
const uint64_t kNewMMReaderItem = 0x8c79a0;
const uint64_t kFreeMMReaderItem = 0x8c6da0;
const uint64_t kForwordPublicMsg = 0xddc6c0;
const uint64_t kParseAppMsgXml = 0x11b0a70;
const uint64_t kNewAppMsgInfo = 0x91a550;
const uint64_t kFreeAppMsgInfo = 0x8fd1a0;
const uint64_t kGetPreDownLoadMgr = 0x9996f0;
const uint64_t kPushAttachTask = 0x9c0080;
const uint64_t kGetCustomSmileyMgr = 0x915c00;
const uint64_t kSendCustomEmotion = 0xec0a40;
const uint64_t kNewJsApiShareAppMessage = 0x13be1a0;
const uint64_t kInitJsConfig = 0x137bc00;
const uint64_t kSendApplet = 0x13c0920;
const uint64_t kSendAppletSecond = 0x13c1150;
const uint64_t kGetAppInfoByWaid = 0x13c5790;
const uint64_t kCopyShareAppMessageRequest = 0x13c0670;
const uint64_t kNewWAUpdatableMsgInfo = 0x919ca0;
const uint64_t kFreeWAUpdatableMsgInfo = 0x8fc230;
const uint64_t kSendPatMsg = 0x195f340;
const uint64_t kGetOCRManager = 0x999780;
const uint64_t kDoOCRTask = 0x190b2a0;
const uint64_t kGetLockWechatMgr = 0xbadb10;
const uint64_t kRequestLockWechat = 0xb63770;
const uint64_t kRequestUnLockWechat = 0xb63a10;
const uint64_t kOnLoginBtnClick = 0xf4d0f0;
const uint64_t kGetQRCodeLoginMgr = 0xf3fa20;
const uint64_t kUpdateMsg = 0xf15c40;
const uint64_t kGetVoiceMgr = 0xbf78f0;
const uint64_t kChatMsg2NetSceneSendMsg = 0x96e8d0;
const uint64_t kTranslateVoice = 0x11217e0;
const uint64_t kNewWebViewPageConfig = 0x9512f0;
const uint64_t kFreeWebViewPageConfig = 0x951520;
const uint64_t kGetWebViewMgr = 0x9412d0;
const uint64_t kShowWebView = 0x1d236b0;
const uint64_t kSetUrl = 0x13dd410;
#elif WECHAT_VERSION == V_3_9_10_19
const uint64_t kGetAccountServiceMgr = 0xa7df30;
const uint64_t kSyncMsg = 0xc39680;
const uint64_t kSyncMsgNext = 0xc39680;
const uint64_t kGetCurrentDataPath = 0x11664e0;
const uint64_t kGetAppDataSavePath = 0x14f29c0;
const uint64_t kGetSendMessageMgr = 0xa7c730;
const uint64_t kSendTextMsg = 0x238ec70;
const uint64_t kFreeChatMsg = 0x1c1fef0;
const uint64_t kDoAddMsg = 0x1225a60;
const uint64_t kSendImageMsg = 0x2384400;
const uint64_t kChatMsgInstanceCounter = 0x1c287e0;
const uint64_t kSendFileMsg = 0x2197a40;
const uint64_t kGetAppMsgMgr = 0x1c23610;
const uint64_t kGetContactMgr = 0xa69fd0;
const uint64_t kGetContactList = 0x10b8420;
const uint64_t k_sqlite3_exec = 0x288ea10;
const uint64_t k_sqlite3_prepare = 0x2896590;
const uint64_t k_sqlite3_open = 0x28cdd90;
const uint64_t k_sqlite3_step = 0x2852a20;
const uint64_t k_sqlite3_column_count = 0x2853240;
const uint64_t k_sqlite3_column_name = 0x2853c40;
const uint64_t k_sqlite3_column_type = 0x2853a90;
const uint64_t k_sqlite3_column_blob = 0x2853270;
const uint64_t k_sqlite3_column_bytes = 0x2853360;
const uint64_t k_sqlite3_finalize = 0x2851ad0;
const uint64_t kGPInstance = 0x4076558;
const uint64_t kMicroMsgDB = 0xb8;
const uint64_t kChatMsgDB = 0x2c8;
const uint64_t kMiscDB = 0x5f0;
const uint64_t kEmotionDB = 0x888;
const uint64_t kMediaDB = 0xF48;
const uint64_t kBizchatMsgDB = 0x1AC0;
const uint64_t kFunctionMsgDB = 0x1b98;
const uint64_t kDBName = 0x28;
const uint64_t kStorageStart = 0x0;
const uint64_t kStorageEnd = 0x0;
const uint64_t kMultiDBMgr = 0x40ecf98;
const uint64_t kPublicMsgMgr = 0x40ea558;
const uint64_t kFavoriteStorageMgr = 0x40edb28;
const uint64_t kHardLinkMgr = 0x40ecec0;
const uint64_t kChatRoomMgr = 0x8e9d30;
const uint64_t kGetChatRoomDetailInfo = 0xe73590;
const uint64_t kNewChatRoomInfo = 0x12006b0;
const uint64_t kFreeChatRoomInfo = 0x1200890;
const uint64_t kDoAddMemberToChatRoom = 0xe63c70;
const uint64_t kDoModChatRoomMemberNickName = 0xe6db00;
const uint64_t kDelMemberFromChatRoom = 0xe64290;
const uint64_t kGetMemberFromChatRoom = 0xe74de0;
const uint64_t kNewChatRoom = 0x11fde50;
const uint64_t kFreeChatRoom = 0x11fe030;
const uint64_t kTopMsg = 0xa5e4f0;
const uint64_t kRemoveTopMsg = 0xe787b0;
const uint64_t kInviteMember = 0xe63650;
const uint64_t kHookLog = 0x1304e60;
const uint64_t kCreateChatRoom = 0xe63340;
const uint64_t kQuitChatRoom = 0xe6e3b0;
const uint64_t kForwardMsg = 0x11dd780;
const uint64_t kOnSnsTimeLineSceneFinish = 0x1a73150;
const uint64_t kSNSGetFirstPage = 0x1a51dd0;

View File

@ -0,0 +1,823 @@
#include "wechat_service.h"
#include "json_utils.h"
#include "memory.h"
#include "spdlog/spdlog.h"
#include "tinyxml2.h"
#include "utils.h"
#include "wechat_db.h"
#include "wxutils.h"
namespace offset = wechat::offset;
namespace prototype = wechat::prototype;
namespace func = wechat::function;
namespace utils = base::utils;
namespace jsonutils = wxhelper::jsonutils;
namespace wxutils = wxhelper::wxutils;
prototype::WeChatString* BuildWechatString(const std::wstring& ws) {
prototype::WeChatString* p =
base::utils::WxHeapAlloc<prototype::WeChatString>(
sizeof(prototype::WeChatString));
wchar_t* p_chat_room_id =
base::utils::WxHeapAlloc<wchar_t>((ws.size() + 1) * 2);
wmemcpy(p_chat_room_id, ws.c_str(), ws.size() + 1);
p->ptr = p_chat_room_id;
p->length = static_cast<int32_t>(ws.size());
p->max_length = static_cast<int32_t>(ws.size());
p->c_len = 0;
p->c_ptr = 0;
return p;
}
wechat::WeChatService::~WeChatService() {}
void wechat::WeChatService::Init() { base_addr_ = wxutils::GetWeChatWinBase(); }
int64_t wechat::WeChatService::CheckLogin() {
int64_t success = -1;
uint64_t accout_service_addr = base_addr_ + offset::kGetAccountServiceMgr;
func::__GetAccountService GetSevice =
(func::__GetAccountService)accout_service_addr;
uint64_t service_addr = GetSevice();
if (service_addr) {
success = *(uint64_t*)(service_addr + 0x7F8);
}
return success;
}
int64_t wechat::WeChatService::GetSelfInfo(SelfInfoInner& out) {
int64_t success = -1;
uint64_t accout_service_addr = base_addr_ + offset::kGetAccountServiceMgr;
uint64_t get_app_data_save_path_addr =
base_addr_ + offset::kGetAppDataSavePath;
uint64_t get_current_data_path_addr =
base_addr_ + offset::kGetCurrentDataPath;
func::__GetAccountService GetSevice =
(func::__GetAccountService)accout_service_addr;
func::__GetDataSavePath GetDataSavePath =
(func::__GetDataSavePath)get_app_data_save_path_addr;
func::__GetCurrentDataPath GetCurrentDataPath =
(func::__GetCurrentDataPath)get_current_data_path_addr;
uint64_t service_addr = GetSevice();
if (service_addr) {
if (*(int64_t*)(service_addr + 0x80) == 0 ||
*(int64_t*)(service_addr + 0x80 + 0x10) == 0) {
out.wxid = std::string();
} else {
if (*(int64_t*)(service_addr + 0x80 + 0x18) == 0xF) {
out.wxid = std::string((char*)(service_addr + 0x80),
*(int64_t*)(service_addr + 0x80 + 0x10));
} else {
out.wxid = std::string(*(char**)(service_addr + 0x80),
*(int64_t*)(service_addr + 0x80 + 0x10));
}
}
if (*(int64_t*)(service_addr + 0x108) == 0 ||
*(int64_t*)(service_addr + 0x108 + 0x10) == 0) {
out.account = std::string();
} else {
if (*(int64_t*)(service_addr + 0x108 + 0x18) == 0xF) {
out.account = std::string((char*)(service_addr + 0x108),
*(int64_t*)(service_addr + 0x108 + 0x10));
} else {
out.account = std::string(*(char**)(service_addr + 0x108),
*(int64_t*)(service_addr + 0x108 + 0x10));
}
}
if (*(int64_t*)(service_addr + 0x128) == 0 ||
*(int64_t*)(service_addr + 0x128 + 0x10) == 0) {
out.mobile = std::string();
} else {
if (*(int64_t*)(service_addr + 0x128 + 0x18) == 0xF) {
out.mobile = std::string((char*)(service_addr + 0x128),
*(int64_t*)(service_addr + 0x128 + 0x10));
} else {
out.mobile = std::string(*(char**)(service_addr + 0x128),
*(int64_t*)(service_addr + 0x128 + 0x10));
}
}
if (*(int64_t*)(service_addr + 0x148) == 0 ||
*(int64_t*)(service_addr + 0x148 + 0x10) == 0) {
out.signature = std::string();
} else {
if (*(int64_t*)(service_addr + 0x148 + 0x18) == 0xF) {
out.signature = std::string((char*)(service_addr + 0x148),
*(int64_t*)(service_addr + 0x148 + 0x10));
} else {
out.signature = std::string(*(char**)(service_addr + 0x148),
*(int64_t*)(service_addr + 0x148 + 0x10));
}
}
if (*(int64_t*)(service_addr + 0x168) == 0 ||
*(int64_t*)(service_addr + 0x168 + 0x10) == 0) {
out.country = std::string();
} else {
if (*(int64_t*)(service_addr + 0x168 + 0x18) == 0xF) {
out.country = std::string((char*)(service_addr + 0x168),
*(int64_t*)(service_addr + 0x168 + 0x10));
} else {
out.country = std::string(*(char**)(service_addr + 0x168),
*(int64_t*)(service_addr + 0x168 + 0x10));
}
}
if (*(int64_t*)(service_addr + 0x188) == 0 ||
*(int64_t*)(service_addr + 0x188 + 0x10) == 0) {
out.province = std::string();
} else {
if (*(int64_t*)(service_addr + 0x188 + 0x18) == 0xF) {
out.province = std::string((char*)(service_addr + 0x188),
*(int64_t*)(service_addr + 0x188 + 0x10));
} else {
out.province = std::string(*(char**)(service_addr + 0x188),
*(int64_t*)(service_addr + 0x188 + 0x10));
}
}
if (*(int64_t*)(service_addr + 0x1A8) == 0 ||
*(int64_t*)(service_addr + 0x1A8 + 0x10) == 0) {
out.city = std::string();
} else {
if (*(int64_t*)(service_addr + 0x1A8 + 0x18) == 0xF) {
out.city = std::string((char*)(service_addr + 0x1A8),
*(int64_t*)(service_addr + 0x1A8 + 0x10));
} else {
out.city = std::string(*(char**)(service_addr + 0x1A8),
*(int64_t*)(service_addr + 0x1A8 + 0x10));
}
}
if (*(int64_t*)(service_addr + 0x1E8) == 0 ||
*(int64_t*)(service_addr + 0x1E8 + 0x10) == 0) {
out.name = std::string();
} else {
if (*(int64_t*)(service_addr + 0x1E8 + 0x18) == 0xF) {
out.name = std::string((char*)(service_addr + 0x1E8),
*(int64_t*)(service_addr + 0x1E8 + 0x10));
} else {
out.name = std::string(*(char**)(service_addr + 0x1E8),
*(int64_t*)(service_addr + 0x1E8 + 0x10));
}
}
if (*(int64_t*)(service_addr + 0x450) == 0 ||
*(int64_t*)(service_addr + 0x450 + 0x10) == 0) {
out.head_img = std::string();
} else {
out.head_img = std::string(*(char**)(service_addr + 0x450),
*(int64_t*)(service_addr + 0x450 + 0x10));
}
if (*(int64_t*)(service_addr + 0x7B8) == 0 ||
*(int64_t*)(service_addr + 0x7B8 + 0x10) == 0) {
out.public_key = std::string();
} else {
out.public_key = std::string(*(char**)(service_addr + 0x7B8),
*(int64_t*)(service_addr + 0x7B8 + 0x10));
}
if (*(int64_t*)(service_addr + 0x7D8) == 0 ||
*(int64_t*)(service_addr + 0x7D8 + 0x10) == 0) {
out.private_key = std::string();
} else {
out.private_key = std::string(*(char**)(service_addr + 0x7D8),
*(int64_t*)(service_addr + 0x7D8 + 0x10));
}
if (*(int64_t*)(service_addr + 0x6E0) == 0 ||
*(int64_t*)(service_addr + 0x6E8) == 0) {
out.db_key = std::string();
} else {
int64_t byte_addr = *(int64_t*)(service_addr + 0x6E0);
int64_t len = *(int64_t*)(service_addr + 0x6E8);
out.db_key =
base::utils::Bytes2Hex((BYTE*)byte_addr, static_cast<int>(len));
}
uint64_t flag = *(uint64_t*)(service_addr + 0x7F8);
if (flag == 1) {
prototype::WeChatString current_data_path;
GetCurrentDataPath(reinterpret_cast<ULONG_PTR>(&current_data_path));
if (current_data_path.ptr) {
out.current_data_path = base::utils::WstringToUtf8(
std::wstring(current_data_path.ptr, current_data_path.length));
} else {
out.current_data_path = std::string();
}
}
}
prototype::WeChatString data_save_path;
GetCurrentDataPath(reinterpret_cast<ULONG_PTR>(&data_save_path));
if (data_save_path.ptr) {
out.data_save_path = base::utils::WstringToUtf8(
std::wstring(data_save_path.ptr, data_save_path.length));
} else {
out.data_save_path = std::string();
}
success = 1;
return success;
}
int64_t wechat::WeChatService::SendTextMsg(const std::wstring& wxid,
const std::wstring& msg) {
prototype::WeChatString to_user(wxid);
prototype::WeChatString text_msg(msg);
uint64_t send_message_mgr_addr = base_addr_ + offset::kGetSendMessageMgr;
uint64_t send_text_msg_addr = base_addr_ + offset::kSendTextMsg;
uint64_t free_chat_msg_addr = base_addr_ + offset::kFreeChatMsg;
char chat_msg[0x460] = {0};
uint64_t temp[3] = {0};
func::__GetSendMessageMgr mgr;
mgr = (func::__GetSendMessageMgr)send_message_mgr_addr;
func::__SendTextMsg send;
send = (func::__SendTextMsg)send_text_msg_addr;
func::__FreeChatMsg free;
free = (func::__FreeChatMsg)free_chat_msg_addr;
mgr();
uint64_t success = send(reinterpret_cast<uint64_t>(&chat_msg),
reinterpret_cast<uint64_t>(&to_user),
reinterpret_cast<uint64_t>(&text_msg),
reinterpret_cast<uint64_t>(&temp), 1, 1, 0, 0);
free(reinterpret_cast<uint64_t>(&chat_msg));
return 0;
}
int64_t wechat::WeChatService::SendImageMsg(const std::wstring& wxid,
const std::wstring& image_path) {
int64_t success = -1;
prototype::WeChatString to_user(wxid);
prototype::WeChatString image_full_path(image_path);
uint64_t send_message_mgr_addr = base_addr_ + offset::kGetSendMessageMgr;
uint64_t send_img_addr = base_addr_ + offset::kSendImageMsg;
uint64_t new_chat_msg_addr = base_addr_ + offset::kChatMsgInstanceCounter;
uint64_t free_chat_msg_addr = base_addr_ + offset::kFreeChatMsg;
func::__NewChatMsg new_chat_msg = (func::__NewChatMsg)new_chat_msg_addr;
func::__GetSendMessageMgr mgr =
(func::__GetSendMessageMgr)send_message_mgr_addr;
func::__SendImageMsg send_img = (func::__SendImageMsg)send_img_addr;
func::__FreeChatMsg free = (func::__FreeChatMsg)free_chat_msg_addr;
char chat_msg[0x460] = {0};
char chat_msg_temp[0x460] = {0};
uint64_t p_chat_msg_temp =
new_chat_msg(reinterpret_cast<uint64_t>(&chat_msg_temp));
uint64_t temp1 = 0;
uint64_t temp2 = 0;
uint64_t* flag[10] = {};
flag[8] = &temp1;
flag[9] = &temp2;
flag[1] = reinterpret_cast<uint64_t*>(p_chat_msg_temp);
uint64_t p_chat_msg = new_chat_msg(reinterpret_cast<uint64_t>(&chat_msg));
uint64_t send_mgr = mgr();
success = send_img(send_mgr, p_chat_msg, reinterpret_cast<uint64_t>(&to_user),
reinterpret_cast<uint64_t>(&image_full_path),
reinterpret_cast<uint64_t>(&flag));
free(p_chat_msg);
free(p_chat_msg_temp);
return success;
}
int64_t wechat::WeChatService::SendFileMsg(const std::wstring& wxid,
const std::wstring& file_path) {
int64_t success = -1;
prototype::WeChatString* to_user = (prototype::WeChatString*)HeapAlloc(
GetProcessHeap(), 0, sizeof(prototype::WeChatString));
wchar_t* ptr_wxid =
(wchar_t*)HeapAlloc(GetProcessHeap(), 0, (wxid.length() + 1) * 2);
wmemcpy(ptr_wxid, wxid.c_str(), wxid.length() + 1);
to_user->ptr = ptr_wxid;
to_user->length = static_cast<DWORD>(wxid.length());
to_user->max_length = static_cast<DWORD>(wxid.length());
to_user->c_len = 0;
to_user->c_ptr = 0;
prototype::WeChatString* file_full_path = (prototype::WeChatString*)HeapAlloc(
GetProcessHeap(), 0, sizeof(prototype::WeChatString));
wchar_t* ptr_path =
(wchar_t*)HeapAlloc(GetProcessHeap(), 0, (file_path.length() + 1) * 2);
wmemcpy(ptr_path, file_path.c_str(), file_path.length() + 1);
file_full_path->ptr = ptr_path;
file_full_path->length = static_cast<DWORD>(file_path.length());
file_full_path->max_length = static_cast<DWORD>(file_path.length());
file_full_path->c_len = 0;
file_full_path->c_ptr = 0;
uint64_t get_app_msg_mgr_addr = base_addr_ + offset::kGetAppMsgMgr;
uint64_t send_file_addr = base_addr_ + offset::kSendFileMsg;
uint64_t new_chat_msg_addr = base_addr_ + offset::kChatMsgInstanceCounter;
uint64_t free_chat_msg_addr = base_addr_ + offset::kFreeChatMsg;
func::__NewChatMsg new_chat_msg = (func::__NewChatMsg)new_chat_msg_addr;
func::__GetAppMsgMgr get_app_mgr = (func::__GetAppMsgMgr)get_app_msg_mgr_addr;
func::__SendFile send_file = (func::__SendFile)send_file_addr;
func::__FreeChatMsg free = (func::__FreeChatMsg)free_chat_msg_addr;
char* chat_msg = (char*)HeapAlloc(GetProcessHeap(), 0, 0x460);
uint64_t* temp1 =
(uint64_t*)HeapAlloc(GetProcessHeap(), 0, sizeof(uint64_t) * 4);
uint64_t* temp2 =
(uint64_t*)HeapAlloc(GetProcessHeap(), 0, sizeof(uint64_t) * 4);
uint64_t* temp3 =
(uint64_t*)HeapAlloc(GetProcessHeap(), 0, sizeof(uint64_t) * 4);
uint64_t* temp4 =
(uint64_t*)HeapAlloc(GetProcessHeap(), 0, sizeof(uint64_t) * 4);
ZeroMemory(temp1, sizeof(uint64_t) * 4);
ZeroMemory(temp2, sizeof(uint64_t) * 4);
ZeroMemory(temp3, sizeof(uint64_t) * 4);
ZeroMemory(temp4, sizeof(uint64_t) * 4);
*temp4 = 0x1F;
uint64_t app_mgr = get_app_mgr();
success = send_file(app_mgr, reinterpret_cast<uint64_t>(chat_msg),
reinterpret_cast<uint64_t>(to_user),
reinterpret_cast<uint64_t>(file_full_path), 1,
reinterpret_cast<uint64_t>(temp1), 0,
reinterpret_cast<uint64_t>(temp2), 0,
reinterpret_cast<uint64_t>(temp3), 0, 0);
free(reinterpret_cast<uint64_t>(chat_msg));
HeapFree(GetProcessHeap(), 0, to_user);
HeapFree(GetProcessHeap(), 0, file_full_path);
HeapFree(GetProcessHeap(), 0, temp1);
HeapFree(GetProcessHeap(), 0, temp2);
HeapFree(GetProcessHeap(), 0, temp3);
HeapFree(GetProcessHeap(), 0, temp4);
return success;
}
int64_t wechat::WeChatService::GetContacts(std::vector<ContactInner>& vec) {
int64_t success = -1;
int64_t base_addr = wxutils::GetWeChatWinBase();
uint64_t get_contact_mgr_addr = base_addr + offset::kGetContactMgr;
uint64_t get_contact_list_addr = base_addr + offset::kGetContactList;
func::__GetContactMgr get_contact_mgr =
(func::__GetContactMgr)get_contact_mgr_addr;
func::__GetContactList get_contact_list =
(func::__GetContactList)get_contact_list_addr;
uint64_t mgr = get_contact_mgr();
uint64_t contact_vec[3] = {0, 0, 0};
success = get_contact_list(mgr, reinterpret_cast<uint64_t>(&contact_vec));
uint64_t start = contact_vec[0];
uint64_t end = contact_vec[2];
while (start < end) {
wechat::ContactInner temp;
temp.wxid = wxutils::ReadWstringThenConvert(start + 0x10);
temp.custom_account = wxutils::ReadWstringThenConvert(start + 0x30);
temp.encrypt_name = wxutils::ReadWstringThenConvert(start + 0x50);
temp.remark = wxutils::ReadWstringThenConvert(start + 0x80);
temp.remark_pinyin = wxutils::ReadWstringThenConvert(start + 0x148);
temp.remark_pinyin_all = wxutils::ReadWstringThenConvert(start + 0x168);
temp.label_ids = wxutils::ReadWstringThenConvert(start + 0xc0);
temp.nickname = wxutils::ReadWstringThenConvert(start + 0xA0);
temp.pinyin = wxutils::ReadWstringThenConvert(start + 0x108);
temp.pinyin_all = wxutils::ReadWstringThenConvert(start + 0x128);
temp.verify_flag = *(int32_t*)(start + 0x70);
temp.type = *(int32_t*)(start + 0x74);
temp.reserved1 = *(int32_t*)(start + 0x1F0);
temp.reserved2 = *(int32_t*)(start + 0x1F4);
vec.push_back(temp);
start += 0x6A8;
}
return success;
}
int64_t wechat::WeChatService::GetChatRoomDetailInfo(
const std::wstring& room_id, ChatRoomInfoInner& room_info) {
return 0;
}
int64_t wechat::WeChatService::AddMemberToChatRoom(
const std::wstring& room_id, const std::vector<std::wstring>& members) {
return 0;
}
int64_t wechat::WeChatService::ModChatRoomMemberNickName(
const std::wstring& room_id, const std::wstring& wxid,
const std::wstring& nickname) {
return 0;
}
int64_t wechat::WeChatService::DelMemberFromChatRoom(
const std::wstring& room_id, const std::vector<std::wstring>& members) {
return 0;
}
int64_t wechat::WeChatService::GetMemberFromChatRoom(
const std::wstring& room_id, ChatRoomMemberInner& member) {
return 0;
}
int64_t wechat::WeChatService::SetTopMsg(uint64_t msg_id) { return 0; }
int64_t wechat::WeChatService::RemoveTopMsg(const std::wstring& room_id,
ULONG64 msg_id) {
return 0;
}
int64_t wechat::WeChatService::InviteMemberToChatRoom(
const std::wstring& room_id, const std::vector<std::wstring>& wxids) {
return 0;
}
int64_t wechat::WeChatService::CreateChatRoom(
const std::vector<std::wstring>& wxids) {
return 0;
}
int64_t wechat::WeChatService::QuitChatRoom(const std::wstring& room_id) {
return 0;
}
int64_t wechat::WeChatService::ForwardMsg(uint64_t msg_id,
const std::wstring& wxid) {
int64_t success = -1;
uint64_t forward_addr = base_addr_ + offset::kForwardMsg;
func::__ForwardMsg forward_msg = (func::__ForwardMsg)forward_addr;
int64_t index = 0;
int64_t local_id =
wechat::WeChatDb::GetInstance().GetLocalIdByMsgId(msg_id, index);
if (local_id <= 0 || index >> 32 == 0) {
success = -2;
return success;
}
LARGE_INTEGER l;
l.HighPart = index >> 32;
l.LowPart = (DWORD)local_id;
prototype::WeChatString* recv = BuildWechatString(wxid);
success = forward_msg(reinterpret_cast<uint64_t>(recv), l.QuadPart, 0x4, 0x0);
return success;
}
int64_t wechat::WeChatService::GetSNSFirstPage() { return 0; }
int64_t wechat::WeChatService::GetSNSNextPage(uint64_t sns_id) { return 0; }
int64_t wechat::WeChatService::AddFavFromMsg(uint64_t msg_id) { return 0; }
int64_t wechat::WeChatService::AddFavFromImage(const std::wstring& wxid,
const std::wstring& image_path) {
return 0;
}
int64_t wechat::WeChatService::SendAtText(
const std::wstring& room_id, const std::vector<std::wstring>& wxids,
const std::wstring& msg) {
int64_t success = -1;
std::vector<prototype::WeChatString> wxid_list;
wechat::VectorInner* list = (wechat::VectorInner*)&wxid_list;
std::wstring at_msg = L"";
int number = 0;
for (unsigned int i = 0; i < wxids.size(); i++) {
std::wstring nickname;
std::wstring at_all = L"notify@all";
if (at_all.compare(wxids[i]) == 0) {
nickname = L"\u6240\u6709\u4eba";
} else {
// nickname = GetContactOrChatRoomNickname(wxids[i]);
}
if (nickname.length() == 0) {
continue;
}
prototype::WeChatString id(wxids[i]);
wxid_list.push_back(id);
at_msg = at_msg + L"@" + nickname + L" ";
number++;
}
if (number < 1) {
success = -2;
return success;
}
at_msg += msg;
INT64 head = (INT64)&list->start;
prototype::WeChatString to_user(room_id);
prototype::WeChatString text_msg(at_msg);
uint64_t send_message_mgr_addr = base_addr_ + offset::kGetSendMessageMgr;
uint64_t send_text_msg_addr = base_addr_ + offset::kSendTextMsg;
uint64_t free_chat_msg_addr = base_addr_ + offset::kFreeChatMsg;
char chat_msg[0x460] = {0};
func::__GetSendMessageMgr mgr =
(func::__GetSendMessageMgr)send_message_mgr_addr;
func::__SendTextMsg send = (func::__SendTextMsg)send_text_msg_addr;
func::__FreeChatMsg free = (func::__FreeChatMsg)free_chat_msg_addr;
mgr();
success = send(reinterpret_cast<uint64_t>(&chat_msg),
reinterpret_cast<uint64_t>(&to_user),
reinterpret_cast<uint64_t>(&text_msg), head, 1, 1, 0, 0);
free(reinterpret_cast<uint64_t>(&chat_msg));
return 0;
}
std::wstring wechat::WeChatService::GetContactOrChatRoomNickname(
const std::wstring& wxid) {
int64_t success = -1;
prototype::WeChatString to_user(wxid);
uint64_t get_contact_mgr_addr = base_addr_ + offset::kGetContactMgr;
uint64_t new_contact_addr = base_addr_ + offset::kNewContact;
uint64_t get_contact_addr = base_addr_ + offset::kGetContact;
uint64_t free_contact_addr = base_addr_ + offset::kFreeContact;
func::__GetContactMgr get_contact_mgr =
(func::__GetContactMgr)get_contact_mgr_addr;
func::__GetContact get_contact = (func::__GetContact)get_contact_addr;
func::__NewContact new_contact = (func::__NewContact)new_contact_addr;
func::__FreeContact free_contact = (func::__FreeContact)free_contact_addr;
char buff[0x6A9] = {0};
uint64_t contact = new_contact(reinterpret_cast<uint64_t>(&buff));
uint64_t mgr = get_contact_mgr();
success = get_contact(mgr, reinterpret_cast<uint64_t>(&to_user), contact);
if (success == 1) {
std::wstring nickname = wxutils::ReadWstring(contact + 0xA0);
free_contact(contact);
return nickname;
} else {
free_contact(contact);
return L"";
}
}
int64_t wechat::WeChatService::GetContactByWxid(const std::wstring& wxid,
ContactProfileInner& profile) {
return 0;
}
int64_t wechat::WeChatService::DoDownloadTask(uint64_t msg_id) { return 0; }
int64_t wechat::WeChatService::ForwardPublicMsg(const std::wstring& wxid,
const std::wstring& title,
const std::wstring& url,
const std::wstring& thumb_url,
const std::wstring& sender_id,
const std::wstring& sender_name,
const std::wstring& digest) {
return 0;
}
int64_t wechat::WeChatService::ForwardPublicMsgByMsgId(const std::wstring& wxid,
uint64_t msg_id) {
return 0;
}
int64_t wechat::WeChatService::DecodeImage(const std::wstring& file_path,
const std::wstring& save_dir) {
return 0;
}
int64_t wechat::WeChatService::GetVoiceByDB(ULONG64 msg_id,
const std::wstring& dir) {
return 0;
}
int64_t wechat::WeChatService::SendCustomEmotion(const std::wstring& file_path,
const std::wstring& wxid) {
return 0;
}
int64_t wechat::WeChatService::SendApplet(
const std::wstring& recv_wxid, const std::wstring& waid_suff,
const std::wstring& waid_w, const std::string& waid_s,
const std::string& wa_wxid, const std::string& json_param,
const std::string& head_image, const std::string& big_image,
const std::string& index_page) {
return 0;
}
int64_t wechat::WeChatService::SendPatMsg(const std::wstring& room_id,
const std::wstring& wxid) {
int64_t success = -1;
uint64_t send_pat_msg_addr = base_addr_ + offset::kSendPatMsg;
func::__SendPatMsg send_pat_msg = (func::__SendPatMsg)send_pat_msg_addr;
prototype::WeChatString chat_room(room_id);
prototype::WeChatString target(wxid);
success = send_pat_msg(reinterpret_cast<uint64_t>(&chat_room),
reinterpret_cast<uint64_t>(&target));
return success;
}
int64_t wechat::WeChatService::DoOCRTask(const std::wstring& img_path,
std::string& result) {
return 0;
}
int64_t wechat::WeChatService::LockWeChat() {
int64_t success = -1;
uint64_t lock_mgr_addr = base_addr_ + offset::kGetLockWechatMgr;
uint64_t request_lock_addr = base_addr_ + offset::kRequestLockWechat;
func::__GetLockWechatMgr get_lock_mgr =
(func::__GetLockWechatMgr)lock_mgr_addr;
func::__RequestLockWechat request_lock =
(func::__RequestLockWechat)request_lock_addr;
uint64_t mgr = get_lock_mgr();
success = request_lock(mgr);
return success;
}
int64_t wechat::WeChatService::UnlockWeChat() {
int64_t success = -1;
uint64_t lock_mgr_addr = base_addr_ + offset::kGetLockWechatMgr;
uint64_t request_unlock_addr = base_addr_ + offset::kRequestUnLockWechat;
func::__GetLockWechatMgr get_lock_mgr =
(func::__GetLockWechatMgr)lock_mgr_addr;
func::__RequestUnLockWechat request_unlock =
(func::__RequestUnLockWechat)request_unlock_addr;
uint64_t mgr = get_lock_mgr();
success = request_unlock(mgr);
return success;
}
int64_t wechat::WeChatService::EnterWeChat() {
int64_t success = -1;
int64_t base_addr = wxutils::GetWeChatWinBase();
uint64_t click_cb_addr = base_addr + offset::kOnLoginBtnClick;
func::__OnLoginBtnClick cb = (func::__OnLoginBtnClick)click_cb_addr;
auto vec =
base::memory::ScanAndMatchValue(base_addr + 0x34e0c18, 0x1000, 0x8);
for (int i = 0; i < vec.size(); i++) {
int64_t ptr = vec.at(i);
if (*(int64_t*)ptr == base_addr + 0x34e0c18) {
int64_t login_wnd = ptr;
success = cb(ptr);
break;
}
}
return success;
}
int64_t wechat::WeChatService::SendMultiAtText(
const std::wstring& room_id,
const std::vector<std::pair<std::wstring, std::wstring>>& at) {
int64_t success = -1;
std::vector<prototype::WeChatString> wxid_list;
wechat::VectorInner* list = (wechat::VectorInner*)&wxid_list;
std::wstring at_msg = L"";
int number = 0;
for (unsigned int i = 0; i < at.size(); i++) {
std::wstring nickname;
std::wstring at_all = L"notify@all";
if (at_all.compare(at[i].first) == 0) {
nickname = L"\u6240\u6709\u4eba";
} else {
// nickname = GetContactOrChatRoomNickname(at[i].first);
nickname = L"";
}
if (nickname.length() == 0) {
continue;
}
prototype::WeChatString id(at[i].first);
wxid_list.push_back(id);
at_msg = at_msg + L"@" + nickname + L" " + at[i].second + L" ";
number++;
}
if (number < 1) {
success = -2;
return success;
}
int64_t head = (int64_t)&list->start;
prototype::WeChatString to_user(room_id);
prototype::WeChatString text_msg(at_msg);
uint64_t send_message_mgr_addr = base_addr_ + offset::kGetSendMessageMgr;
uint64_t send_text_msg_addr = base_addr_ + offset::kSendTextMsg;
uint64_t free_chat_msg_addr = base_addr_ + offset::kFreeChatMsg;
char chat_msg[0x460] = {0};
func::__GetSendMessageMgr mgr =
(func::__GetSendMessageMgr)send_message_mgr_addr;
func::__SendTextMsg send = (func::__SendTextMsg)send_text_msg_addr;
func::__FreeChatMsg free = (func::__FreeChatMsg)free_chat_msg_addr;
mgr();
success = send(reinterpret_cast<uint64_t>(&chat_msg),
reinterpret_cast<uint64_t>(&to_user),
reinterpret_cast<uint64_t>(&text_msg), head, 1, 1, 0, 0);
free(reinterpret_cast<uint64_t>(&chat_msg));
return success;
}
std::string wechat::WeChatService::GetLoginUrl() {
uint64_t login_mgr_addr = base_addr_ + offset::kGetQRCodeLoginMgr;
func::__GetQRCodeLoginMgr get = (func::__GetQRCodeLoginMgr)login_mgr_addr;
uint64_t addr = get();
std::string login_url = wxutils::ReadWeChatStr(addr + 0x68);
return "http://weixin.qq.com/x/" + login_url;
}
void wechat::WeChatService::SetBaseAddr(uint64_t addr) {}
void wechat::WeChatService::SetJsApiAddr(uint64_t addr) {}
int64_t wechat::WeChatService::TranslateVoice(uint64_t msg_id) {
int64_t success = -1;
uint64_t get_by_local_id_addr = base_addr_ + offset::kGetMgrByPrefixLocalId;
func::__GetMgrByPrefixLocalId get_by_local_id =
(func::__GetMgrByPrefixLocalId)get_by_local_id_addr;
uint64_t get_chat_mgr_addr = base_addr_ + offset::kGetChatMgr;
func::__GetChatMgr get_chat_mgr = (func::__GetChatMgr)get_chat_mgr_addr;
uint64_t free_chat_msg_addr = base_addr_ + offset::kFreeChatMsg;
func::__FreeChatMsg free_chat_msg = (func::__FreeChatMsg)free_chat_msg_addr;
uint64_t new_chat_msg_addr = base_addr_ + offset::kChatMsgInstanceCounter;
func::__NewChatMsg new_chat_msg = (func::__NewChatMsg)new_chat_msg_addr;
uint64_t update_addr = base_addr_ + offset::kUpdateMsg;
func::__UpdateMsg update = (func::__UpdateMsg)update_addr;
uint64_t get_voice_mgr_addr = base_addr_ + offset::kGetVoiceMgr;
func::__GetVoiceMgr get_voice_mgr = (func::__GetVoiceMgr)get_voice_mgr_addr;
uint64_t to_msg_addr = base_addr_ + offset::kChatMsg2NetSceneSendMsg;
func::__ChatMsg2NetSceneSendMsg to_msg =
(func::__ChatMsg2NetSceneSendMsg)to_msg_addr;
uint64_t trans_addr = base_addr_ + offset::kTranslateVoice;
func::__TranslateVoice translate_voice = (func::__TranslateVoice)trans_addr;
char temp_msg[0x460] = {0};
char* chat_msg = base::utils::WxHeapAlloc<char>(0x460);
int64_t index = 0;
int64_t local_id =
wechat::WeChatDb::GetInstance().GetLocalIdByMsgId(msg_id, index);
if (local_id <= 0 || index >> 32 == 0) {
success = -2;
return success;
}
LARGE_INTEGER l;
l.HighPart = index >> 32;
l.LowPart = (DWORD)local_id;
uint64_t p_chat_msg = new_chat_msg(reinterpret_cast<uint64_t>(chat_msg));
get_chat_mgr();
get_by_local_id(l.QuadPart, p_chat_msg);
uint64_t mgr = get_chat_mgr();
update(mgr, p_chat_msg, 0);
uint64_t voice_mgr = get_voice_mgr();
uint64_t msg = to_msg(reinterpret_cast<uint64_t>(&temp_msg), p_chat_msg);
success = translate_voice(voice_mgr, msg, 0);
return success;
}
std::string wechat::WeChatService::GetTranslateVoiceText(uint64_t msg_id) {
std::string content =
wechat::WeChatDb::GetInstance().GetChatMsgStrContentByMsgId(msg_id);
if (content.empty()) {
return {};
}
tinyxml2::XMLDocument doc;
if (doc.Parse(content.c_str(), content.size()) != 0) {
SPDLOG_INFO("tinyxml2 parse error");
return {};
}
tinyxml2::XMLElement* msg = doc.FirstChildElement("msg");
if (msg != nullptr) {
tinyxml2::XMLElement* voicetrans = msg->FirstChildElement("voicetrans");
if (voicetrans != nullptr) {
const char* value = voicetrans->Attribute("transtext", nullptr);
return value;
}
}
return "";
}
int64_t wechat::WeChatService::OpenUrlByWeChatBrowser(const std::wstring& url,
int flag) {
int64_t success = -1;
uint64_t config_addr = base_addr_ + offset::kNewWebViewPageConfig;
func::__NewWebViewPageConfig config =
(func::__NewWebViewPageConfig)config_addr;
uint64_t free_config_addr = base_addr_ + offset::kFreeWebViewPageConfig;
func::__FreeWebViewPageConfig free_config =
(func::__FreeWebViewPageConfig)free_config_addr;
uint64_t web_view_mgr_addr = base_addr_ + offset::kGetWebViewMgr;
func::__GetWebViewMgr web_view_mgr = (func::__GetWebViewMgr)web_view_mgr_addr;
uint64_t show_addr = base_addr_ + offset::kShowWebView;
func::__ShowWebView show_web_view = (func::__ShowWebView)show_addr;
uint64_t set_url_addr = base_addr_ + offset::kSetUrl;
func::__SetUrl set_url = (func::__SetUrl)set_url_addr;
int a = flag >> 4;
int b = flag & 0x1;
int c = flag & 0x2;
int d = flag & 0x4;
int e = flag & 0x8;
char* web_config = (char*)HeapAlloc(GetProcessHeap(), 0, 0xA20);
uint64_t ptr = config(reinterpret_cast<uint64_t>(web_config));
set_url(ptr + 0x868, reinterpret_cast<uint64_t>(url.c_str()), url.size());
web_view_mgr();
success = show_web_view(ptr, a, b, c, d, e);
free_config(ptr);
return success;
}

View File

@ -0,0 +1,99 @@
#ifndef WXHELPER_WECHAT_SERVICE_H_
#define WXHELPER_WECHAT_SERVICE_H_
#include <windows.h>
#include <string>
#include <vector>
#include "singleton.h"
#include "wechat_interface.h"
namespace wechat {
class WeChatService : public base::Singleton<WeChatService> {
friend class base::Singleton<WeChatService>;
~WeChatService();
public:
void Init();
void SetBaseAddr(uint64_t addr);
void SetJsApiAddr(uint64_t addr);
int64_t CheckLogin();
int64_t GetSelfInfo(SelfInfoInner& out);
int64_t SendTextMsg(const std::wstring& wxid, const std::wstring& msg);
int64_t SendImageMsg(const std::wstring& wxid,
const std::wstring& image_path);
int64_t SendFileMsg(const std::wstring& wxid, const std::wstring& file_path);
int64_t GetContacts(std::vector<ContactInner>& vec);
int64_t GetChatRoomDetailInfo(const std::wstring& room_id,
ChatRoomInfoInner& room_info);
int64_t AddMemberToChatRoom(const std::wstring& room_id,
const std::vector<std::wstring>& members);
int64_t ModChatRoomMemberNickName(const std::wstring& room_id,
const std::wstring& wxid,
const std::wstring& nickname);
int64_t DelMemberFromChatRoom(const std::wstring& room_id,
const std::vector<std::wstring>& members);
int64_t GetMemberFromChatRoom(const std::wstring& room_id,
ChatRoomMemberInner& member);
int64_t SetTopMsg(uint64_t msg_id);
int64_t RemoveTopMsg(const std::wstring& room_id, ULONG64 msg_id);
int64_t InviteMemberToChatRoom(const std::wstring& room_id,
const std::vector<std::wstring>& wxids);
int64_t CreateChatRoom(const std::vector<std::wstring>& wxids);
int64_t QuitChatRoom(const std::wstring& room_id);
int64_t ForwardMsg(uint64_t msg_id, const std::wstring& wxid);
int64_t GetSNSFirstPage();
int64_t GetSNSNextPage(uint64_t sns_id);
int64_t AddFavFromMsg(uint64_t msg_id);
int64_t AddFavFromImage(const std::wstring& wxid,
const std::wstring& image_path);
int64_t SendAtText(const std::wstring& room_id,
const std::vector<std::wstring>& wxids,
const std::wstring& msg);
std::wstring GetContactOrChatRoomNickname(const std::wstring& wxid);
int64_t GetContactByWxid(const std::wstring& wxid,
ContactProfileInner& profile);
int64_t DoDownloadTask(uint64_t msg_id);
int64_t ForwardPublicMsg(const std::wstring& wxid, const std::wstring& title,
const std::wstring& url,
const std::wstring& thumb_url,
const std::wstring& sender_id,
const std::wstring& sender_name,
const std::wstring& digest);
int64_t ForwardPublicMsgByMsgId(const std::wstring& wxid, uint64_t msg_id);
int64_t DecodeImage(const std::wstring& file_path,
const std::wstring& save_dir);
int64_t GetVoiceByDB(ULONG64 msg_id, const std::wstring& dir);
int64_t SendCustomEmotion(const std::wstring& file_path,
const std::wstring& wxid);
int64_t SendApplet(const std::wstring& recv_wxid,
const std::wstring& waid_suff, const std::wstring& waid_w,
const std::string& waid_s, const std::string& wa_wxid,
const std::string& json_param,
const std::string& head_image,
const std::string& big_image,
const std::string& index_page);
int64_t SendPatMsg(const std::wstring& room_id, const std::wstring& wxid);
int64_t DoOCRTask(const std::wstring& img_path, std::string& result);
int64_t LockWeChat();
int64_t UnlockWeChat();
int64_t EnterWeChat();
int64_t SendMultiAtText(
const std::wstring& room_id,
const std::vector<std::pair<std::wstring, std::wstring>>& at);
std::string GetLoginUrl();
int64_t TranslateVoice(uint64_t msg_id);
std::string GetTranslateVoiceText(uint64_t msg_id);
int64_t OpenUrlByWeChatBrowser(const std::wstring& url, int flag);
private:
uint64_t base_addr_;
uint64_t js_api_addr_;
};
} // namespace wechat
#endif

View File

@ -8,6 +8,7 @@
#include "wxutils.h"
#include "wechat_db.h"
#include "sync_msg_hook.h"
#include "wechat_service.h"
namespace wxhelper {
void WxHelper::init(HMODULE module) {
@ -16,6 +17,7 @@ void WxHelper::init(HMODULE module) {
base::utils::HideModule(module);
}
wechat::WeChatDb::GetInstance().Init();
wechat::WeChatService::GetInstance().Init();
SyncMsgHook::GetInstance().Init();
http::HttpServer::GetInstance().init(
Config::GetInstance().GetHttpServerHost(),