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