From dccc997067885dc5f8d924dec0319f4b8eeeb342 Mon Sep 17 00:00:00 2001 From: hugy <504650082@qq.com> Date: Tue, 23 May 2023 12:01:43 +0800 Subject: [PATCH] =?UTF-8?q?3.9.2.26=E9=83=A8=E5=88=86=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- doc/3.9.2.26.md | 9 ++++- src/contact_mgr.cc | 2 +- src/db.cc | 2 +- src/hooks.cc | 85 +++++++++++++++++++++++++++++++++++-------- src/http_handler.cc | 6 ++- src/misc_mgr.cc | 15 ++++---- src/wechat_function.h | 24 ++++++++---- 7 files changed, 108 insertions(+), 35 deletions(-) diff --git a/doc/3.9.2.26.md b/doc/3.9.2.26.md index adef823..283676e 100644 --- a/doc/3.9.2.26.md +++ b/doc/3.9.2.26.md @@ -3,14 +3,21 @@ 0.检查是否登录 1.获取登录微信信息 2.发送文本 +3.发送@文本 5.发送图片 6.发送文件 9.hook消息 10.取消hook消息 +19.通过手机或qq查找微信 +20.通过wxid添加好友 +23.通过好友申请 25.获取群成员 26.获取群成员昵称 27.删除群成员 28.增加群成员 31.修改群昵称 32.获取数据库句柄 -34.查询数据库 \ No newline at end of file +34.查询数据库 +40.转发消息 +44.退出登录 +55.获取联系人或者群名称 \ No newline at end of file diff --git a/src/contact_mgr.cc b/src/contact_mgr.cc index e0bd40b..aba7846 100644 --- a/src/contact_mgr.cc +++ b/src/contact_mgr.cc @@ -126,7 +126,7 @@ int ContactMgr::AddFriendByWxid(wchar_t *wxid,wchar_t* msg) { DWORD verify_msg_addr = base_addr_ + WX_VERIFY_MSG_OFFSET; DWORD set_value_addr = base_addr_ + WX_INIT_CHAT_MSG_OFFSET; DWORD do_verify_user_addr = base_addr_ + WX_DO_VERIFY_USER_OFFSET; - DWORD fn1_addr = base_addr_ + 0x758720; + DWORD fn1_addr = base_addr_ + 0x7591b0; WeChatString user_id(wxid); WeChatString w_msg(msg); DWORD instance =0; diff --git a/src/db.cc b/src/db.cc index a6586bf..0a4d1b6 100644 --- a/src/db.cc +++ b/src/db.cc @@ -490,7 +490,7 @@ unsigned int DB::GetLocalIdByMsgId(ULONG64 msgid, int &dbIndex) { swprintf_s(dbname, L"MSG%d.db", i); DWORD handle = GetDbHandleByDbName(dbname); if (handle == 0) { - // LOG(INFO) << "MSG db handle is null"; + SPDLOG_INFO("MSG db handle is null"); return 0; } vector> result; diff --git a/src/hooks.cc b/src/hooks.cc index 35f1385..7153c27 100644 --- a/src/hooks.cc +++ b/src/hooks.cc @@ -393,7 +393,7 @@ int UnHookLog() { void SetErrorCode(int code) { userinfo.error_code = code; } void SetUserInfoDetail(DWORD address) { - // LOG(INFO) << "hook userinfo addr" <<&userinfo; + SPDLOG_INFO("hook userinfo addr = {}",address); DWORD length = *(DWORD *)(address + 0x8); userinfo.keyword = new wchar_t[length + 1]; userinfo.keyword_len = length; @@ -424,6 +424,36 @@ void SetUserInfoDetail(DWORD address) { ZeroMemory(userinfo.big_image, (length + 1) * sizeof(wchar_t)); } + length = *(DWORD *)(address + 0x6C); + userinfo.V3 = new wchar_t[length + 1]; + userinfo.V3_len = length; + if (length) { + memcpy(userinfo.V3, (wchar_t *)(*(DWORD *)(address + 0x68)), + (length + 1) * sizeof(wchar_t)); + } else { + ZeroMemory(userinfo.V3, (length + 1) * sizeof(wchar_t)); + } + + length = *(DWORD *)(address + 0x80); + userinfo.account = new wchar_t[length + 1]; + userinfo.account_len = length; + if (length) { + memcpy(userinfo.account, (wchar_t *)(*(DWORD *)(address + 0x7C)), + (length + 1) * sizeof(wchar_t)); + } else { + ZeroMemory(userinfo.account, (length + 1) * sizeof(wchar_t)); + } + + // length = *(DWORD *)(address + 0x94); + // userinfo.friend_name = new wchar_t[length + 1]; + // userinfo.friend_name_len = length; + // if (length) { + // memcpy(userinfo.friend_name, (wchar_t *)(*(DWORD *)(address + 0x90)), + // (length + 1) * sizeof(wchar_t)); + // } else { + // ZeroMemory(userinfo.friend_name, (length + 1) * sizeof(wchar_t)); + // } + length = *(DWORD *)(address + 0xC8); userinfo.nickname = new wchar_t[length + 1]; userinfo.nickname_len = length; @@ -434,15 +464,28 @@ void SetUserInfoDetail(DWORD address) { ZeroMemory(userinfo.nickname, (length + 1) * sizeof(wchar_t)); } - length = *(DWORD *)(address + 0x108); - userinfo.v2 = new wchar_t[length + 1]; - userinfo.v2_len = length; - if (length) { - memcpy(userinfo.v2, (wchar_t *)(*(DWORD *)(address + 0x104)), - (length + 1) * sizeof(wchar_t)); - } else { - ZeroMemory(userinfo.v2, (length + 1) * sizeof(wchar_t)); - } + // the results of calling and UI operations are different + // + // length = *(DWORD *)(address + 0x108); + // userinfo.v2 = new wchar_t[length + 1]; + // userinfo.v2_len = length; + // if (length) { + // memcpy(userinfo.v2, (wchar_t *)(*(DWORD *)(address + 0x104)), + // (length + 1) * sizeof(wchar_t)); + // } else { + // ZeroMemory(userinfo.v2, (length + 1) * sizeof(wchar_t)); + // } + + // length = *(DWORD *)(address + 0x11C); + // userinfo.py = new wchar_t[length + 1]; + // userinfo.py_len = length; + // if (length) { + // memcpy(userinfo.py, (wchar_t *)(*(DWORD *)(address + 0x118)), + // (length + 1) * sizeof(wchar_t)); + // } else { + // ZeroMemory(userinfo.py, (length + 1) * sizeof(wchar_t)); + // } + length = *(DWORD *)(address + 0x16C); userinfo.small_image = new wchar_t[length + 1]; @@ -508,9 +551,21 @@ void DeleteUserInfoCache() { if (userinfo.v3) { delete userinfo.v3; } + if (userinfo.V3) { + delete userinfo.V3; + } + if (userinfo.account) { + delete userinfo.account; + } + if (userinfo.friend_name) { + delete userinfo.friend_name; + } if (userinfo.nickname) { delete userinfo.nickname; } + if (userinfo.py) { + delete userinfo.py; + } if (userinfo.nation) { delete userinfo.nation; } @@ -569,11 +624,11 @@ int HookSearchContact() { if (search_contact_flag_) { return 2; } - DWORD hook_error_code_addr = base + WX_SEARCH_CONTACT_ERROR_CODE_HOOK_OFFSET; - error_code_next_addr_ = base + WX_SEARCH_CONTACT_ERROR_CODE_HOOK_NEXT_OFFSET; - error_code_back_addr_ = hook_error_code_addr + 0x5; - Utils::HookAnyAddress(hook_error_code_addr, (LPVOID)HandleErrorCode, - error_code_asm_code_); + // DWORD hook_error_code_addr = base + WX_SEARCH_CONTACT_ERROR_CODE_HOOK_OFFSET; + // error_code_next_addr_ = base + WX_SEARCH_CONTACT_ERROR_CODE_HOOK_NEXT_OFFSET; + // error_code_back_addr_ = hook_error_code_addr + 0x5; + // Utils::HookAnyAddress(hook_error_code_addr, (LPVOID)HandleErrorCode, + // error_code_asm_code_); DWORD hook_user_info_addr = base + WX_SEARCH_CONTACT_DETAIL_HOOK_OFFSET; user_info_next_addr_ = base + WX_SEARCH_CONTACT_DETAIL_HOOK_NEXT_OFFSET; diff --git a/src/http_handler.cc b/src/http_handler.cc index 96efc83..43f33e0 100644 --- a/src/http_handler.cc +++ b/src/http_handler.cc @@ -226,8 +226,12 @@ string Dispatch(struct mg_connection *c, struct mg_http_message *hm) { {"province", Utils::WCharToUTF8(user->province)}, {"sex", user->sex}, {"signature", Utils::WCharToUTF8(user->signature)}, - {"v2", Utils::WCharToUTF8(user->v2)}, + // {"v2", Utils::WCharToUTF8(user->v2)}, {"v3", Utils::WCharToUTF8(user->v3)}, + {"V3", Utils::WCharToUTF8(user->V3)}, + {"account", Utils::WCharToUTF8(user->account)}, + // {"friendName", Utils::WCharToUTF8(user->friend_name)}, + // {"py", Utils::WCharToUTF8(user->py)}, }; ret_data["userInfo"] = info; } diff --git a/src/misc_mgr.cc b/src/misc_mgr.cc index e63cc8c..52e8621 100644 --- a/src/misc_mgr.cc +++ b/src/misc_mgr.cc @@ -401,8 +401,8 @@ int MiscMgr::GetImgByName(wchar_t* file_path,wchar_t* save_dir) { int MiscMgr::SearchContactNetScene(wchar_t *keyword,UserInfo ** user) { int success = -1; - hooks::HookSearchContact(); hooks::DeleteUserInfoCache(); + hooks::HookSearchContact(); DWORD search_contact_mgr_addr = base_addr_ + WX_SEARCH_CONTACT_MGR_OFFSET; DWORD search_contact_addr = base_addr_ + WX_SEARCH_CONTACT_OFFSET; WeChatString key(keyword); @@ -419,16 +419,15 @@ int MiscMgr::SearchContactNetScene(wchar_t *keyword,UserInfo ** user) { popad; } success = 1; - while (hooks::userinfo.error_code == 1 && hooks::user_info_flag_) { - Sleep(20); - } - if (hooks::userinfo.error_code == 0) { + // while (hooks::userinfo.error_code == 1 && hooks::user_info_flag_) { + // Sleep(20); + // } + // if (hooks::userinfo.error_code == 0) { while (hooks::userinfo.over == false && hooks::user_info_flag_) { - Sleep(20); + Sleep(2); } - } + // } *user= &hooks::userinfo; - // LOG(INFO)<<"user:" <