WeChatFerry/spy/accept_new_friend.cpp

77 lines
2.0 KiB
C++
Raw Normal View History

2023-02-21 21:15:37 +08:00
#include "framework.h"
#include "accept_new_friend.h"
2022-08-21 08:45:16 +08:00
#include "load_calls.h"
2023-02-21 21:15:37 +08:00
#include "log.h"
2023-03-05 12:30:02 +08:00
#include "util.h"
2022-08-21 08:45:16 +08:00
typedef struct NewFriendParam {
DWORD handle;
DWORD *status;
DWORD statusEnd1;
DWORD statusEnd2;
char buffer[0x3C];
} NewFriendParam_t;
extern WxCalls_t g_WxCalls;
extern DWORD g_WeChatWinDllAddr;
2023-05-01 22:58:16 +08:00
int AcceptNewFriend(std::string v3, std::string v4, int scene)
2022-08-21 08:45:16 +08:00
{
2023-03-05 12:30:02 +08:00
int isSucceeded = 0;
2022-08-21 08:45:16 +08:00
DWORD acceptNewFriendCall1 = g_WeChatWinDllAddr + g_WxCalls.anf.call1;
DWORD acceptNewFriendCall2 = g_WeChatWinDllAddr + g_WxCalls.anf.call2;
DWORD acceptNewFriendHandle = g_WeChatWinDllAddr + g_WxCalls.anf.handle;
char buffer[0x94] = { 0 };
NewFriendParam_t param = { 0 };
DWORD status[9] = { 0xB2, (DWORD)&param, 0xB5, (DWORD)&param, 0xB0, (DWORD)&param, 0xB1, (DWORD)&param, 0x00 };
param.handle = acceptNewFriendHandle;
param.status = status;
2023-05-01 22:58:16 +08:00
param.statusEnd1 = (DWORD)status + 0x20;
param.statusEnd2 = (DWORD)status + 0x20;
2022-08-21 08:45:16 +08:00
NewFriendParam_t *pParam = &param;
2023-02-23 00:01:14 +08:00
LOG_DEBUG("v3: {}\nv4: {}", v3, v4);
2023-03-05 12:30:02 +08:00
WxString_t wxV3 = { 0 };
WxString_t wxV4 = { 0 };
std::wstring wsV3 = String2Wstring(v3);
std::wstring wsV4 = String2Wstring(v4);
wxV3.text = (wchar_t *)wsV3.c_str();
wxV3.size = wsV3.size();
wxV3.capacity = wsV3.capacity();
wxV4.text = (wchar_t *)wsV4.c_str();
wxV4.size = wsV4.size();
wxV4.capacity = wsV4.capacity();
2023-02-21 21:15:37 +08:00
2022-08-21 08:45:16 +08:00
__asm {
pushad;
pushfd;
push 0x0;
2023-05-01 22:58:16 +08:00
mov eax, scene;
push eax;
2022-08-21 08:45:16 +08:00
sub esp, 0x14;
mov ecx, esp;
2023-03-05 12:30:02 +08:00
lea eax, wxV4;
2022-08-21 08:45:16 +08:00
push eax;
call acceptNewFriendCall1;
sub esp, 0x8;
push 0x0;
lea eax, buffer;
push eax;
2023-03-05 12:30:02 +08:00
lea eax, wxV3;
2022-08-21 08:45:16 +08:00
push eax;
mov ecx, pParam;
call acceptNewFriendCall2;
mov isSucceeded, eax;
popfd;
popad;
}
2023-03-05 12:30:02 +08:00
return isSucceeded; // 成功返回 1
2022-08-21 08:45:16 +08:00
}