commit
d5cff6f733
@ -110,6 +110,7 @@
|
||||
<DisableSpecificWarnings>4251;4819</DisableSpecificWarnings>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
<AdditionalOptions>/EHa %(AdditionalOptions)</AdditionalOptions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
@ -123,6 +124,9 @@
|
||||
<PostBuildEvent>
|
||||
<Command>if not exist $(SolutionDir)Out md $(SolutionDir)Out
|
||||
xcopy /y $(OutDir)$(TargetFileName) $(SolutionDir)Out
|
||||
xcopy /y $(OutDir)$(TargetName).exp $(SolutionDir)Out
|
||||
xcopy /y $(OutDir)$(TargetName).lib $(SolutionDir)Out
|
||||
xcopy /y $(OutDir)$(TargetName).pdb $(SolutionDir)Out
|
||||
xcopy /y $(OutDir)$(TargetFileName) $(SolutionDir)python\wcferry</Command>
|
||||
</PostBuildEvent>
|
||||
<PostBuildEvent>
|
||||
@ -236,6 +240,7 @@ C:\Tools\nanopb\protoc --nanopb_out=. wcf.proto
|
||||
<ClInclude Include="send_msg.h" />
|
||||
<ClInclude Include="spy.h" />
|
||||
<ClInclude Include="spy_types.h" />
|
||||
<ClInclude Include="user_info.h" />
|
||||
<ClInclude Include="util.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
@ -255,6 +260,7 @@ C:\Tools\nanopb\protoc --nanopb_out=. wcf.proto
|
||||
<ClCompile Include="rpc_server.cpp" />
|
||||
<ClCompile Include="send_msg.cpp" />
|
||||
<ClCompile Include="spy.cpp" />
|
||||
<ClCompile Include="user_info.cpp" />
|
||||
<ClCompile Include="util.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
@ -78,6 +78,9 @@
|
||||
<ClInclude Include="add_chatroom_member.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="user_info.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="dllmain.cpp">
|
||||
@ -131,6 +134,9 @@
|
||||
<ClCompile Include="add_chatroom_member.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="user_info.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="spy.def">
|
||||
|
@ -28,14 +28,14 @@
|
||||
#include "send_msg.h"
|
||||
#include "spy.h"
|
||||
#include "spy_types.h"
|
||||
#include "user_info.h"
|
||||
#include "util.h"
|
||||
|
||||
#define G_BUF_SIZE (16 * 1024 * 1024)
|
||||
#define CMD_URL "tcp://0.0.0.0:10086"
|
||||
#define MSG_URL "tcp://0.0.0.0:10087"
|
||||
|
||||
extern int IsLogin(void); // Defined in spy.cpp
|
||||
extern string GetSelfWxid(); // Defined in spy.cpp
|
||||
extern int IsLogin(void); // Defined in spy.cpp
|
||||
|
||||
bool gIsListening;
|
||||
mutex gMutex;
|
||||
|
@ -11,18 +11,18 @@ void InitSpy()
|
||||
{
|
||||
wchar_t version[16] = { 0 };
|
||||
InitLogger();
|
||||
g_WeChatWinDllAddr = (DWORD)GetModuleHandle(L"WeChatWin.dll"); //获取wechatWin模块地址
|
||||
g_WeChatWinDllAddr = (DWORD)GetModuleHandle(L"WeChatWin.dll"); // 获取wechatWin模块地址
|
||||
if (g_WeChatWinDllAddr == 0) {
|
||||
LOG_ERROR("获取wechatWin.dll模块地址失败");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!GetWeChatVersion(version)) { //获取微信版本
|
||||
if (!GetWeChatVersion(version)) { // 获取微信版本
|
||||
LOG_ERROR("获取微信版本失败");
|
||||
return;
|
||||
}
|
||||
LOG_DEBUG("WeChat version: {}", Wstring2String(version).c_str());
|
||||
if (LoadCalls(version, &g_WxCalls) != 0) { //加载微信版本对应的Call地址
|
||||
if (LoadCalls(version, &g_WxCalls) != 0) { // 加载微信版本对应的Call地址
|
||||
LOG_ERROR("不支持当前版本");
|
||||
return;
|
||||
}
|
||||
@ -37,5 +37,3 @@ void CleanupSpy()
|
||||
}
|
||||
|
||||
int IsLogin(void) { return (int)GET_DWORD(g_WeChatWinDllAddr + g_WxCalls.login); }
|
||||
|
||||
std::string GetSelfWxid() { return GET_STRING(g_WeChatWinDllAddr + g_WxCalls.ui.wxid); }
|
||||
|
25
spy/user_info.cpp
Normal file
25
spy/user_info.cpp
Normal file
@ -0,0 +1,25 @@
|
||||
#include "user_info.h"
|
||||
#include "load_calls.h"
|
||||
#include "log.h"
|
||||
#include "util.h"
|
||||
|
||||
extern WxCalls_t g_WxCalls;
|
||||
extern DWORD g_WeChatWinDllAddr;
|
||||
|
||||
std::string GetSelfWxid()
|
||||
{
|
||||
DWORD wxidType = 0;
|
||||
try {
|
||||
wxidType = GET_DWORD(g_WeChatWinDllAddr + g_WxCalls.ui.wxid + 0x14);
|
||||
LOG_DEBUG("WeChatWinDll: {:#x}, wxid type: {:#x}", g_WeChatWinDllAddr, wxidType);
|
||||
if (wxidType == 0xF) {
|
||||
return GET_STRING_FROM_P(g_WeChatWinDllAddr + g_WxCalls.ui.wxid);
|
||||
} else {
|
||||
return GET_STRING(g_WeChatWinDllAddr + g_WxCalls.ui.wxid);
|
||||
}
|
||||
} catch (...) {
|
||||
LOG_ERROR("wxid type: {:#x}", wxidType);
|
||||
LOG_BUFFER((uint8_t *)(g_WeChatWinDllAddr + g_WxCalls.ui.wxid), 20);
|
||||
return "empty_wxid";
|
||||
}
|
||||
}
|
5
spy/user_info.h
Normal file
5
spy/user_info.h
Normal file
@ -0,0 +1,5 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
std::string GetSelfWxid();
|
@ -8,9 +8,10 @@
|
||||
#define WECHATINJECTDLL L"spy.dll"
|
||||
#define WECHATINJECTDLL_DEBUG L"spy_debug.dll"
|
||||
|
||||
#define GET_DWORD(addr) ((DWORD) * (DWORD *)(addr))
|
||||
#define GET_STRING(addr) ((CHAR *)(*(DWORD *)(addr)))
|
||||
#define GET_WSTRING(addr) ((WCHAR *)(*(DWORD *)(addr)))
|
||||
#define GET_DWORD(addr) ((DWORD) * (DWORD *)(addr))
|
||||
#define GET_STRING(addr) ((CHAR *)(*(DWORD *)(addr)))
|
||||
#define GET_WSTRING(addr) ((WCHAR *)(*(DWORD *)(addr)))
|
||||
#define GET_STRING_FROM_P(addr) ((CHAR *)(addr))
|
||||
|
||||
DWORD GetWeChatPid();
|
||||
int OpenWeChat(DWORD *pid);
|
||||
|
Loading…
Reference in New Issue
Block a user