WeChatFerry/spy/accept_new_friend.cpp

68 lines
1.7 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
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-06-12 23:41:51 +08:00
int success = 0;
2022-08-21 08:45:16 +08:00
2023-06-12 23:41:51 +08:00
DWORD acceptNewFriendCall1 = g_WeChatWinDllAddr + g_WxCalls.anf.call1;
DWORD acceptNewFriendCall2 = g_WeChatWinDllAddr + g_WxCalls.anf.call2;
DWORD acceptNewFriendCall3 = g_WeChatWinDllAddr + g_WxCalls.anf.call3;
DWORD acceptNewFriendCall4 = g_WeChatWinDllAddr + g_WxCalls.anf.call4;
2022-08-21 08:45:16 +08:00
2023-06-12 23:41:51 +08:00
char buffer[0x40] = { 0 };
char nullbuffer[0x3CC] = { 0 };
2022-08-21 08:45:16 +08:00
2023-06-12 23:41:51 +08:00
LOG_DEBUG("\nv3: {}\nv4: {}\nscene: {}", v3, v4, scene);
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;
2023-06-12 23:41:51 +08:00
lea ecx, buffer;
call acceptNewFriendCall1;
mov esi, 0x0;
mov edi, scene;
push esi;
push edi;
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;
2023-06-12 23:41:51 +08:00
call acceptNewFriendCall2;
2022-08-21 08:45:16 +08:00
sub esp, 0x8;
push 0x0;
2023-06-12 23:41:51 +08:00
lea eax, nullbuffer;
2022-08-21 08:45:16 +08:00
push eax;
2023-03-05 12:30:02 +08:00
lea eax, wxV3;
2022-08-21 08:45:16 +08:00
push eax;
2023-06-12 23:41:51 +08:00
lea ecx, buffer;
call acceptNewFriendCall3;
mov success, eax;
lea ecx, buffer;
call acceptNewFriendCall4;
2022-08-21 08:45:16 +08:00
popfd;
popad;
}
2023-06-12 23:41:51 +08:00
return success; // 成功返回 1
2022-08-21 08:45:16 +08:00
}