From 3949504ca6243d36f4354eb8b1f1909ee5cfd0c9 Mon Sep 17 00:00:00 2001 From: Changhua Date: Tue, 18 Apr 2023 23:23:41 +0800 Subject: [PATCH] WIP receive transfer --- rpc/proto/wcf.proto | 12 ++++++++++-- spy/Spy.vcxproj | 2 ++ spy/Spy.vcxproj.filters | 6 ++++++ spy/load_calls.cpp | 3 ++- spy/receive_transfer.cpp | 34 ++++++++++++++++++++++++++++++++++ spy/receive_transfer.h | 5 +++++ spy/rpc_server.cpp | 28 ++++++++++++++++++++++++++++ spy/spy_types.h | 1 + 8 files changed, 88 insertions(+), 3 deletions(-) create mode 100644 spy/receive_transfer.cpp create mode 100644 spy/receive_transfer.h diff --git a/rpc/proto/wcf.proto b/rpc/proto/wcf.proto index 4d960a8..15729ea 100644 --- a/rpc/proto/wcf.proto +++ b/rpc/proto/wcf.proto @@ -22,6 +22,7 @@ enum Functions { FUNC_EXEC_DB_QUERY = 0x50; FUNC_ACCEPT_FRIEND = 0x51; FUNC_ADD_ROOM_MEMBERS = 0x52; + FUNC_RECV_TRANSFER = 0x53; FUNC_DECRYPT_IMAGE = 0x60; } @@ -39,6 +40,7 @@ message Request AddMembers m = 8; XmlMsg xml = 9; DecPath dec = 10; + Transfer tf = 11; } } @@ -157,6 +159,12 @@ message UserInfo message DecPath { - string src = 1; // 源路径 - string dst = 2; // 目标路径 + string src = 1; // 源路径 + string dst = 2; // 目标路径 +} + +message Transfer +{ + string wxid = 1; // 转账人 + string tid = 2; // 转账id transferid } diff --git a/spy/Spy.vcxproj b/spy/Spy.vcxproj index c3d6591..dd1d30c 100644 --- a/spy/Spy.vcxproj +++ b/spy/Spy.vcxproj @@ -239,6 +239,7 @@ C:\Tools\nanopb\protoc --nanopb_out=. wcf.proto + @@ -262,6 +263,7 @@ C:\Tools\nanopb\protoc --nanopb_out=. wcf.proto + diff --git a/spy/Spy.vcxproj.filters b/spy/Spy.vcxproj.filters index b41235e..2e558b4 100644 --- a/spy/Spy.vcxproj.filters +++ b/spy/Spy.vcxproj.filters @@ -87,6 +87,9 @@ 头文件 + + 头文件 + @@ -146,6 +149,9 @@ 源文件 + + 源文件 + diff --git a/spy/load_calls.cpp b/spy/load_calls.cpp index 6119de0..f1686ce 100644 --- a/spy/load_calls.cpp +++ b/spy/load_calls.cpp @@ -22,7 +22,8 @@ WxCalls_t wxCalls = { Exec, base, start, end, slot, name*/ { 0x141BDF0, 0x2366934, 0x1428, 0x142C, 0x3C, 0x50 }, { 0x771980, 0x2AE8D0, 0x1EE40E0 }, // Accept New Friend application - { 0xE29F0, 0x771980, 0x43D8D0 } // Add chatroom members + { 0xE29F0, 0x771980, 0x43D8D0 }, // Add chatroom members + { 0xCD2A90 } // Receive transfer }; int LoadCalls(const wchar_t *version, WxCalls_t *calls) diff --git a/spy/receive_transfer.cpp b/spy/receive_transfer.cpp new file mode 100644 index 0000000..3744a44 --- /dev/null +++ b/spy/receive_transfer.cpp @@ -0,0 +1,34 @@ +#include "receive_transfer.h" +#include "load_calls.h" +#include "log.h" +#include "util.h" + +using namespace std; + +extern WxCalls_t g_WxCalls; +extern DWORD g_WeChatWinDllAddr; + +int ReceiveTransfer(string wxid, string transferid) +{ + int rv = 0; + DWORD addRoomMemberCall = g_WeChatWinDllAddr + g_WxCalls.tf; + + WxString_t wxWxid = { 0 }; + wstring wsWxid = String2Wstring(wxid); + wxWxid.text = (wchar_t *)wsWxid.c_str(); + wxWxid.size = wsWxid.size(); + wxWxid.capacity = wsWxid.capacity(); + + WxString_t wxTid = { 0 }; + wstring wsTid = String2Wstring(wxid); + wxTid.text = (wchar_t *)wsTid.c_str(); + wxTid.size = wsTid.size(); + wxTid.capacity = wsTid.capacity(); + + LOG_DEBUG("Receiving transfer, from: {}, transferid{}", wxid, transferid); + __asm { + + } + + return rv; +} diff --git a/spy/receive_transfer.h b/spy/receive_transfer.h new file mode 100644 index 0000000..82fd0aa --- /dev/null +++ b/spy/receive_transfer.h @@ -0,0 +1,5 @@ +#pragma once + +#include + +int ReceiveTransfer(std::string wxid, std::string transferid); diff --git a/spy/rpc_server.cpp b/spy/rpc_server.cpp index 9183e84..bab87cb 100644 --- a/spy/rpc_server.cpp +++ b/spy/rpc_server.cpp @@ -31,6 +31,7 @@ #include "spy_types.h" #include "user_info.h" #include "util.h" +#include "receive_transfer.h" #define URL_SIZE 20 #define BASE_URL "tcp://0.0.0.0" @@ -486,6 +487,28 @@ bool func_add_room_members(char *roomid, char *wxids, uint8_t *out, size_t *len) return true; } +bool func_receive_transfer(char *wxid, char *transferid, uint8_t *out, size_t *len) +{ + Response rsp = Response_init_default; + rsp.func = Functions_FUNC_RECV_TRANSFER; + rsp.which_msg = Response_status_tag; + rsp.msg.status = 0; + + rsp.msg.status = ReceiveTransfer(wxid, transferid); + if (rsp.msg.status != 1) { + LOG_ERROR("AddChatroomMember failed: {}", rsp.msg.status); + } + + pb_ostream_t stream = pb_ostream_from_buffer(out, *len); + if (!pb_encode(&stream, Response_fields, &rsp)) { + LOG_ERROR("Encoding failed: {}", PB_GET_ERROR(&stream)); + return false; + } + *len = stream.bytes_written; + + return true; +} + bool func_decrypt_image(char *src, char *dst, uint8_t *out, size_t *len) { Response rsp = Response_init_default; @@ -606,6 +629,11 @@ static bool dispatcher(uint8_t *in, size_t in_len, uint8_t *out, size_t *out_len ret = func_add_room_members(req.msg.m.roomid, req.msg.m.wxids, out, out_len); break; } + case Functions_FUNC_RECV_TRANSFER: { + LOG_DEBUG("[Functions_FUNC_RECV_TRANSFER]"); + ret = func_receive_transfer(req.msg.tf.wxid, req.msg.tf.tid, out, out_len); + break; + } case Functions_FUNC_DECRYPT_IMAGE: { LOG_DEBUG("[FUNCTIONS_FUNC_DECRYPT_IMAGE]"); ret = func_decrypt_image(req.msg.dec.src, req.msg.dec.dst, out, out_len); diff --git a/spy/spy_types.h b/spy/spy_types.h index c1d0654..e67b398 100644 --- a/spy/spy_types.h +++ b/spy/spy_types.h @@ -84,6 +84,7 @@ typedef struct WxCalls { Sql_t sql; // 执行 SQL NewFriend_t anf; // 通过好友申请 RoomMember_t arm; // 添加群成员 + DWORD tf; // 接收转账 } WxCalls_t; typedef struct WxString {