Format codes
This commit is contained in:
parent
f757c95e0d
commit
1299128bf1
@ -1,19 +1,14 @@
|
||||
// dllmain.cpp : 定义 DLL 应用程序的入口点。
|
||||
#include "framework.h"
|
||||
|
||||
BOOL APIENTRY DllMain( HMODULE hModule,
|
||||
DWORD ul_reason_for_call,
|
||||
LPVOID lpReserved
|
||||
)
|
||||
BOOL APIENTRY DllMain(HMODULE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
|
||||
{
|
||||
switch (ul_reason_for_call)
|
||||
{
|
||||
case DLL_PROCESS_ATTACH:
|
||||
case DLL_THREAD_ATTACH:
|
||||
case DLL_THREAD_DETACH:
|
||||
case DLL_PROCESS_DETACH:
|
||||
break;
|
||||
switch (ul_reason_for_call) {
|
||||
case DLL_PROCESS_ATTACH:
|
||||
case DLL_THREAD_ATTACH:
|
||||
case DLL_THREAD_DETACH:
|
||||
case DLL_PROCESS_DETACH:
|
||||
break;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,7 @@ static void *GetFuncAddr(LPCWSTR dllPath, HMODULE dllBase, LPCSTR funcName)
|
||||
}
|
||||
|
||||
void *absAddr = GetProcAddress(hLoaded, funcName);
|
||||
DWORD offset = (DWORD)absAddr - (DWORD)hLoaded;
|
||||
DWORD offset = (DWORD)absAddr - (DWORD)hLoaded;
|
||||
|
||||
FreeLibrary(hLoaded);
|
||||
|
||||
|
@ -8,9 +8,9 @@
|
||||
#include "sdk.h"
|
||||
#include "util.h"
|
||||
|
||||
static DWORD wcPid = 0;
|
||||
static HANDLE wcProcess = NULL;
|
||||
static HMODULE spyBase = NULL;
|
||||
static DWORD wcPid = 0;
|
||||
static HANDLE wcProcess = NULL;
|
||||
static HMODULE spyBase = NULL;
|
||||
static WCHAR spyDllPath[MAX_PATH] = { 0 };
|
||||
|
||||
int WxInitSDK()
|
||||
|
@ -7,7 +7,7 @@
|
||||
extern WxCalls_t g_WxCalls;
|
||||
extern DWORD g_WeChatWinDllAddr;
|
||||
|
||||
bool GetContacts(wcf::Contacts* contacts)
|
||||
bool GetContacts(wcf::Contacts *contacts)
|
||||
{
|
||||
DWORD baseAddr = g_WeChatWinDllAddr + g_WxCalls.contact.base;
|
||||
DWORD tempAddr = GET_DWORD(baseAddr);
|
||||
@ -15,7 +15,7 @@ bool GetContacts(wcf::Contacts* contacts)
|
||||
DWORD node = GET_DWORD(head);
|
||||
|
||||
while (node != head) {
|
||||
wcf::Contact* cnt = contacts->add_contacts();
|
||||
wcf::Contact *cnt = contacts->add_contacts();
|
||||
cnt->set_wxid(GetStringByAddress(node + g_WxCalls.contact.wxId));
|
||||
cnt->set_code(GetStringByAddress(node + g_WxCalls.contact.wxCode));
|
||||
cnt->set_name(GetStringByAddress(node + g_WxCalls.contact.wxName));
|
||||
|
@ -5,8 +5,6 @@
|
||||
#define LOGGER_MAX_SIZE 1024 * 1024 * 10 // 10M
|
||||
#define LOGGER_MAX_FILES 10 // 10 files
|
||||
|
||||
|
||||
|
||||
void InitLogger()
|
||||
{
|
||||
static std::shared_ptr<spdlog::logger> gLogger = nullptr;
|
||||
|
@ -21,9 +21,9 @@ extern condition_variable gCv;
|
||||
extern WxCalls_t g_WxCalls;
|
||||
extern DWORD g_WeChatWinDllAddr;
|
||||
|
||||
static DWORD reg_buffer = 0;
|
||||
static DWORD recvMsgHookAddr = 0;
|
||||
static DWORD recvMsgCallAddr = 0;
|
||||
static DWORD reg_buffer = 0;
|
||||
static DWORD recvMsgHookAddr = 0;
|
||||
static DWORD recvMsgCallAddr = 0;
|
||||
static DWORD recvMsgJumpBackAddr = 0;
|
||||
static CHAR recvMsgBackupCode[5] = { 0 };
|
||||
|
||||
@ -57,7 +57,7 @@ void HookAddress(DWORD hookAddr, LPVOID funcAddr, CHAR recvMsgBackupCode[5])
|
||||
{
|
||||
//组装跳转数据
|
||||
BYTE jmpCode[5] = { 0 };
|
||||
jmpCode[0] = 0xE9;
|
||||
jmpCode[0] = 0xE9;
|
||||
|
||||
//计算偏移
|
||||
*(DWORD *)&jmpCode[1] = (DWORD)funcAddr - hookAddr - 5;
|
||||
@ -113,7 +113,7 @@ __declspec(naked) void RecieveMsgFunc()
|
||||
|
||||
__asm
|
||||
{
|
||||
call recvMsgCallAddr // 这个为被覆盖的call
|
||||
call recvMsgCallAddr // 这个为被覆盖的call
|
||||
jmp recvMsgJumpBackAddr // 跳回被HOOK指令的下一条指令
|
||||
}
|
||||
}
|
||||
@ -125,8 +125,8 @@ void ListenMessage()
|
||||
return;
|
||||
}
|
||||
|
||||
recvMsgHookAddr = g_WeChatWinDllAddr + g_WxCalls.recvMsg.hook;
|
||||
recvMsgCallAddr = g_WeChatWinDllAddr + g_WxCalls.recvMsg.call;
|
||||
recvMsgHookAddr = g_WeChatWinDllAddr + g_WxCalls.recvMsg.hook;
|
||||
recvMsgCallAddr = g_WeChatWinDllAddr + g_WxCalls.recvMsg.call;
|
||||
recvMsgJumpBackAddr = recvMsgHookAddr + 5;
|
||||
|
||||
HookAddress(recvMsgHookAddr, RecieveMsgFunc, recvMsgBackupCode);
|
||||
|
@ -4,4 +4,4 @@
|
||||
|
||||
void ListenMessage();
|
||||
void UnListenMessage();
|
||||
void GetMsgTypes(wcf::MsgTypes* types);
|
||||
void GetMsgTypes(wcf::MsgTypes *types);
|
||||
|
@ -139,8 +139,8 @@ public:
|
||||
|
||||
ServerUnaryReactor *RpcSendTextMsg(CallbackServerContext *context, const TextMsg *msg, Response *rsp) override
|
||||
{
|
||||
wstring wswxid = String2Wstring(msg->receiver());
|
||||
wstring wsmsg = String2Wstring(msg->msg());
|
||||
wstring wswxid = String2Wstring(msg->receiver());
|
||||
wstring wsmsg = String2Wstring(msg->msg());
|
||||
wstring wsatusers = String2Wstring(msg->aters());
|
||||
|
||||
SendTextMessage(wswxid.c_str(), wsmsg.c_str(), wsatusers.c_str());
|
||||
@ -173,7 +173,7 @@ public:
|
||||
|
||||
ServerUnaryReactor *RpcGetContacts(CallbackServerContext *context, const Empty *empty, Contacts *rsp) override
|
||||
{
|
||||
bool ret = GetContacts(rsp);
|
||||
bool ret = GetContacts(rsp);
|
||||
auto *reactor = context->DefaultReactor();
|
||||
if (ret) {
|
||||
reactor->Finish(Status::OK);
|
||||
@ -214,7 +214,7 @@ public:
|
||||
ServerUnaryReactor *RpcAcceptNewFriend(CallbackServerContext *context, const Verification *v,
|
||||
Response *rsp) override
|
||||
{
|
||||
bool ret = AcceptNewFriend(String2Wstring(v->v3()), String2Wstring(v->v4()));
|
||||
bool ret = AcceptNewFriend(String2Wstring(v->v3()), String2Wstring(v->v4()));
|
||||
auto *reactor = context->DefaultReactor();
|
||||
if (ret) {
|
||||
rsp->set_status(0);
|
||||
|
@ -3,8 +3,8 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "spy_types.h"
|
||||
#include "send_msg.h"
|
||||
#include "spy_types.h"
|
||||
|
||||
extern HANDLE g_hEvent;
|
||||
extern WxCalls_t g_WxCalls;
|
||||
|
@ -4,7 +4,7 @@
|
||||
#include "rpc_server.h"
|
||||
#include "util.h"
|
||||
|
||||
WxCalls_t g_WxCalls = { 0 };
|
||||
WxCalls_t g_WxCalls = { 0 };
|
||||
DWORD g_WeChatWinDllAddr = 0;
|
||||
|
||||
void InitSpy()
|
||||
|
Loading…
Reference in New Issue
Block a user