From ead20cc806223b64cdeb93a5a1b2757b7bbdca0f Mon Sep 17 00:00:00 2001 From: Changhua Date: Fri, 14 Mar 2025 00:17:59 +0800 Subject: [PATCH 01/10] chore: fix encoding --- WeChatFerry/license_check.bat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/WeChatFerry/license_check.bat b/WeChatFerry/license_check.bat index f097f04..474519a 100644 --- a/WeChatFerry/license_check.bat +++ b/WeChatFerry/license_check.bat @@ -25,7 +25,7 @@ type "DISCLAIMER.md" > temp_disclaimer.txt :: 使用 PowerShell 显示弹窗 powershell -NoProfile -Command ^ - "$text = Get-Content -Raw -Path 'temp_disclaimer.txt';" ^ + "$text = [System.IO.File]::ReadAllText('temp_disclaimer.txt', [System.Text.Encoding]::UTF8);" ^ "Add-Type -AssemblyName PresentationFramework;" ^ "$result = [System.Windows.MessageBox]::Show($text, '免责声明', 'OKCancel', 'Warning');" ^ "if ($result -ne 'OK') { exit 1 }" From 994d6b85547573765b1d6b97945270ca12246281 Mon Sep 17 00:00:00 2001 From: Changhua Date: Fri, 14 Mar 2025 00:19:53 +0800 Subject: [PATCH 02/10] feat(contact): update new friend verification offsets --- WeChatFerry/spy/offsets.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/WeChatFerry/spy/offsets.h b/WeChatFerry/spy/offsets.h index 15d3222..0df2cec 100644 --- a/WeChatFerry/spy/offsets.h +++ b/WeChatFerry/spy/offsets.h @@ -35,6 +35,13 @@ namespace Contact constexpr uint64_t NAME = 0xA0; constexpr uint64_t GENDER = 0x0E; constexpr uint64_t STEP = 0x6A8; + + constexpr uint64_t VERIFY_NEW = 0x2621B00; + constexpr uint64_t VERIFY_OK = 0x1F421E0; + constexpr uint64_t VERIFY_MGR = 0x4F022A8; + constexpr uint64_t VERIFY_A8 = 0x2621B91; + constexpr uint64_t ADD_FRIEND_HELPER = 0x4EE4A20; + constexpr uint64_t FVDF = 0x4F02768; // FriendVeriyDialogFragment } namespace Db From 518cee4ddaf01b6273c6dc8e590d1f01a47a4fa1 Mon Sep 17 00:00:00 2001 From: Changhua Date: Sat, 15 Mar 2025 10:31:39 +0800 Subject: [PATCH 03/10] feat(contact): impl new friend verification --- WeChatFerry/spy/contact_manager.cpp | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/WeChatFerry/spy/contact_manager.cpp b/WeChatFerry/spy/contact_manager.cpp index 64728ea..57ff600 100644 --- a/WeChatFerry/spy/contact_manager.cpp +++ b/WeChatFerry/spy/contact_manager.cpp @@ -17,6 +17,8 @@ namespace OsCon = Offsets::Contact; using get_contact_mgr_t = QWORD (*)(); using get_contact_list_t = QWORD (*)(QWORD, QWORD); +using func_verify_new_t = QWORD (*)(QWORD, WxString *); +using func_verify_ok_t = QWORD (*)(QWORD, WxString *, QWORD *, QWORD, QWORD, QWORD *, WxString *, QWORD *, WxString *); #define FEAT_LEN 5 static const uint8_t FEAT_COUNTRY[FEAT_LEN] = { 0xA4, 0xD9, 0x02, 0x4A, 0x18 }; @@ -90,8 +92,30 @@ vector get_contacts() int accept_new_friend(const std::string &v3, const std::string &v4, int scene) { - LOG_ERROR("技术太菜,实现不了。"); - return -1; // 成功返回 1 + // TODO: 处理来源、备注、标签等 + auto func_new = Spy::getFunction(OsCon::VERIFY_NEW); + auto func_verify = Spy::getFunction(OsCon::VERIFY_OK); + + QWORD helper = util::get_qword(Spy::WeChatDll.load() + OsCon::ADD_FRIEND_HELPER); + QWORD fvdf = util::get_qword(Spy::WeChatDll.load() + OsCon::FVDF); + QWORD mgr = util::get_qword(Spy::WeChatDll.load() + OsCon::VERIFY_MGR); + QWORD a8 = util::get_qword(Spy::WeChatDll.load() + OsCon::VERIFY_A8); + + auto pV3 = util::CreateWxString(v3); + auto pV4 = util::CreateWxString(v4); + + QWORD v4Array[4] = { 0 }; + QWORD p_v4Buff = func_new(reinterpret_cast(&v4Array), pV4); + + char buff[0x100] = { 0 }; + memcpy(buff, &helper, sizeof(&helper)); + QWORD a1 = reinterpret_cast(&buff); + + QWORD ret = func_verify(a1, pV3, &fvdf, 0x3A08A4, p_v4Buff, &mgr, pV4, &a8, pV4); + util::FreeWxString(pV3); + util::FreeWxString(pV4); + + return static_cast(ret); // 成功返回 1 } RpcContact_t get_contact_by_wxid(const string &wxid) From 47de98ab38b16b62c1358de267f2265de2da8c68 Mon Sep 17 00:00:00 2001 From: Changhua Date: Sat, 15 Mar 2025 10:33:03 +0800 Subject: [PATCH 04/10] feat(python): impl accept new friend verification --- clients/python/wcferry/client.py | 1 - 1 file changed, 1 deletion(-) diff --git a/clients/python/wcferry/client.py b/clients/python/wcferry/client.py index a9d99c0..8ea47d5 100644 --- a/clients/python/wcferry/client.py +++ b/clients/python/wcferry/client.py @@ -647,7 +647,6 @@ class Wcf(): Returns: int: 1 为成功,其他失败 """ - raise Exception("Not implemented, yet") req = wcf_pb2.Request() req.func = wcf_pb2.FUNC_ACCEPT_FRIEND # FUNC_ACCEPT_FRIEND req.v.v3 = v3 From 915cd6fd38e849cfe97708181faf6b2819dc5e8a Mon Sep 17 00:00:00 2001 From: Changhua Date: Sat, 15 Mar 2025 10:38:46 +0800 Subject: [PATCH 05/10] chore(python): bump to v39.4.3.0 --- clients/python/README.MD | 5 +++-- clients/python/wcferry/client.py | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/clients/python/README.MD b/clients/python/README.MD index 8e1ed32..43a444d 100644 --- a/clients/python/README.MD +++ b/clients/python/README.MD @@ -44,8 +44,8 @@ python -m grpc_tools.protoc --python_out=. --proto_path=../../../WeChatFerry/rpc ## 版本更新 -### v39.4.2.1 -* 实现视频下载方法 +### v39.4.3.0 +* 实现通过好友申请功能
点击查看更多 @@ -79,6 +79,7 @@ python -m grpc_tools.protoc --python_out=. --proto_path=../../../WeChatFerry/rpc * 获取朋友圈消息 * 下载图片 * 解密图片 +* 通过好友申请 * 添加群成员 * 删除群成员 * 邀请群成员 diff --git a/clients/python/wcferry/client.py b/clients/python/wcferry/client.py index 8ea47d5..c184b71 100644 --- a/clients/python/wcferry/client.py +++ b/clients/python/wcferry/client.py @@ -1,7 +1,7 @@ #! /usr/bin/env python3 # -*- coding: utf-8 -*- -__version__ = "39.4.2.2" +__version__ = "39.4.3.0" import atexit import base64 From 0e3d73a0113d850bf12629deef955e6fded659f0 Mon Sep 17 00:00:00 2001 From: Changhua Date: Sat, 15 Mar 2025 10:39:50 +0800 Subject: [PATCH 06/10] chore: bump to v39.4.3 --- README.MD | 9 +++++++-- WeChatFerry/spy/spy.rc | 4 ++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/README.MD b/README.MD index 679132b..515c8db 100644 --- a/README.MD +++ b/README.MD @@ -41,6 +41,7 @@ * 获取朋友圈消息 * 下载图片、视频、文件 * 解密图片 +* 通过好友申请 * 添加群成员 * 删除群成员 * 邀请群成员 @@ -205,9 +206,9 @@ WeChatFerry ## 版本更新 -### v39.4.2 +### v39.4.3 -* 修复附件下载类型错误。 +* 实现通过好友申请功能。
点击查看更多 @@ -219,6 +220,10 @@ WeChatFerry * `y` 是 `WeChatFerry` 的版本,从 0 开始 * `z` 是各客户端的版本,从 0 开始 +### v39.4.2 + +* 修复附件下载类型错误。 + ### v39.4.1 * 修复乱码问题。 diff --git a/WeChatFerry/spy/spy.rc b/WeChatFerry/spy/spy.rc index 8370771..3c30371 100644 --- a/WeChatFerry/spy/spy.rc +++ b/WeChatFerry/spy/spy.rc @@ -51,7 +51,7 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 39,4,2,0 + FILEVERSION 39,4,3,0 PRODUCTVERSION 3,9,12,17 FILEFLAGSMASK 0x3fL #ifdef _DEBUG @@ -69,7 +69,7 @@ BEGIN BEGIN VALUE "CompanyName", "WeChatFerry" VALUE "FileDescription", "WeChatFerry" - VALUE "FileVersion", "39.4.2.0" + VALUE "FileVersion", "39.4.3.0" VALUE "InternalName", "spy.dll" VALUE "LegalCopyright", "Copyright (C) 2023" VALUE "OriginalFilename", "spy.dll" From 3e441faab82ac4766d264391ebf8f8dd84ffa7e7 Mon Sep 17 00:00:00 2001 From: Changhua Date: Mon, 24 Mar 2025 22:33:32 +0800 Subject: [PATCH 07/10] feat(message): update send xml offsets --- WeChatFerry/spy/offsets.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/WeChatFerry/spy/offsets.h b/WeChatFerry/spy/offsets.h index 0df2cec..32ac72f 100644 --- a/WeChatFerry/spy/offsets.h +++ b/WeChatFerry/spy/offsets.h @@ -119,8 +119,8 @@ namespace Message constexpr uint64_t IMAGE = 0x22BF430; constexpr uint64_t APP_MGR = 0x1B5C2F0; constexpr uint64_t FILE = 0x20D30E0; - constexpr uint64_t XML = 0x0; - constexpr uint64_t XML_BUF_SIGN = 0x0; + constexpr uint64_t XML = 0x20D2210; + constexpr uint64_t XML_BUF_SIGN = 0x24F95C0; constexpr uint64_t EMOTION_MGR = 0x1BD2310; constexpr uint64_t EMOTION = 0x21B8100; From 3db47a8532d00c30eb31f93145258481f7fd907d Mon Sep 17 00:00:00 2001 From: Changhua Date: Mon, 24 Mar 2025 22:35:08 +0800 Subject: [PATCH 08/10] feat(message): impl send xml --- WeChatFerry/spy/message_sender.cpp | 34 +++++++++++++----------------- WeChatFerry/spy/message_sender.h | 3 ++- 2 files changed, 17 insertions(+), 20 deletions(-) diff --git a/WeChatFerry/spy/message_sender.cpp b/WeChatFerry/spy/message_sender.cpp index 2cbfac3..e565ae4 100644 --- a/WeChatFerry/spy/message_sender.cpp +++ b/WeChatFerry/spy/message_sender.cpp @@ -126,30 +126,26 @@ void Sender::send_file(const std::string &wxid, const std::string &path) void Sender::send_xml(const std::string &receiver, const std::string &xml, const std::string &path, uint64_t type) { -#if 0 - std::unique_ptr buff(new char[0x500]()); - std::unique_ptr buff2(new char[0x500]()); - char nullBuf[0x1C] = { 0 }; + char buff1[0x500] = { 0 }; + char buff2[0x500] = { 0 }; + char buff3[0x1C] = { 0 }; - func_new_chat_msg(reinterpret_cast(buff.get())); - func_new_chat_msg(reinterpret_cast(buff2.get())); + auto pBuff1 = func_new_chat_msg(reinterpret_cast(buff1)); + auto pBuff2 = func_new_chat_msg(reinterpret_cast(buff2)); + auto pBuff3 = reinterpret_cast(&buff3); - QWORD sbuf[4] = { 0, 0, 0, 0 }; - QWORD sign = func_xml_buf_sign(reinterpret_cast(buff2.get()), reinterpret_cast(sbuf), 0x1); + QWORD array[4] = { 0 }; - auto wxReceiver = new_wx_string(receiver); - auto wxXml = new_wx_string(xml); - auto wxPath = new_wx_string(path); - auto wxSender = new_wx_string(account::get_self_wxid()); + auto sign = func_xml_buf_sign(pBuff2, reinterpret_cast(&array), 0x1); - func_send_xml(reinterpret_cast(buff.get()), reinterpret_cast(wxSender.get()), - reinterpret_cast(wxReceiver.get()), reinterpret_cast(wxXml.get()), - reinterpret_cast(wxPath.get()), reinterpret_cast(nullBuf), type, 0x4, sign, - reinterpret_cast(buff2.get())); + util::WxStringHolder to(receiver); + util::WxStringHolder body(xml); + util::WxStringHolder thumb(path); + util::WxStringHolder from(account::get_self_wxid()); - func_free_chat_msg(reinterpret_cast(buff.get())); - func_free_chat_msg(reinterpret_cast(buff2.get())); -#endif + func_send_xml(pBuff1, &from.wx, &to.wx, &body.wx, &thumb.wx, pBuff3, type, 0x4, sign, pBuff2); + func_free_chat_msg(pBuff1); + func_free_chat_msg(pBuff2); } void Sender::send_emotion(const std::string &wxid, const std::string &path) diff --git a/WeChatFerry/spy/message_sender.h b/WeChatFerry/spy/message_sender.h index 7811395..c724d09 100644 --- a/WeChatFerry/spy/message_sender.h +++ b/WeChatFerry/spy/message_sender.h @@ -56,7 +56,8 @@ private: using GetEmotionMgr_t = QWORD (*)(); using SendEmotion_t = QWORD (*)(QWORD, WxString *, QWORD *, WxString *, QWORD, QWORD *, QWORD, QWORD *); using XmlBufSign_t = QWORD (*)(QWORD, QWORD, QWORD); - using SendXml_t = QWORD (*)(QWORD, QWORD, QWORD, QWORD, QWORD, QWORD, QWORD, QWORD, QWORD, QWORD); + using SendXml_t + = QWORD (*)(QWORD, WxString *, WxString *, WxString *, WxString *, QWORD, QWORD, QWORD, QWORD, QWORD); New_t func_new_chat_msg; Free_t func_free_chat_msg; From 3d6af178f4f51fd346f301842e314af5f13178c2 Mon Sep 17 00:00:00 2001 From: Changhua Date: Mon, 24 Mar 2025 22:48:38 +0800 Subject: [PATCH 09/10] chore: bump to v39.4.4 --- README.MD | 9 +++++++-- WeChatFerry/spy/spy.rc | 4 ++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/README.MD b/README.MD index 515c8db..7956df7 100644 --- a/README.MD +++ b/README.MD @@ -32,6 +32,7 @@ * 发送图片消息 * 发送文件消息 * 发送卡片消息 +* 发送 XML * 发送 GIF 消息 * 拍一拍群友 * 转发消息 @@ -206,9 +207,9 @@ WeChatFerry ## 版本更新 -### v39.4.3 +### v39.4.4 -* 实现通过好友申请功能。 +* 实现通发送 XML 功能。
点击查看更多 @@ -220,6 +221,10 @@ WeChatFerry * `y` 是 `WeChatFerry` 的版本,从 0 开始 * `z` 是各客户端的版本,从 0 开始 +### v39.4.3 + +* 实现通过好友申请功能。 + ### v39.4.2 * 修复附件下载类型错误。 diff --git a/WeChatFerry/spy/spy.rc b/WeChatFerry/spy/spy.rc index 3c30371..1153695 100644 --- a/WeChatFerry/spy/spy.rc +++ b/WeChatFerry/spy/spy.rc @@ -51,7 +51,7 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 39,4,3,0 + FILEVERSION 39,4,4,0 PRODUCTVERSION 3,9,12,17 FILEFLAGSMASK 0x3fL #ifdef _DEBUG @@ -69,7 +69,7 @@ BEGIN BEGIN VALUE "CompanyName", "WeChatFerry" VALUE "FileDescription", "WeChatFerry" - VALUE "FileVersion", "39.4.3.0" + VALUE "FileVersion", "39.4.4.0" VALUE "InternalName", "spy.dll" VALUE "LegalCopyright", "Copyright (C) 2023" VALUE "OriginalFilename", "spy.dll" From 59bccbb93112d2684a3bfbb69061228e91d2d76c Mon Sep 17 00:00:00 2001 From: Changhua Date: Mon, 24 Mar 2025 22:50:15 +0800 Subject: [PATCH 10/10] chore(python): bump to v39.4.4.0 --- clients/python/README.MD | 8 +++++--- clients/python/wcferry/client.py | 3 +-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/clients/python/README.MD b/clients/python/README.MD index 43a444d..bd80fa3 100644 --- a/clients/python/README.MD +++ b/clients/python/README.MD @@ -44,8 +44,8 @@ python -m grpc_tools.protoc --python_out=. --proto_path=../../../WeChatFerry/rpc ## 版本更新 -### v39.4.3.0 -* 实现通过好友申请功能 +### v39.4.4.0 +* 实现发送 XML 功能
点击查看更多 @@ -59,6 +59,7 @@ python -m grpc_tools.protoc --python_out=. --proto_path=../../../WeChatFerry/rpc 功能: +* 获取登录二维码 * 查询登录状态 * 获取登录账号信息 * 获取消息类型 @@ -70,6 +71,7 @@ python -m grpc_tools.protoc --python_out=. --proto_path=../../../WeChatFerry/rpc * 发送图片消息 * 发送文件消息 * 发送卡片消息 +* 发送 XML * 发送 GIF 消息 * 拍一拍群友 * 转发消息 @@ -77,7 +79,7 @@ python -m grpc_tools.protoc --python_out=. --proto_path=../../../WeChatFerry/rpc * 关闭接收消息 * 查询数据库 * 获取朋友圈消息 -* 下载图片 +* 下载图片、视频、文件 * 解密图片 * 通过好友申请 * 添加群成员 diff --git a/clients/python/wcferry/client.py b/clients/python/wcferry/client.py index c184b71..af70b4e 100644 --- a/clients/python/wcferry/client.py +++ b/clients/python/wcferry/client.py @@ -1,7 +1,7 @@ #! /usr/bin/env python3 # -*- coding: utf-8 -*- -__version__ = "39.4.3.0" +__version__ = "39.4.4.0" import atexit import base64 @@ -409,7 +409,6 @@ class Wcf(): Returns: int: 0 为成功,其他失败 """ - raise Exception("Not implemented, yet") req = wcf_pb2.Request() req.func = wcf_pb2.FUNC_SEND_XML # FUNC_SEND_XML req.xml.receiver = receiver