commit
e2a44bd3f6
252
README.MD
252
README.MD
@ -16,6 +16,29 @@
|
||||
|
||||
</details>
|
||||
|
||||
|[📖 Python 文档](https://wechatferry.readthedocs.io/)|[📺 Python 视频教程](https://mp.weixin.qq.com/s/APdjGyZ2hllXxyG_sNCfXQ)|[🙋 FAQ](https://mp.weixin.qq.com/s/eMQgP1TiEqAxmpxYljSgeg)|
|
||||
|:-:|:-:|:-:|
|
||||
|
||||
👉 [WeChatRobot🤖](https://github.com/lich0821/WeChatRobot),一个基于 WeChatFerry 的 Python 机器人框架。
|
||||
|
||||
<details><summary>点击查看功能清单</summary>
|
||||
|
||||
* 检查登录状态
|
||||
* 获取登录账号信息(wxid、昵称、手机号、数据目录)
|
||||
* 获取消息类型
|
||||
* 发送文本消息(可 @)
|
||||
* 发送图片
|
||||
* 允许接收消息
|
||||
* 停止接收消息
|
||||
|
||||
</details>
|
||||
|
||||
<details><summary>点击查看支持的客户端</summary>
|
||||
|
||||
* Python
|
||||
|
||||
</details>
|
||||
|
||||
|||
|
||||
|:-:|:-:|
|
||||
|后台回复 `WCF` 加群交流|如果你觉得有用|
|
||||
@ -127,11 +150,16 @@ WeChatFerry
|
||||
|
||||
## 版本更新
|
||||
|
||||
### v39.1.0 (2024.04.19)
|
||||
### v39.2.0
|
||||
|
||||
* 适配 x64 环境
|
||||
* 重构项目
|
||||
* 开始适配 `3.9.10.19`
|
||||
* 开始适配 `3.9.10.27`
|
||||
* 实现检查登录状态
|
||||
* 实现获取登录账号信息(wxid、昵称、手机号、数据目录)
|
||||
* 实现获取消息类型
|
||||
* 实现开启接收消息
|
||||
* 实现停止接收消息
|
||||
* 实现发送文本消息(可 @)
|
||||
* 实现发送图片消息
|
||||
|
||||
<details><summary>点击查看更多</summary>
|
||||
|
||||
@ -143,218 +171,10 @@ WeChatFerry
|
||||
* `y` 是 `WeChatFerry` 的版本,从 0 开始
|
||||
* `z` 是各客户端的版本,从 0 开始
|
||||
|
||||
### v39.0.14 (2024.02.18)
|
||||
### v39.1.0 (2024.04.19)
|
||||
|
||||
* 修复获取登录二维码问题
|
||||
|
||||
### v39.0.13 (2024.02.14)
|
||||
|
||||
* 修复若干问题
|
||||
* 撤回消息
|
||||
* 获取登录二维码
|
||||
|
||||
### v39.0.12 (2023.12.20)
|
||||
|
||||
* 修复一个问题
|
||||
* 消息转发
|
||||
|
||||
### v39.0.11 (2023.12.16)
|
||||
|
||||
* 修复 PB 消息类型(可能会导致非 Python 客户端崩溃)
|
||||
* 修复日志错误
|
||||
* 移除非必要依赖
|
||||
|
||||
### v39.0.10 (2023.12.08)
|
||||
|
||||
* 代码优化
|
||||
* 发送卡片消息
|
||||
* 拍一拍群友
|
||||
* 邀请群成员
|
||||
* 图片 OCR
|
||||
|
||||
### v39.0.7 (2023.12.03)
|
||||
|
||||
* 保存语音
|
||||
|
||||
### v39.0.6 (2023.11.26)
|
||||
|
||||
* 修复下载图片退出问题
|
||||
|
||||
### v39.0.5 (2023.11.22)
|
||||
|
||||
* 修复收到某些文件崩溃问题
|
||||
|
||||
### v39.0.4 (2023.11.21)
|
||||
|
||||
* 下载图片、文件和视频
|
||||
|
||||
### v39.0.3 (2023.09.28)
|
||||
|
||||
* 修复登录账号昵称超长报错问题
|
||||
|
||||
### v39.0.2 (2023.07.16)
|
||||
|
||||
* 修复朋友圈消息 `is_group` 为 `True` 问题
|
||||
|
||||
### v39.0.1 (2023.07.16)
|
||||
|
||||
* 获取朋友圈消息
|
||||
|
||||
### v39.0.0 (2023.07.14)
|
||||
|
||||
升级到 `3.9.2.23`。
|
||||
|
||||
### v37.1.25 (2023.05.07)
|
||||
|
||||
更新版本编码。
|
||||
|
||||
根据新版本编码规则:
|
||||
* `WeChatFerry` 的 `v3.7.0.30.25` 应调整为:`v37.1.25`,因为此前曾适配过 `3.7.0.29`。
|
||||
* Python 客户端 `wcferry` 的 `v3.7.0.30.25` 应该调整为 `v37.1.25.0`
|
||||
* HTTP 客户端 `wcfhttp` 的 `v3.7.0.30.25` 应该调整为 `v37.1.25.0`
|
||||
|
||||
### v3.7.0.30.25 (2023.05.05)
|
||||
|
||||
* 修复群消息判断错误
|
||||
* 修复名片添加好友问题
|
||||
* 修复获取数据库多余字符问题
|
||||
* 添加 Python 文档
|
||||
* Python 客户端发送图片支持网络路径
|
||||
|
||||
### v3.7.0.30.24 (2023.04.19)
|
||||
|
||||
实现了一个功能。
|
||||
|
||||
### v3.7.0.30.23 (2023.04.13)
|
||||
|
||||
* 解密图片
|
||||
* 获取登录账号信息
|
||||
* 获取联系人备注
|
||||
|
||||
### v3.7.0.30.22(2023.04.09)
|
||||
|
||||
将监听端口调整为可配置。
|
||||
|
||||
### v3.7.0.30.21(2023.03.15)
|
||||
|
||||
* 发送表情
|
||||
|
||||
### v3.7.0.30.20(2023.03.12)
|
||||
|
||||
修复 wxid 获取问题。
|
||||
|
||||
### v3.7.0.30.19(2023.03.06)
|
||||
|
||||
修复重复消息问题。
|
||||
|
||||
### v3.7.0.30.18(2023.03.05)
|
||||
|
||||
修复添加好友问题。
|
||||
|
||||
### v3.7.0.30.17(2023.03.05)
|
||||
|
||||
修复获取登录账号 wxid 问题。
|
||||
|
||||
### v3.7.0.30.16(2023.03.04)
|
||||
|
||||
将错误码改成错误消息,方便调试。
|
||||
|
||||
### v3.7.0.30.15(2023.03.01)
|
||||
|
||||
* 发送 xml
|
||||
|
||||
### v3.7.0.30.14(2023.02.28)
|
||||
|
||||
* 添加群成员
|
||||
|
||||
### v3.7.0.30.13(2023.02.27)
|
||||
|
||||
去除 gRPC 框架,自定义更轻量的 RPC 轮子 `nnprc`。
|
||||
|
||||
### v3.7.0.30.12(2023.01.20)
|
||||
|
||||
* 更新 Python 客户端
|
||||
* 修改监听地址为 `0.0.0.0:10086`
|
||||
* 增加 `Launcher`,直接注入 `spy`
|
||||
|
||||
### v3.7.0.30.11(2022.10.19)
|
||||
|
||||
更新 Python 客户端。
|
||||
|
||||
### v3.7.0.30-gRPC-2(2022.10.18)
|
||||
|
||||
增加 Java 客户端。
|
||||
|
||||
### v3.7.0.30-gRPC-1(2022.10.16)
|
||||
|
||||
将 RPC 框架切换为 gRPC!
|
||||
|
||||
### v3.7.0.30-8(2022.09.25)
|
||||
|
||||
* 获取登录账号微信 ID
|
||||
|
||||
### v3.7.0.30-7(2022.09.24)
|
||||
|
||||
修复群聊有系统消息时会崩溃 bug。后续考虑把消息来源交还给客户端自己区别。
|
||||
|
||||
### v3.7.0.30-6(2022.08.21)
|
||||
|
||||
* 通过好友验证
|
||||
|
||||
### v3.7.0.30-5(2022.08.20)
|
||||
|
||||
* 执行 SQL 语句
|
||||
|
||||
### v3.7.0.30-4(2022.08.20)
|
||||
|
||||
修复群消息 @人 功能。有几点注意事项:
|
||||
1. `vAtWxids` 是要 `@` 的 `wxid` 清单,以 `,` 分隔。
|
||||
2. 只有群主才能 `@所有人`,非群主硬发 `@所有人` 会导致消息发不出去;`@所有人` 对应 `vAtWxids` 为 `"notify@all"`。
|
||||
3. 消息体里 `@` 的数量必须与 `vAtWxids` 里的数量一致,否则消息能发出但 `@` 功能失效。
|
||||
|
||||
### v3.7.0.30-3(2022.08.20)
|
||||
|
||||
修复可重入 bug。
|
||||
|
||||
### v3.7.0.30-2(2022.08.14)
|
||||
|
||||
优化 Hook 和 Inject 代码,实现可重入。
|
||||
|
||||
### v3.7.0.30-1(2022.08.12)
|
||||
|
||||
适配微信 `3.7.0.30`。
|
||||
|
||||
### v3.7.0.29-3(2022.08.7)
|
||||
|
||||
* 查询数据库,获取库、表。
|
||||
|
||||
### v3.7.0.29-2(2022.08.7)
|
||||
|
||||
优化 RPC。
|
||||
|
||||
### v3.7.0.29-1(2022.08.7)
|
||||
|
||||
适配微信 `3.7.0.29`。
|
||||
|
||||
### v3.3.0.115-3(2021.08.28)
|
||||
|
||||
适配微信 `3.3.0.115`,新增功能:
|
||||
* 获取所有联系人
|
||||
|
||||
### v3.3.0.115-2(2021.08.22)
|
||||
|
||||
适配微信 `3.3.0.115`,新增功能:
|
||||
* 发送图片消息
|
||||
|
||||
### v3.3.0.115-1(2021.08.22)
|
||||
|
||||
适配微信 `3.3.0.115`。
|
||||
|
||||
### v3.0.0.57-1(2021.02.12)
|
||||
|
||||
适配微信 `3.0.0.57`,支持功能:
|
||||
* 登录状态判断
|
||||
* 接收文本消息
|
||||
* 发送文本消息
|
||||
* 适配 x64 环境
|
||||
* 重构项目
|
||||
* 开始适配 `3.9.10.19`
|
||||
|
||||
</details>
|
||||
|
@ -13,14 +13,18 @@ EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|x64 = Debug|x64
|
||||
Dev|x64 = Dev|x64
|
||||
Release|x64 = Release|x64
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{4DE80B82-5F6A-4C4C-9D16-1574308110FA}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{4DE80B82-5F6A-4C4C-9D16-1574308110FA}.Debug|x64.Build.0 = Debug|x64
|
||||
{4DE80B82-5F6A-4C4C-9D16-1574308110FA}.Dev|x64.ActiveCfg = Dev|x64
|
||||
{4DE80B82-5F6A-4C4C-9D16-1574308110FA}.Dev|x64.Build.0 = Dev|x64
|
||||
{4DE80B82-5F6A-4C4C-9D16-1574308110FA}.Release|x64.ActiveCfg = Release|x64
|
||||
{4DE80B82-5F6A-4C4C-9D16-1574308110FA}.Release|x64.Build.0 = Release|x64
|
||||
{ABFCB647-137F-478B-A73E-F0B1E3ADC215}.Debug|x64.ActiveCfg = Debug|x64
|
||||
{ABFCB647-137F-478B-A73E-F0B1E3ADC215}.Dev|x64.ActiveCfg = Dev|x64
|
||||
{ABFCB647-137F-478B-A73E-F0B1E3ADC215}.Release|x64.ActiveCfg = Release|x64
|
||||
{ABFCB647-137F-478B-A73E-F0B1E3ADC215}.Release|x64.Build.0 = Release|x64
|
||||
EndGlobalSection
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include <vector>
|
||||
#include <wchar.h>
|
||||
|
||||
#include "log.h"
|
||||
#include "util.h"
|
||||
|
||||
#pragma comment(lib, "shlwapi")
|
||||
@ -296,3 +297,23 @@ void DbgMsg(const char *zcFormat, ...)
|
||||
|
||||
OutputDebugStringA(strText.c_str());
|
||||
}
|
||||
|
||||
WxString *NewWxStringFromStr(const string &str) { return NewWxStringFromWstr(String2Wstring(str)); }
|
||||
|
||||
WxString *NewWxStringFromWstr(const wstring &ws)
|
||||
{
|
||||
WxString *p = (WxString *)HeapAlloc(GetProcessHeap(), 0, sizeof(WxString));
|
||||
wchar_t *pWstring = (wchar_t *)HeapAlloc(GetProcessHeap(), 0, (ws.size() + 1) * 2);
|
||||
if (p == NULL || pWstring == NULL) {
|
||||
LOG_ERROR("Out of Memory...");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
wmemcpy(pWstring, ws.c_str(), ws.size() + 1);
|
||||
p->wptr = pWstring;
|
||||
p->size = (DWORD)ws.size();
|
||||
p->capacity = (DWORD)ws.size();
|
||||
p->ptr = 0;
|
||||
p->clen = 0;
|
||||
return p;
|
||||
}
|
||||
|
@ -2,6 +2,8 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
#include "spy_types.h"
|
||||
|
||||
#define WECHAREXE L"WeChat.exe"
|
||||
#define WECHATWINDLL L"WeChatWin.dll"
|
||||
#define WCFSDKDLL L"sdk.dll"
|
||||
@ -34,3 +36,5 @@ std::string GetStringByAddress(UINT64 address);
|
||||
std::string GetStringByStrAddr(UINT64 addr);
|
||||
std::string GetStringByWstrAddr(UINT64 addr);
|
||||
void DbgMsg(const char *zcFormat, ...);
|
||||
WxString *NewWxStringFromStr(const std::string &str);
|
||||
WxString *NewWxStringFromWstr(const std::wstring &ws);
|
||||
|
@ -1,18 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Dev|x64">
|
||||
<Configuration>Dev</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
@ -26,20 +22,13 @@
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Dev|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
@ -57,44 +46,34 @@
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Dev|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Dev|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<VcpkgUseStatic>true</VcpkgUseStatic>
|
||||
<VcpkgTriplet>x86-windows-static</VcpkgTriplet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<VcpkgUseStatic>true</VcpkgUseStatic>
|
||||
<VcpkgTriplet>x64-windows-static</VcpkgTriplet>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;SDK_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>_DEBUG;SDK_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||
@ -106,37 +85,7 @@
|
||||
<ModuleDefinitionFile>sdk.def</ModuleDefinitionFile>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;SDK_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>
|
||||
</PrecompiledHeaderFile>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)spy;C:\Tools\vcpkg\installed\x86-windows-static\include</AdditionalIncludeDirectories>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableUAC>false</EnableUAC>
|
||||
<ModuleDefinitionFile>sdk.def</ModuleDefinitionFile>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>xcopy /y $(OutDir)$(TargetFileName) $(SolutionDir)Out</Command>
|
||||
</PostBuildEvent>
|
||||
<PostBuildEvent>
|
||||
<Message>Copy files</Message>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Dev|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
|
BIN
WeChatFerry/smc/Codec.lib
Normal file → Executable file
BIN
WeChatFerry/smc/Codec.lib
Normal file → Executable file
Binary file not shown.
@ -1,18 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Dev|x64">
|
||||
<Configuration>Dev</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
@ -24,24 +20,16 @@
|
||||
<ProjectGuid>{4de80b82-5f6a-4c4c-9d16-1574308110fa}</ProjectGuid>
|
||||
<RootNamespace>spy</RootNamespace>
|
||||
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
|
||||
<VcpkgTriplet Condition="'$(Platform)'=='Win32'">x86-windows-static</VcpkgTriplet>
|
||||
<VcpkgTriplet Condition="'$(Platform)'=='x64'">x64-windows-static</VcpkgTriplet>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>false</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Dev|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<PlatformToolset>v142</PlatformToolset>
|
||||
@ -59,141 +47,38 @@
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="Shared">
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Dev|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<TargetName>$(ProjectName)_debug</TargetName>
|
||||
<PreBuildEventUseInBuild>true</PreBuildEventUseInBuild>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<PreBuildEventUseInBuild>true</PreBuildEventUseInBuild>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Dev|x64'">
|
||||
<LinkIncremental>true</LinkIncremental>
|
||||
<TargetName>$(ProjectName)_debug</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<VcpkgUseStatic>true</VcpkgUseStatic>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<VcpkgUseStatic>true</VcpkgUseStatic>
|
||||
<VcpkgConfiguration>Release</VcpkgConfiguration>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Dev|x64'" Label="Vcpkg">
|
||||
<VcpkgUseStatic>true</VcpkgUseStatic>
|
||||
<VcpkgConfiguration>Release</VcpkgConfiguration>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Vcpkg" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<VcpkgUseStatic>true</VcpkgUseStatic>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;SPY_EXPORTS;_WINDOWS;_USRDLL;ENABLE_DEBUG_LOG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>
|
||||
</PrecompiledHeaderFile>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)rpc;$(SolutionDir)rpc\nanopb;$(SolutionDir)rpc\proto;$(SolutionDir)smc;$(SolutionDir)spy;C:\Tools\vcpkg\installed\x86-windows-static\include</AdditionalIncludeDirectories>
|
||||
<PrecompiledHeaderOutputFile />
|
||||
<DisableSpecificWarnings>4251;4731;4819</DisableSpecificWarnings>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
<AdditionalOptions>/EHa %(AdditionalOptions)</AdditionalOptions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableUAC>false</EnableUAC>
|
||||
<AdditionalDependencies>iphlpapi.lib;wsock32.lib;ws2_32.lib;crypt32.lib;Codec.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<ModuleDefinitionFile>spy.def</ModuleDefinitionFile>
|
||||
<AdditionalLibraryDirectories>$(SolutionDir)smc;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalOptions> /ignore:4099 %(AdditionalOptions)</AdditionalOptions>
|
||||
</Link>
|
||||
<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)..\clients\python\wcferry</Command>
|
||||
</PostBuildEvent>
|
||||
<PostBuildEvent>
|
||||
<Message>Copy spy.dll</Message>
|
||||
</PostBuildEvent>
|
||||
<PreBuildEvent>
|
||||
<Command>cd $(SolutionDir)rpc\proto
|
||||
$(SolutionDir)rpc\tool\protoc --nanopb_out=. wcf.proto</Command>
|
||||
</PreBuildEvent>
|
||||
<PreBuildEvent>
|
||||
<Message>Generating PB files</Message>
|
||||
</PreBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;SPY_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>
|
||||
</PrecompiledHeaderFile>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)rpc;$(SolutionDir)rpc\nanopb;$(SolutionDir)rpc\proto;$(SolutionDir)smc;$(SolutionDir)spy;C:\Tools\vcpkg\installed\x86-windows-static\include</AdditionalIncludeDirectories>
|
||||
<PrecompiledHeaderOutputFile />
|
||||
<DisableSpecificWarnings>4251;4731;4819</DisableSpecificWarnings>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
<AdditionalOptions>/EHa %(AdditionalOptions)</AdditionalOptions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableUAC>false</EnableUAC>
|
||||
<AdditionalDependencies>iphlpapi.lib;wsock32.lib;ws2_32.lib;crypt32.lib;Codec.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<ModuleDefinitionFile>spy.def</ModuleDefinitionFile>
|
||||
<AdditionalLibraryDirectories>$(SolutionDir)smc;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalOptions> /ignore:4099 %(AdditionalOptions)</AdditionalOptions>
|
||||
</Link>
|
||||
<PostBuildEvent>
|
||||
<Command>if not exist $(SolutionDir)Out md $(SolutionDir)Out
|
||||
xcopy /y $(OutDir)$(TargetFileName) $(SolutionDir)Out
|
||||
xcopy /y $(OutDir)$(TargetFileName) $(SolutionDir)..\clients\python\wcferry</Command>
|
||||
</PostBuildEvent>
|
||||
<PostBuildEvent>
|
||||
<Message>Copy spy.dll</Message>
|
||||
</PostBuildEvent>
|
||||
<PreBuildEvent>
|
||||
<Command>cd $(SolutionDir)rpc\proto
|
||||
$(SolutionDir)rpc\tool\protoc --nanopb_out=. wcf.proto</Command>
|
||||
</PreBuildEvent>
|
||||
<PreBuildEvent>
|
||||
<Message>Generating PB files</Message>
|
||||
</PreBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
@ -207,7 +92,7 @@ $(SolutionDir)rpc\tool\protoc --nanopb_out=. wcf.proto</Command>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)com;$(SolutionDir)rpc;$(SolutionDir)rpc\nanopb;$(SolutionDir)rpc\proto;$(SolutionDir)smc;$(SolutionDir)spy;C:\Tools\vcpkg\installed\x64-windows-static\include</AdditionalIncludeDirectories>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<OmitFramePointers>false</OmitFramePointers>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<PrecompiledHeaderOutputFile />
|
||||
<DisableSpecificWarnings>4251;4731;4819</DisableSpecificWarnings>
|
||||
@ -236,6 +121,55 @@ 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)..\clients\python\wcferry</Command>
|
||||
</PostBuildEvent>
|
||||
<PostBuildEvent>
|
||||
<Message>Copy spy.dll</Message>
|
||||
</PostBuildEvent>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Dev|x64'">
|
||||
<ClCompile>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SDLCheck>true</SDLCheck>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;SPY_EXPORTS;_WINDOWS;_USRDLL;ENABLE_DEBUG_LOG;ENABLE_WX_LOG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<ConformanceMode>true</ConformanceMode>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>
|
||||
</PrecompiledHeaderFile>
|
||||
<LanguageStandard>stdcpp17</LanguageStandard>
|
||||
<AdditionalIncludeDirectories>$(SolutionDir)com;$(SolutionDir)rpc;$(SolutionDir)rpc\nanopb;$(SolutionDir)rpc\proto;$(SolutionDir)smc;$(SolutionDir)spy;C:\Tools\vcpkg\installed\x64-windows-static\include</AdditionalIncludeDirectories>
|
||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||
<OmitFramePointers>false</OmitFramePointers>
|
||||
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<PrecompiledHeaderOutputFile>
|
||||
</PrecompiledHeaderOutputFile>
|
||||
<DisableSpecificWarnings>4251;4731;4819</DisableSpecificWarnings>
|
||||
<AdditionalOptions>/EHa %(AdditionalOptions)</AdditionalOptions>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableUAC>false</EnableUAC>
|
||||
<ModuleDefinitionFile>spy.def</ModuleDefinitionFile>
|
||||
<AdditionalOptions> /ignore:4099 %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalLibraryDirectories>$(SolutionDir)smc;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalDependencies>iphlpapi.lib;wsock32.lib;ws2_32.lib;crypt32.lib;Codec.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
</Link>
|
||||
<PreBuildEvent>
|
||||
<Command>cd $(SolutionDir)rpc\proto
|
||||
$(SolutionDir)rpc\tool\protoc --nanopb_out=. wcf.proto</Command>
|
||||
</PreBuildEvent>
|
||||
<PreBuildEvent>
|
||||
<Message>Generating PB files</Message>
|
||||
</PreBuildEvent>
|
||||
<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)..\clients\python\wcferry</Command>
|
||||
</PostBuildEvent>
|
||||
<PostBuildEvent>
|
||||
@ -303,9 +237,7 @@ xcopy /y $(OutDir)$(TargetFileName) $(SolutionDir)..\clients\python\wcferry</Com
|
||||
<ClInclude Include="exec_sql.h" />
|
||||
<ClInclude Include="framework.h" />
|
||||
<ClInclude Include="contact_mgmt.h" />
|
||||
<ClInclude Include="load_calls.h" />
|
||||
<ClInclude Include="receive_msg.h" />
|
||||
<ClInclude Include="receive_transfer.h" />
|
||||
<ClInclude Include="resource.h" />
|
||||
<ClInclude Include="rpc_server.h" />
|
||||
<ClInclude Include="send_msg.h" />
|
||||
@ -327,9 +259,7 @@ xcopy /y $(OutDir)$(TargetFileName) $(SolutionDir)..\clients\python\wcferry</Com
|
||||
<ClCompile Include="dllmain.cpp" />
|
||||
<ClCompile Include="exec_sql.cpp" />
|
||||
<ClCompile Include="contact_mgmt.cpp" />
|
||||
<ClCompile Include="load_calls.cpp" />
|
||||
<ClCompile Include="receive_msg.cpp" />
|
||||
<ClCompile Include="receive_transfer.cpp" />
|
||||
<ClCompile Include="rpc_server.cpp" />
|
||||
<ClCompile Include="send_msg.cpp" />
|
||||
<ClCompile Include="spy.cpp" />
|
||||
|
@ -30,9 +30,6 @@
|
||||
<ClInclude Include="contact_mgmt.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="load_calls.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="receive_msg.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
@ -78,9 +75,6 @@
|
||||
<ClInclude Include="funcs.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="receive_transfer.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="sqlite3.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
@ -107,9 +101,6 @@
|
||||
<ClCompile Include="contact_mgmt.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="load_calls.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="receive_msg.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
@ -143,9 +134,6 @@
|
||||
<ClCompile Include="funcs.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="receive_transfer.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\com\log.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
|
@ -3,122 +3,33 @@
|
||||
#include <vector>
|
||||
|
||||
#include "chatroom_mgmt.h"
|
||||
#include "load_calls.h"
|
||||
#include "log.h"
|
||||
#include "util.h"
|
||||
|
||||
using namespace std;
|
||||
extern QWORD g_WeChatWinDllAddr;
|
||||
|
||||
#define OS_GET_CHATROOM_MGR 0x1C4E200
|
||||
#define OS_ADD_MEMBERS 0x221B8A0
|
||||
#define OS_DELETE_MEMBERS 0x221BEE0
|
||||
#define OS_INVITE_MEMBERS 0x221B280
|
||||
|
||||
typedef QWORD (*GetChatRoomMgr_t)();
|
||||
typedef QWORD (*AddMemberToChatRoom_t)(QWORD, QWORD, QWORD, QWORD);
|
||||
typedef QWORD (*DelMemberFromChatRoom_t)(QWORD, QWORD, QWORD);
|
||||
typedef QWORD (*InviteMemberToChatRoom_t)(QWORD, QWORD, QWORD, QWORD);
|
||||
|
||||
extern WxCalls_t g_WxCalls;
|
||||
extern UINT64 g_WeChatWinDllAddr;
|
||||
#if 0
|
||||
int AddChatroomMember(string roomid, string wxids)
|
||||
{
|
||||
int status = -1;
|
||||
|
||||
if (roomid.empty() || wxids.empty()) {
|
||||
LOG_ERROR("Empty roomid or wxids.");
|
||||
return -1;
|
||||
return status;
|
||||
}
|
||||
|
||||
int rv = 0;
|
||||
DWORD armCall1 = g_WeChatWinDllAddr + g_WxCalls.arm.call1;
|
||||
DWORD armCall2 = g_WeChatWinDllAddr + g_WxCalls.arm.call2;
|
||||
DWORD armCall3 = g_WeChatWinDllAddr + g_WxCalls.arm.call3;
|
||||
|
||||
DWORD temp = 0;
|
||||
wstring wsRoomid = String2Wstring(roomid);
|
||||
WxString wxRoomid(wsRoomid);
|
||||
|
||||
vector<wstring> vMembers;
|
||||
vector<WxString> vWxMembers;
|
||||
wstringstream wss(String2Wstring(wxids));
|
||||
while (wss.good()) {
|
||||
wstring wstr;
|
||||
getline(wss, wstr, L',');
|
||||
vMembers.push_back(wstr);
|
||||
WxString txtMember(vMembers.back());
|
||||
vWxMembers.push_back(txtMember);
|
||||
}
|
||||
|
||||
LOG_DEBUG("Adding {} members[{}] to {}", vWxMembers.size(), wxids.c_str(), roomid.c_str());
|
||||
__asm {
|
||||
pushad;
|
||||
pushfd;
|
||||
call armCall1;
|
||||
sub esp, 0x8;
|
||||
mov temp, eax;
|
||||
mov ecx, esp;
|
||||
mov dword ptr[ecx], 0x0;
|
||||
mov dword ptr[ecx + 4], 0x0;
|
||||
test esi, esi;
|
||||
sub esp, 0x14;
|
||||
mov ecx, esp;
|
||||
lea eax, wxRoomid;
|
||||
push eax;
|
||||
call armCall2;
|
||||
mov ecx, temp;
|
||||
lea eax, vWxMembers;
|
||||
push eax;
|
||||
call armCall3;
|
||||
mov rv, eax;
|
||||
popfd;
|
||||
popad;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
int DelChatroomMember(string roomid, string wxids)
|
||||
{
|
||||
if (roomid.empty() || wxids.empty()) {
|
||||
LOG_ERROR("Empty roomid or wxids.");
|
||||
return -1;
|
||||
}
|
||||
|
||||
int rv = 0;
|
||||
DWORD drmCall1 = g_WeChatWinDllAddr + g_WxCalls.drm.call1;
|
||||
DWORD drmCall2 = g_WeChatWinDllAddr + g_WxCalls.drm.call2;
|
||||
DWORD drmCall3 = g_WeChatWinDllAddr + g_WxCalls.drm.call3;
|
||||
|
||||
DWORD temp = 0;
|
||||
wstring wsRoomid = String2Wstring(roomid);
|
||||
WxString wxRoomid(wsRoomid);
|
||||
|
||||
vector<wstring> vMembers;
|
||||
vector<WxString> vWxMembers;
|
||||
wstringstream wss(String2Wstring(wxids));
|
||||
while (wss.good()) {
|
||||
wstring wstr;
|
||||
getline(wss, wstr, L',');
|
||||
vMembers.push_back(wstr);
|
||||
WxString txtMember(vMembers.back());
|
||||
vWxMembers.push_back(txtMember);
|
||||
}
|
||||
|
||||
LOG_DEBUG("Deleting {} members[{}] from {}", vWxMembers.size(), wxids.c_str(), roomid.c_str());
|
||||
__asm {
|
||||
pushad;
|
||||
pushfd;
|
||||
call drmCall1;
|
||||
sub esp, 0x14;
|
||||
mov esi, eax;
|
||||
mov ecx, esp;
|
||||
lea edi, wxRoomid;
|
||||
push edi;
|
||||
call drmCall2;
|
||||
mov ecx, esi;
|
||||
lea eax, vWxMembers;
|
||||
push eax;
|
||||
call drmCall3;
|
||||
mov rv, eax;
|
||||
popfd;
|
||||
popad;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
int InviteChatroomMember(string roomid, string wxids)
|
||||
{
|
||||
wstring wsRoomid = String2Wstring((roomid));
|
||||
WxString wxRoomid(wsRoomid);
|
||||
GetChatRoomMgr_t GetChatRoomMgr = (GetChatRoomMgr_t)(g_WeChatWinDllAddr + OS_GET_CHATROOM_MGR);
|
||||
AddMemberToChatRoom_t AddMembers = (AddMemberToChatRoom_t)(g_WeChatWinDllAddr + OS_ADD_MEMBERS);
|
||||
|
||||
vector<wstring> vMembers;
|
||||
vector<WxString> vWxMembers;
|
||||
@ -131,51 +42,72 @@ int InviteChatroomMember(string roomid, string wxids)
|
||||
vWxMembers.push_back(wxMember);
|
||||
}
|
||||
|
||||
LOG_DEBUG("Inviting {} members[{}] to {}", vWxMembers.size(), wxids.c_str(), roomid.c_str());
|
||||
QWORD temp[2] = { 0 };
|
||||
WxString *pWxRoomid = NewWxStringFromStr(roomid);
|
||||
QWORD pMembers = (QWORD) & ((RawVector_t *)&vWxMembers)->start;
|
||||
|
||||
DWORD irmCall1 = g_WeChatWinDllAddr + g_WxCalls.irm.call1;
|
||||
DWORD irmCall2 = g_WeChatWinDllAddr + g_WxCalls.irm.call2;
|
||||
DWORD irmCall3 = g_WeChatWinDllAddr + g_WxCalls.irm.call3;
|
||||
DWORD irmCall4 = g_WeChatWinDllAddr + g_WxCalls.irm.call4;
|
||||
DWORD irmCall5 = g_WeChatWinDllAddr + g_WxCalls.irm.call5;
|
||||
DWORD irmCall6 = g_WeChatWinDllAddr + g_WxCalls.irm.call6;
|
||||
DWORD irmCall7 = g_WeChatWinDllAddr + g_WxCalls.irm.call7;
|
||||
DWORD irmCall8 = g_WeChatWinDllAddr + g_WxCalls.irm.call8;
|
||||
QWORD mgr = GetChatRoomMgr();
|
||||
status = (int)AddMembers(mgr, pMembers, (QWORD)pWxRoomid, (QWORD)temp);
|
||||
return status;
|
||||
}
|
||||
|
||||
DWORD sys_addr = (DWORD)GetModuleHandleA("win32u.dll") + 0x116C;
|
||||
DWORD addr[2] = { sys_addr, 0 };
|
||||
__asm {
|
||||
pushad;
|
||||
pushfd;
|
||||
call irmCall1;
|
||||
lea ecx, addr;
|
||||
push ecx;
|
||||
mov ecx, eax;
|
||||
call irmCall2;
|
||||
call irmCall3;
|
||||
sub esp, 0x8;
|
||||
lea eax, addr;
|
||||
mov ecx, esp;
|
||||
push eax;
|
||||
call irmCall4;
|
||||
sub esp, 0x14;
|
||||
mov ecx, esp;
|
||||
lea eax, wxRoomid;
|
||||
push eax;
|
||||
call irmCall5;
|
||||
lea eax, vWxMembers;
|
||||
push eax;
|
||||
call irmCall6;
|
||||
call irmCall1;
|
||||
push 0x0;
|
||||
push 0x1;
|
||||
mov ecx, eax;
|
||||
call irmCall7;
|
||||
lea ecx, addr;
|
||||
call irmCall8;
|
||||
popfd;
|
||||
popad;
|
||||
int DelChatroomMember(string roomid, string wxids)
|
||||
{
|
||||
int status = -1;
|
||||
|
||||
if (roomid.empty() || wxids.empty()) {
|
||||
LOG_ERROR("Empty roomid or wxids.");
|
||||
return status;
|
||||
}
|
||||
return 1;
|
||||
|
||||
GetChatRoomMgr_t GetChatRoomMgr = (GetChatRoomMgr_t)(g_WeChatWinDllAddr + OS_GET_CHATROOM_MGR);
|
||||
DelMemberFromChatRoom_t DelMembers = (DelMemberFromChatRoom_t)(g_WeChatWinDllAddr + OS_DELETE_MEMBERS);
|
||||
|
||||
vector<wstring> vMembers;
|
||||
vector<WxString> vWxMembers;
|
||||
wstringstream wss(String2Wstring(wxids));
|
||||
while (wss.good()) {
|
||||
wstring wstr;
|
||||
getline(wss, wstr, L',');
|
||||
vMembers.push_back(wstr);
|
||||
WxString wxMember(vMembers.back());
|
||||
vWxMembers.push_back(wxMember);
|
||||
}
|
||||
|
||||
WxString *pWxRoomid = NewWxStringFromStr(roomid);
|
||||
QWORD pMembers = (QWORD) & ((RawVector_t *)&vWxMembers)->start;
|
||||
|
||||
QWORD mgr = GetChatRoomMgr();
|
||||
status = (int)DelMembers(mgr, pMembers, (QWORD)pWxRoomid);
|
||||
return status;
|
||||
}
|
||||
|
||||
int InviteChatroomMember(string roomid, string wxids)
|
||||
{
|
||||
int status = -1;
|
||||
|
||||
if (roomid.empty() || wxids.empty()) {
|
||||
LOG_ERROR("Empty roomid or wxids.");
|
||||
return status;
|
||||
}
|
||||
|
||||
InviteMemberToChatRoom_t InviteMembers = (InviteMemberToChatRoom_t)(g_WeChatWinDllAddr + OS_INVITE_MEMBERS);
|
||||
|
||||
vector<wstring> vMembers;
|
||||
vector<WxString> vWxMembers;
|
||||
wstringstream wss(String2Wstring(wxids));
|
||||
while (wss.good()) {
|
||||
wstring wstr;
|
||||
getline(wss, wstr, L',');
|
||||
vMembers.push_back(wstr);
|
||||
WxString wxMember(vMembers.back());
|
||||
vWxMembers.push_back(wxMember);
|
||||
}
|
||||
QWORD temp[2] = { 0 };
|
||||
wstring wsRoomid = String2Wstring(roomid);
|
||||
WxString *pWxRoomid = NewWxStringFromWstr(wsRoomid);
|
||||
QWORD pMembers = (QWORD) & ((RawVector_t *)&vWxMembers)->start;
|
||||
|
||||
status = (int)InviteMembers((QWORD)wsRoomid.c_str(), pMembers, (QWORD)pWxRoomid, (QWORD)temp);
|
||||
return status;
|
||||
}
|
||||
#endif
|
||||
|
@ -1,25 +1,37 @@
|
||||
#pragma execution_character_set("utf-8")
|
||||
|
||||
#include "contact_mgmt.h"
|
||||
#include "load_calls.h"
|
||||
#include "log.h"
|
||||
#include "util.h"
|
||||
|
||||
using namespace std;
|
||||
extern WxCalls_t g_WxCalls;
|
||||
extern UINT64 g_WeChatWinDllAddr;
|
||||
#if 0
|
||||
extern QWORD g_WeChatWinDllAddr;
|
||||
|
||||
#define OS_GET_CONTACT_MGR 0x1C0BDE0
|
||||
#define OS_GET_CONTACT_LIST 0x2265540
|
||||
#define OS_CONTACT_BIN 0x200
|
||||
#define OS_CONTACT_BIN_LEN 0x208
|
||||
#define OS_CONTACT_WXID 0x10
|
||||
#define OS_CONTACT_CODE 0x30
|
||||
#define OS_CONTACT_REMARK 0x80
|
||||
#define OS_CONTACT_NAME 0xA0
|
||||
#define OS_CONTACT_GENDER 0x0E
|
||||
#define OS_CONTACT_STEP 0x6A8
|
||||
|
||||
typedef QWORD (*GetContactMgr_t)();
|
||||
typedef QWORD (*GetContactList_t)(QWORD, QWORD);
|
||||
|
||||
#define FEAT_LEN 5
|
||||
static const uint8_t FEAT_COUNTRY[FEAT_LEN] = { 0xA4, 0xD9, 0x02, 0x4A, 0x18 };
|
||||
static const uint8_t FEAT_PROVINCE[FEAT_LEN] = { 0xE2, 0xEA, 0xA8, 0xD1, 0x18 };
|
||||
static const uint8_t FEAT_CITY[FEAT_LEN] = { 0x1D, 0x02, 0x5B, 0xBF, 0x18 };
|
||||
|
||||
static DWORD FindMem(DWORD start, DWORD end, const void *target, size_t len)
|
||||
static QWORD FindMem(QWORD start, QWORD end, const void *target, size_t len)
|
||||
{
|
||||
uint8_t *p = (uint8_t *)start;
|
||||
while ((DWORD)p < end) {
|
||||
while ((QWORD)p < end) {
|
||||
if (memcmp((void *)p, target, len) == 0) {
|
||||
return (DWORD)p;
|
||||
return (QWORD)p;
|
||||
}
|
||||
p++;
|
||||
}
|
||||
@ -27,9 +39,9 @@ static DWORD FindMem(DWORD start, DWORD end, const void *target, size_t len)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static string GetCntString(DWORD start, DWORD end, const uint8_t *feat, size_t len)
|
||||
static string GetCntString(QWORD start, QWORD end, const uint8_t *feat, size_t len)
|
||||
{
|
||||
DWORD pfeat = FindMem(start, end, feat, len);
|
||||
QWORD pfeat = FindMem(start, end, feat, len);
|
||||
if (pfeat == 0) {
|
||||
return "";
|
||||
}
|
||||
@ -45,34 +57,27 @@ static string GetCntString(DWORD start, DWORD end, const uint8_t *feat, size_t l
|
||||
vector<RpcContact_t> GetContacts()
|
||||
{
|
||||
vector<RpcContact_t> contacts;
|
||||
DWORD call1 = g_WeChatWinDllAddr + g_WxCalls.contact.base;
|
||||
DWORD call2 = g_WeChatWinDllAddr + g_WxCalls.contact.head;
|
||||
GetContactMgr_t funcGetContactMgr = (GetContactMgr_t)(g_WeChatWinDllAddr + OS_GET_CONTACT_MGR);
|
||||
GetContactList_t funcGetContactList = (GetContactList_t)(g_WeChatWinDllAddr + OS_GET_CONTACT_LIST);
|
||||
|
||||
int success = 0;
|
||||
DWORD *addr[3] = { 0, 0, 0 };
|
||||
__asm {
|
||||
pushad
|
||||
call call1
|
||||
lea ecx,addr
|
||||
push ecx
|
||||
mov ecx,eax
|
||||
call call2
|
||||
mov success,eax
|
||||
popad
|
||||
QWORD mgr = funcGetContactMgr();
|
||||
QWORD addr[3] = { 0 };
|
||||
if (funcGetContactList(mgr, (QWORD)addr) != 1) {
|
||||
LOG_ERROR("GetContacts failed");
|
||||
return contacts;
|
||||
}
|
||||
|
||||
DWORD pstart = (DWORD)addr[0];
|
||||
DWORD pend = (DWORD)addr[2];
|
||||
|
||||
QWORD pstart = (QWORD)addr[0];
|
||||
QWORD pend = (QWORD)addr[2];
|
||||
while (pstart < pend) {
|
||||
RpcContact_t cnt;
|
||||
DWORD pbin = GET_DWORD(pstart + 0x150);
|
||||
DWORD lenbin = GET_DWORD(pstart + 0x154);
|
||||
QWORD pbin = GET_QWORD(pstart + OS_CONTACT_BIN);
|
||||
QWORD lenbin = GET_DWORD(pstart + OS_CONTACT_BIN_LEN);
|
||||
|
||||
cnt.wxid = GetStringByAddress(pstart + g_WxCalls.contact.wxId);
|
||||
cnt.code = GetStringByAddress(pstart + g_WxCalls.contact.wxCode);
|
||||
cnt.remark = GetStringByAddress(pstart + g_WxCalls.contact.wxRemark);
|
||||
cnt.name = GetStringByAddress(pstart + g_WxCalls.contact.wxName);
|
||||
cnt.wxid = GetStringByWstrAddr(pstart + OS_CONTACT_WXID);
|
||||
cnt.code = GetStringByWstrAddr(pstart + OS_CONTACT_CODE);
|
||||
cnt.remark = GetStringByWstrAddr(pstart + OS_CONTACT_REMARK);
|
||||
cnt.name = GetStringByWstrAddr(pstart + OS_CONTACT_NAME);
|
||||
|
||||
cnt.country = GetCntString(pbin, pbin + lenbin, FEAT_COUNTRY, FEAT_LEN);
|
||||
cnt.province = GetCntString(pbin, pbin + lenbin, FEAT_PROVINCE, FEAT_LEN);
|
||||
@ -81,16 +86,17 @@ vector<RpcContact_t> GetContacts()
|
||||
if (pbin == 0) {
|
||||
cnt.gender = 0;
|
||||
} else {
|
||||
cnt.gender = (DWORD) * (uint8_t *)(pbin + g_WxCalls.contact.wxGender);
|
||||
cnt.gender = (DWORD) * (uint8_t *)(pbin + OS_CONTACT_GENDER);
|
||||
}
|
||||
|
||||
contacts.push_back(cnt);
|
||||
pstart += 0x438;
|
||||
pstart += OS_CONTACT_STEP;
|
||||
}
|
||||
|
||||
return contacts;
|
||||
}
|
||||
|
||||
#if 0
|
||||
int AcceptNewFriend(string v3, string v4, int scene)
|
||||
{
|
||||
int success = 0;
|
||||
|
@ -1,49 +1,48 @@
|
||||
#include <iterator>
|
||||
|
||||
#include "exec_sql.h"
|
||||
#include "load_calls.h"
|
||||
#include "log.h"
|
||||
#include "sqlite3.h"
|
||||
#include "util.h"
|
||||
|
||||
#define OFFSET_DB_INSTANCE 0x2FFDDC8
|
||||
#define OFFSET_DB_MICROMSG 0x68
|
||||
#define OFFSET_DB_CHAT_MSG 0x1C0
|
||||
#define OFFSET_DB_MISC 0x3D8
|
||||
#define OFFSET_DB_EMOTION 0x558
|
||||
#define OFFSET_DB_MEDIA 0x9B8
|
||||
#define OFFSET_DB_BIZCHAT_MSG 0x1120
|
||||
#define OFFSET_DB_FUNCTION_MSG 0x11B0
|
||||
#define OFFSET_DB_NAME 0x14
|
||||
#define OFFSET_DB_MSG_MGR 0x30403B8
|
||||
#define OFFSET_DB_INSTANCE 0x5A40598
|
||||
#define OFFSET_DB_MICROMSG 0xb8
|
||||
#define OFFSET_DB_CHAT_MSG 0x2c8
|
||||
#define OFFSET_DB_MISC 0x5f0
|
||||
#define OFFSET_DB_EMOTION 0x15f0
|
||||
#define OFFSET_DB_MEDIA 0xF48
|
||||
#define OFFSET_DB_BIZCHAT_MSG 0x1A70
|
||||
#define OFFSET_DB_FUNCTION_MSG 0x1b98
|
||||
#define OFFSET_DB_NAME 0x28
|
||||
#define OFFSET_DB_MSG_MGR 0x5ABB5D8
|
||||
|
||||
extern UINT64 g_WeChatWinDllAddr;
|
||||
|
||||
typedef map<string, DWORD> dbMap_t;
|
||||
typedef map<string, QWORD> dbMap_t;
|
||||
static dbMap_t dbMap;
|
||||
#if 0
|
||||
static void GetDbHandle(DWORD base, DWORD offset)
|
||||
|
||||
static void GetDbHandle(QWORD base, QWORD offset)
|
||||
{
|
||||
wchar_t *wsp;
|
||||
wsp = (wchar_t *)(*(DWORD *)(base + offset + OFFSET_DB_NAME));
|
||||
wchar_t *wsp = (wchar_t *)(*(QWORD *)(base + offset + OFFSET_DB_NAME));
|
||||
string dbname = Wstring2String(wstring(wsp));
|
||||
dbMap[dbname] = GET_DWORD(base + offset);
|
||||
dbMap[dbname] = GET_QWORD(base + offset);
|
||||
}
|
||||
|
||||
static void GetMsgDbHandle(DWORD msgMgrAddr)
|
||||
static void GetMsgDbHandle(QWORD msgMgrAddr)
|
||||
{
|
||||
DWORD dbIndex = GET_DWORD(msgMgrAddr + 0x38);
|
||||
DWORD pStart = GET_DWORD(msgMgrAddr + 0x2C);
|
||||
QWORD dbIndex = GET_QWORD(msgMgrAddr + 0x68);
|
||||
QWORD pStart = GET_QWORD(msgMgrAddr + 0x50);
|
||||
for (uint32_t i = 0; i < dbIndex; i++) {
|
||||
DWORD dbAddr = GET_DWORD(pStart + i * 0x04);
|
||||
QWORD dbAddr = GET_QWORD(pStart + i * 0x08);
|
||||
if (dbAddr) {
|
||||
// MSGi.db
|
||||
string dbname = Wstring2String(GET_WSTRING(dbAddr));
|
||||
dbMap[dbname] = GET_DWORD(dbAddr + 0x60);
|
||||
dbMap[dbname] = GET_QWORD(dbAddr + 0x78);
|
||||
|
||||
// MediaMsgi.db
|
||||
DWORD mmdbAddr = GET_DWORD(dbAddr + 0x14);
|
||||
string mmdbname = Wstring2String(GET_WSTRING(mmdbAddr + 0x4C));
|
||||
dbMap[mmdbname] = GET_DWORD(mmdbAddr + 0x38);
|
||||
QWORD mmdbAddr = GET_QWORD(dbAddr + 0x20);
|
||||
string mmdbname = Wstring2String(GET_WSTRING(mmdbAddr + 0x78));
|
||||
dbMap[mmdbname] = GET_QWORD(mmdbAddr + 0x50);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -52,7 +51,7 @@ dbMap_t GetDbHandles()
|
||||
{
|
||||
dbMap.clear();
|
||||
|
||||
DWORD dbInstanceAddr = GET_DWORD(g_WeChatWinDllAddr + OFFSET_DB_INSTANCE);
|
||||
QWORD dbInstanceAddr = GET_QWORD(g_WeChatWinDllAddr + OFFSET_DB_INSTANCE);
|
||||
|
||||
GetDbHandle(dbInstanceAddr, OFFSET_DB_MICROMSG); // MicroMsg.db
|
||||
GetDbHandle(dbInstanceAddr, OFFSET_DB_CHAT_MSG); // ChatMsg.db
|
||||
@ -61,7 +60,7 @@ dbMap_t GetDbHandles()
|
||||
GetDbHandle(dbInstanceAddr, OFFSET_DB_MEDIA); // Media.db
|
||||
GetDbHandle(dbInstanceAddr, OFFSET_DB_FUNCTION_MSG); // Function.db
|
||||
|
||||
GetMsgDbHandle(GET_DWORD(g_WeChatWinDllAddr + OFFSET_DB_MSG_MGR)); // MSGi.db & MediaMsgi.db
|
||||
GetMsgDbHandle(GET_QWORD(g_WeChatWinDllAddr + OFFSET_DB_MSG_MGR)); // MSGi.db & MediaMsgi.db
|
||||
|
||||
return dbMap;
|
||||
}
|
||||
@ -133,7 +132,13 @@ DbRows_t ExecDbQuery(const string db, const string sql)
|
||||
dbMap = GetDbHandles();
|
||||
}
|
||||
|
||||
DWORD *stmt;
|
||||
QWORD *stmt;
|
||||
QWORD handle = dbMap[db];
|
||||
if (handle == 0) {
|
||||
LOG_WARN("Empty handle, retrying...");
|
||||
dbMap = GetDbHandles();
|
||||
}
|
||||
|
||||
int rc = func_prepare(dbMap[db], sql.c_str(), -1, &stmt, 0);
|
||||
if (rc != SQLITE_OK) {
|
||||
return rows;
|
||||
@ -162,16 +167,16 @@ DbRows_t ExecDbQuery(const string db, const string sql)
|
||||
|
||||
int GetLocalIdandDbidx(uint64_t id, uint64_t *localId, uint32_t *dbIdx)
|
||||
{
|
||||
DWORD msgMgrAddr = GET_DWORD(g_WeChatWinDllAddr + OFFSET_DB_MSG_MGR);
|
||||
DWORD dbIndex = GET_DWORD(msgMgrAddr + 0x38);
|
||||
DWORD pStart = GET_DWORD(msgMgrAddr + 0x2C);
|
||||
QWORD msgMgrAddr = GET_QWORD(g_WeChatWinDllAddr + OFFSET_DB_MSG_MGR);
|
||||
int dbIndex = (int)GET_QWORD(msgMgrAddr + 0x68); // 总不能 int 还不够吧?
|
||||
QWORD pStart = GET_QWORD(msgMgrAddr + 0x50);
|
||||
|
||||
*dbIdx = 0;
|
||||
for (int i = dbIndex - 1; i >= 0; i--) { // 从后往前遍历
|
||||
DWORD dbAddr = GET_DWORD(pStart + i * 0x04);
|
||||
QWORD dbAddr = GET_QWORD(pStart + i * 0x08);
|
||||
if (dbAddr) {
|
||||
string dbname = Wstring2String(GET_WSTRING(dbAddr));
|
||||
dbMap[dbname] = GET_DWORD(dbAddr + 0x60);
|
||||
dbMap[dbname] = GET_QWORD(dbAddr + 0x78);
|
||||
string sql = "SELECT localId FROM MSG WHERE MsgSvrID=" + to_string(id) + ";";
|
||||
DbRows_t rows = ExecDbQuery(dbname, sql);
|
||||
if (rows.empty()) {
|
||||
@ -187,7 +192,7 @@ int GetLocalIdandDbidx(uint64_t id, uint64_t *localId, uint32_t *dbIdx)
|
||||
}
|
||||
|
||||
*localId = strtoull((const char *)(field.content.data()), NULL, 10);
|
||||
*dbIdx = GET_DWORD(GET_DWORD(dbAddr + 0x18) + 0x144);
|
||||
*dbIdx = (uint32_t)(GET_QWORD(GET_QWORD(dbAddr + 0x28) + 0x1E8) >> 32);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -198,10 +203,10 @@ int GetLocalIdandDbidx(uint64_t id, uint64_t *localId, uint32_t *dbIdx)
|
||||
|
||||
vector<uint8_t> GetAudioData(uint64_t id)
|
||||
{
|
||||
DWORD msgMgrAddr = GET_DWORD(g_WeChatWinDllAddr + OFFSET_DB_MSG_MGR);
|
||||
DWORD dbIndex = GET_DWORD(msgMgrAddr + 0x38);
|
||||
QWORD msgMgrAddr = GET_QWORD(g_WeChatWinDllAddr + OFFSET_DB_MSG_MGR);
|
||||
int dbIndex = (int)GET_QWORD(msgMgrAddr + 0x68);
|
||||
|
||||
string sql = "SELECT Buf from Media WHERE Reserved0=" + to_string(id) + ";";
|
||||
string sql = "SELECT Buf FROM Media WHERE Reserved0=" + to_string(id) + ";";
|
||||
for (int i = dbIndex - 1; i >= 0; i--) {
|
||||
string dbname = "MediaMSG" + to_string(i) + ".db";
|
||||
DbRows_t rows = ExecDbQuery(dbname, sql);
|
||||
@ -225,4 +230,3 @@ vector<uint8_t> GetAudioData(uint64_t id)
|
||||
|
||||
return vector<uint8_t>();
|
||||
}
|
||||
#endif
|
||||
|
@ -11,6 +11,12 @@
|
||||
#include "spy_types.h"
|
||||
#include "util.h"
|
||||
|
||||
using namespace std;
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
extern bool gIsListeningPyq;
|
||||
extern QWORD g_WeChatWinDllAddr;
|
||||
|
||||
#define HEADER_PNG1 0x89
|
||||
#define HEADER_PNG2 0x50
|
||||
#define HEADER_JPG1 0xFF
|
||||
@ -18,16 +24,33 @@
|
||||
#define HEADER_GIF1 0x47
|
||||
#define HEADER_GIF2 0x49
|
||||
|
||||
using namespace std;
|
||||
namespace fs = std::filesystem;
|
||||
#define OS_LOGIN_STATUS 0x5AB86A8
|
||||
#define OS_GET_SNS_DATA_MGR 0x22A91C0
|
||||
#define OS_GET_SNS_FIRST_PAGE 0x2ED9080
|
||||
#define OS_GET_SNS_TIMELINE_MGR 0x2E6B110
|
||||
#define OS_GET_SNS_NEXT_PAGE 0x2EFEC00
|
||||
#define OS_NEW_CHAT_MSG 0x1C28800
|
||||
#define OS_FREE_CHAT_MSG 0x1C1FF10
|
||||
#define OS_GET_CHAT_MGR 0x1C51CF0
|
||||
#define OS_GET_MGR_BY_PREFIX_LOCAL_ID 0x2206280
|
||||
#define OS_GET_PRE_DOWNLOAD_MGR 0x1CD87E0
|
||||
#define OS_PUSH_ATTACH_TASK 0x1DA69C0
|
||||
|
||||
extern bool gIsListeningPyq;
|
||||
extern WxCalls_t g_WxCalls;
|
||||
extern UINT64 g_WeChatWinDllAddr;
|
||||
typedef QWORD (*GetSNSDataMgr_t)();
|
||||
typedef QWORD (*GetSnsTimeLineMgr_t)();
|
||||
typedef QWORD (*GetSNSFirstPage_t)(QWORD, QWORD, QWORD);
|
||||
typedef QWORD (*GetSNSNextPageScene_t)(QWORD, QWORD);
|
||||
typedef QWORD (*GetChatMgr_t)();
|
||||
typedef QWORD (*NewChatMsg_t)(QWORD);
|
||||
typedef QWORD (*FreeChatMsg_t)(QWORD);
|
||||
typedef QWORD (*GetPreDownLoadMgr_t)();
|
||||
typedef QWORD (*GetMgrByPrefixLocalId_t)(QWORD, QWORD);
|
||||
typedef QWORD (*PushAttachTask_t)(QWORD, QWORD, QWORD, QWORD);
|
||||
typedef QWORD (*GetOCRManager_t)();
|
||||
typedef QWORD (*DoOCRTask_t)(QWORD, QWORD, QWORD, QWORD, QWORD, QWORD);
|
||||
|
||||
int IsLogin(void) { return (int)GET_UINT64(g_WeChatWinDllAddr + g_WxCalls.login); }
|
||||
int IsLogin(void) { return (int)GET_QWORD(g_WeChatWinDllAddr + OS_LOGIN_STATUS); }
|
||||
|
||||
#if 0
|
||||
static string get_key(uint8_t header1, uint8_t header2, uint8_t *key)
|
||||
{
|
||||
// PNG?
|
||||
@ -54,6 +77,7 @@ static string get_key(uint8_t header1, uint8_t header2, uint8_t *key)
|
||||
string DecryptImage(string src, string dir)
|
||||
{
|
||||
if (!fs::exists(src)) {
|
||||
LOG_ERROR("File not exists: {}", src);
|
||||
return "";
|
||||
}
|
||||
|
||||
@ -116,53 +140,32 @@ string DecryptImage(string src, string dir)
|
||||
|
||||
static int GetFirstPage()
|
||||
{
|
||||
int rv = -1;
|
||||
DWORD pyqCall1 = g_WeChatWinDllAddr + g_WxCalls.pyq.call1;
|
||||
DWORD pyqCall2 = g_WeChatWinDllAddr + g_WxCalls.pyq.call2;
|
||||
int status = -1;
|
||||
|
||||
char buf[0xB44] = { 0 };
|
||||
__asm {
|
||||
pushad;
|
||||
call pyqCall1;
|
||||
push 0x1;
|
||||
lea ecx, buf;
|
||||
push ecx;
|
||||
mov ecx, eax;
|
||||
call pyqCall2;
|
||||
mov rv, eax;
|
||||
popad;
|
||||
GetSNSDataMgr_t GetSNSDataMgr = (GetSNSDataMgr_t)(g_WeChatWinDllAddr + OS_GET_SNS_DATA_MGR);
|
||||
GetSNSFirstPage_t GetSNSFirstPage = (GetSNSFirstPage_t)(g_WeChatWinDllAddr + OS_GET_SNS_FIRST_PAGE);
|
||||
|
||||
QWORD buff[16] = { 0 };
|
||||
QWORD mgr = GetSNSDataMgr();
|
||||
status = (int)GetSNSFirstPage(mgr, (QWORD)buff, 1);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
static int GetNextPage(uint64_t id)
|
||||
static int GetNextPage(QWORD id)
|
||||
{
|
||||
int rv = -1;
|
||||
DWORD pyqCall1 = g_WeChatWinDllAddr + g_WxCalls.pyq.call1;
|
||||
DWORD pyqCall3 = g_WeChatWinDllAddr + g_WxCalls.pyq.call3;
|
||||
int status = -1;
|
||||
|
||||
RawVector_t tmp = { 0 };
|
||||
GetSnsTimeLineMgr_t GetSnsTimeLineMgr = (GetSnsTimeLineMgr_t)(g_WeChatWinDllAddr + OS_GET_SNS_TIMELINE_MGR);
|
||||
GetSNSNextPageScene_t GetSNSNextPageScene = (GetSNSNextPageScene_t)(g_WeChatWinDllAddr + OS_GET_SNS_NEXT_PAGE);
|
||||
|
||||
__asm {
|
||||
pushad;
|
||||
call pyqCall1;
|
||||
lea ecx, tmp;
|
||||
push ecx;
|
||||
mov ebx, dword ptr [id + 0x04];
|
||||
push ebx;
|
||||
mov edi, dword ptr [id]
|
||||
push edi;
|
||||
mov ecx, eax;
|
||||
call pyqCall3;
|
||||
mov rv, eax;
|
||||
popad;
|
||||
QWORD mgr = GetSnsTimeLineMgr();
|
||||
status = (int)GetSNSNextPageScene(mgr, id);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
int RefreshPyq(uint64_t id)
|
||||
int RefreshPyq(QWORD id)
|
||||
{
|
||||
if (!gIsListeningPyq) {
|
||||
LOG_ERROR("没有启动朋友圈消息接收,参考:enable_receiving_msg");
|
||||
@ -176,13 +179,21 @@ int RefreshPyq(uint64_t id)
|
||||
return GetNextPage(id);
|
||||
}
|
||||
|
||||
int DownloadAttach(uint64_t id, string thumb, string extra)
|
||||
/*******************************************************************************
|
||||
* 都说我不写注释,写一下吧
|
||||
* 其实也没啥好写的,就是下载资源
|
||||
* 主要介绍一下几个参数:
|
||||
* id:好理解,消息 id
|
||||
* thumb:图片或者视频的缩略图路径;如果是视频,后缀为 mp4 后就是存在路径了
|
||||
* extra:图片、文件的路径
|
||||
*******************************************************************************/
|
||||
int DownloadAttach(QWORD id, string thumb, string extra)
|
||||
{
|
||||
int status = -1;
|
||||
uint64_t localId;
|
||||
QWORD localId;
|
||||
uint32_t dbIdx;
|
||||
|
||||
if (fs::exists(extra)) { // 第一道,不重复下载
|
||||
if (fs::exists(extra)) { // 第一道,不重复下载。TODO: 通过文件大小来判断
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -191,30 +202,29 @@ int DownloadAttach(uint64_t id, string thumb, string extra)
|
||||
return status;
|
||||
}
|
||||
|
||||
char buff[0x2D8] = { 0 };
|
||||
DWORD dlCall1 = g_WeChatWinDllAddr + g_WxCalls.da.call1;
|
||||
DWORD dlCall2 = g_WeChatWinDllAddr + g_WxCalls.da.call2;
|
||||
DWORD dlCall3 = g_WeChatWinDllAddr + g_WxCalls.da.call3;
|
||||
DWORD dlCall4 = g_WeChatWinDllAddr + g_WxCalls.da.call4;
|
||||
DWORD dlCall5 = g_WeChatWinDllAddr + g_WxCalls.da.call5;
|
||||
DWORD dlCall6 = g_WeChatWinDllAddr + g_WxCalls.da.call6;
|
||||
NewChatMsg_t NewChatMsg = (NewChatMsg_t)(g_WeChatWinDllAddr + OS_NEW_CHAT_MSG);
|
||||
FreeChatMsg_t FreeChatMsg = (FreeChatMsg_t)(g_WeChatWinDllAddr + OS_FREE_CHAT_MSG);
|
||||
GetChatMgr_t GetChatMgr = (GetChatMgr_t)(g_WeChatWinDllAddr + OS_GET_CHAT_MGR);
|
||||
GetPreDownLoadMgr_t GetPreDownLoadMgr = (GetPreDownLoadMgr_t)(g_WeChatWinDllAddr + OS_GET_PRE_DOWNLOAD_MGR);
|
||||
PushAttachTask_t PushAttachTask = (PushAttachTask_t)(g_WeChatWinDllAddr + OS_PUSH_ATTACH_TASK);
|
||||
GetMgrByPrefixLocalId_t GetMgrByPrefixLocalId
|
||||
= (GetMgrByPrefixLocalId_t)(g_WeChatWinDllAddr + OS_GET_MGR_BY_PREFIX_LOCAL_ID);
|
||||
|
||||
__asm {
|
||||
pushad;
|
||||
pushfd;
|
||||
lea ecx, buff;
|
||||
call dlCall1;
|
||||
call dlCall2;
|
||||
push dword ptr [dbIdx];
|
||||
lea ecx, buff;
|
||||
push dword ptr [localId];
|
||||
call dlCall3;
|
||||
add esp, 0x8;
|
||||
popfd;
|
||||
popad;
|
||||
LARGE_INTEGER l;
|
||||
l.HighPart = dbIdx;
|
||||
l.LowPart = (DWORD)localId;
|
||||
|
||||
char *buff = (char *)HeapAlloc(GetProcessHeap(), 0, 0x460);
|
||||
if (buff == nullptr) {
|
||||
LOG_ERROR("Failed to allocate memory.");
|
||||
return status;
|
||||
}
|
||||
|
||||
DWORD type = GET_DWORD(buff + 0x38);
|
||||
QWORD pChatMsg = NewChatMsg((QWORD)buff);
|
||||
GetChatMgr();
|
||||
GetMgrByPrefixLocalId(l.QuadPart, pChatMsg);
|
||||
|
||||
QWORD type = GET_QWORD(buff + 0x38);
|
||||
|
||||
string save_path = "";
|
||||
string thumb_path = "";
|
||||
@ -238,7 +248,7 @@ int DownloadAttach(uint64_t id, string thumb, string extra)
|
||||
break;
|
||||
}
|
||||
|
||||
if (fs::exists(save_path)) { // 不重复下载
|
||||
if (fs::exists(save_path)) { // 不重复下载。TODO: 通过文件大小来判断
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -246,84 +256,22 @@ int DownloadAttach(uint64_t id, string thumb, string extra)
|
||||
// 创建父目录,由于路径来源于微信,不做检查
|
||||
fs::create_directory(fs::path(save_path).parent_path().string());
|
||||
|
||||
wstring wsSavePath = String2Wstring(save_path);
|
||||
wstring wsThumbPath = String2Wstring(thumb_path);
|
||||
|
||||
WxString wxSavePath(wsSavePath);
|
||||
WxString wxThumbPath(wsThumbPath);
|
||||
|
||||
int temp = 1;
|
||||
memcpy(&buff[0x19C], &wxThumbPath, sizeof(wxThumbPath));
|
||||
memcpy(&buff[0x1B0], &wxSavePath, sizeof(wxSavePath));
|
||||
memcpy(&buff[0x29C], &temp, sizeof(temp));
|
||||
WxString *pSavePath = NewWxStringFromStr(save_path);
|
||||
WxString *pThumbPath = NewWxStringFromStr(thumb_path);
|
||||
|
||||
__asm {
|
||||
pushad;
|
||||
pushfd;
|
||||
call dlCall4;
|
||||
push 0x1;
|
||||
push 0x0;
|
||||
lea ecx, buff;
|
||||
push ecx;
|
||||
mov ecx, eax;
|
||||
call dlCall5;
|
||||
mov status, eax;
|
||||
lea ecx, buff;
|
||||
push 0x0;
|
||||
call dlCall6;
|
||||
popfd;
|
||||
popad;
|
||||
}
|
||||
memcpy(&buff[0x280], pThumbPath, sizeof(WxString));
|
||||
memcpy(&buff[0x2A0], pSavePath, sizeof(WxString));
|
||||
memcpy(&buff[0x40C], &temp, sizeof(temp));
|
||||
|
||||
QWORD mgr = GetPreDownLoadMgr();
|
||||
status = (int)PushAttachTask(mgr, pChatMsg, 0, 1);
|
||||
FreeChatMsg(pChatMsg);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
int RevokeMsg(uint64_t id)
|
||||
{
|
||||
int status = -1;
|
||||
uint64_t localId;
|
||||
uint32_t dbIdx;
|
||||
if (GetLocalIdandDbidx(id, &localId, &dbIdx) != 0) {
|
||||
LOG_ERROR("Failed to get localId, Please check id: {}", to_string(id));
|
||||
return status;
|
||||
}
|
||||
|
||||
char chat_msg[0x2D8] = { 0 };
|
||||
|
||||
DWORD rmCall1 = g_WeChatWinDllAddr + g_WxCalls.rm.call1;
|
||||
DWORD rmCall2 = g_WeChatWinDllAddr + g_WxCalls.rm.call2;
|
||||
DWORD rmCall3 = g_WeChatWinDllAddr + g_WxCalls.rm.call3;
|
||||
DWORD rmCall4 = g_WeChatWinDllAddr + g_WxCalls.rm.call4;
|
||||
DWORD rmCall5 = g_WeChatWinDllAddr + g_WxCalls.rm.call5;
|
||||
|
||||
__asm {
|
||||
pushad;
|
||||
pushfd;
|
||||
lea ecx, chat_msg;
|
||||
call rmCall1;
|
||||
call rmCall2;
|
||||
push dword ptr [dbIdx];
|
||||
lea ecx, chat_msg;
|
||||
push dword ptr [localId];
|
||||
call rmCall3;
|
||||
add esp, 0x8;
|
||||
call rmCall2;
|
||||
lea ecx, chat_msg;
|
||||
push ecx;
|
||||
mov ecx, eax;
|
||||
call rmCall4;
|
||||
mov status, eax;
|
||||
lea ecx, chat_msg;
|
||||
push 0x0;
|
||||
call rmCall5;
|
||||
popfd;
|
||||
popad;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
string GetAudio(uint64_t id, string dir)
|
||||
string GetAudio(QWORD id, string dir)
|
||||
{
|
||||
string mp3path = (dir.back() == '\\' || dir.back() == '/') ? dir : (dir + "/");
|
||||
mp3path += to_string(id) + ".mp3";
|
||||
@ -346,104 +294,66 @@ string GetAudio(uint64_t id, string dir)
|
||||
OcrResult_t GetOcrResult(string path)
|
||||
{
|
||||
OcrResult_t ret = { -1, "" };
|
||||
|
||||
#if 0 // 参数没调好,会抛异常,看看有没有好心人来修复
|
||||
if (!fs::exists(path)) {
|
||||
LOG_ERROR("Can not find: {}", path);
|
||||
return ret;
|
||||
}
|
||||
|
||||
GetOCRManager_t GetOCRManager = (GetOCRManager_t)(g_WeChatWinDllAddr + 0x1D6C3C0);
|
||||
DoOCRTask_t DoOCRTask = (DoOCRTask_t)(g_WeChatWinDllAddr + 0x2D10BC0);
|
||||
|
||||
QWORD unk1 = 0, unk2 = 0, unused = 0;
|
||||
QWORD *pUnk1 = &unk1;
|
||||
QWORD *pUnk2 = &unk2;
|
||||
// 路径分隔符有要求,必须为 `\`
|
||||
wstring wsPath = String2Wstring(fs::path(path).make_preferred().string());
|
||||
|
||||
WxString wxPath(wsPath);
|
||||
WxString nullObj;
|
||||
WxString ocrBuffer;
|
||||
vector<QWORD> *pv = (vector<QWORD> *)HeapAlloc(GetProcessHeap(), 0, 0x20);
|
||||
RawVector_t *pRv = (RawVector_t *)pv;
|
||||
pRv->finish = pRv->start;
|
||||
char buff[0x98] = { 0 };
|
||||
memcpy(buff, &pRv->start, sizeof(QWORD));
|
||||
|
||||
DWORD ocrCall1 = g_WeChatWinDllAddr + g_WxCalls.ocr.call1;
|
||||
DWORD ocrCall2 = g_WeChatWinDllAddr + g_WxCalls.ocr.call2;
|
||||
DWORD ocrCall3 = g_WeChatWinDllAddr + g_WxCalls.ocr.call3;
|
||||
QWORD mgr = GetOCRManager();
|
||||
ret.status = (int)DoOCRTask(mgr, (QWORD)&wxPath, unused, (QWORD)buff, (QWORD)&pUnk1, (QWORD)&pUnk2);
|
||||
|
||||
DWORD tmp = 0;
|
||||
int status = -1;
|
||||
__asm {
|
||||
pushad;
|
||||
pushfd;
|
||||
lea ecx, ocrBuffer;
|
||||
call ocrCall1;
|
||||
call ocrCall2;
|
||||
lea ecx, nullObj;
|
||||
push ecx;
|
||||
lea ecx, tmp;
|
||||
push ecx;
|
||||
lea ecx, ocrBuffer;
|
||||
push ecx;
|
||||
push 0x0;
|
||||
lea ecx, wxPath;
|
||||
push ecx;
|
||||
mov ecx, eax;
|
||||
call ocrCall3;
|
||||
mov status, eax;
|
||||
popfd;
|
||||
popad;
|
||||
}
|
||||
|
||||
if (status != 0)
|
||||
{
|
||||
LOG_ERROR("OCR status: {}", to_string(status));
|
||||
return ret; // 识别出错
|
||||
}
|
||||
|
||||
ret.status = status;
|
||||
|
||||
DWORD addr = (DWORD)&ocrBuffer;
|
||||
DWORD header = GET_DWORD(addr);
|
||||
DWORD num = GET_DWORD(addr + 0x4);
|
||||
if (num <= 0) {
|
||||
return ret; // 识别内容为空
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < num; i++) {
|
||||
DWORD content = GET_DWORD(header);
|
||||
ret.result += Wstring2String(GET_WSTRING(content + 0x14));
|
||||
QWORD count = GET_QWORD(buff + 0x8);
|
||||
if (count > 0) {
|
||||
QWORD header = GET_QWORD(buff);
|
||||
for (QWORD i = 0; i < count; i++) {
|
||||
QWORD content = GET_QWORD(header);
|
||||
ret.result += Wstring2String(GET_WSTRING(content + 0x28));
|
||||
ret.result += "\n";
|
||||
header = content;
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
|
||||
int RevokeMsg(QWORD id)
|
||||
{
|
||||
int status = -1;
|
||||
#if 0 // 这个挺鸡肋的,因为自己发的消息没法直接获得 msgid,就这样吧
|
||||
QWORD localId;
|
||||
uint32_t dbIdx;
|
||||
if (GetLocalIdandDbidx(id, &localId, &dbIdx) != 0) {
|
||||
LOG_ERROR("Failed to get localId, Please check id: {}", to_string(id));
|
||||
return status;
|
||||
}
|
||||
#endif
|
||||
return status;
|
||||
}
|
||||
|
||||
string GetLoginUrl()
|
||||
{
|
||||
if (GET_DWORD(g_WeChatWinDllAddr + g_WxCalls.login) == 1) {
|
||||
LOG_DEBUG("Already logined.");
|
||||
return ""; // 已登录直接返回空字符
|
||||
}
|
||||
|
||||
DWORD refreshLoginQrcodeCall1 = g_WeChatWinDllAddr + g_WxCalls.rlq.call1;
|
||||
DWORD refreshLoginQrcodeCall2 = g_WeChatWinDllAddr + g_WxCalls.rlq.call2;
|
||||
|
||||
// 刷新二维码
|
||||
__asm {
|
||||
pushad;
|
||||
pushfd;
|
||||
call refreshLoginQrcodeCall1;
|
||||
mov ecx, eax;
|
||||
call refreshLoginQrcodeCall2;
|
||||
popfd;
|
||||
popad;
|
||||
}
|
||||
|
||||
// 获取二维码链接
|
||||
char *url = GET_STRING(g_WeChatWinDllAddr + g_WxCalls.rlq.url);
|
||||
uint8_t cnt = 0;
|
||||
while (url[0] == 0) { // 刷新需要时间,太快了会获取不到
|
||||
if (cnt > 5) {
|
||||
LOG_ERROR("Refresh QR Code timeout.");
|
||||
return "";
|
||||
}
|
||||
Sleep(1000);
|
||||
cnt++;
|
||||
}
|
||||
char url[] = "方法还没实现";
|
||||
return "http://weixin.qq.com/x/" + string(url);
|
||||
}
|
||||
#endif
|
||||
|
||||
int ReceiveTransfer(string wxid, string transferid, string transactionid)
|
||||
{
|
||||
// 别想了,这个不实现了
|
||||
return -1;
|
||||
}
|
||||
|
@ -11,3 +11,4 @@ int DownloadAttach(uint64_t id, std::string thumb, std::string extra);
|
||||
int RevokeMsg(uint64_t id);
|
||||
OcrResult_t GetOcrResult(std::string path);
|
||||
string GetLoginUrl();
|
||||
int ReceiveTransfer(std::string wxid, std::string transferid, std::string transactionid);
|
||||
|
@ -1,59 +0,0 @@
|
||||
#include <iostream>
|
||||
#include <map>
|
||||
|
||||
#include "load_calls.h"
|
||||
|
||||
#define SUPPORT_VERSION L"3.9.10.19"
|
||||
|
||||
WxCalls_t wxCalls = {
|
||||
0x5AB9184, // Login Status
|
||||
{ 0x5AB8FC8, 0x5AB90A8, 0x5AB8FE8, 0x5A7F170 }, // User Info: wxid, nickname, mobile, home
|
||||
{ 0x768140, 0xCE6C80, 0x756960 }, // Send Message
|
||||
/* Receive Message:
|
||||
Hook, call, msgId, type, isSelf, ts, roomId, content, wxid, sign, thumb, extra, msgXml */
|
||||
{ 0x00, 0x2206570, 0x30, 0x38, 0x3C, 0x44, 0x48, 0x88, 0x240, 0x260, 0x280, 0x2A0, 0x308 },
|
||||
{ 0x768140, 0XF59E40, 0XCE6640, 0x756960 }, // Send Image Message
|
||||
{ 0x76AE20, 0xF59E40, 0xB6D1F0, 0x756960 }, // Send File Message
|
||||
{ 0xB8A70, 0x3ED5E0, 0x107F00, 0x3ED7B0, 0x2386FE4 }, // Send xml Message
|
||||
{ 0x771980, 0x4777E0, 0x239E888 }, // Send Emotion Message
|
||||
/* Get Contacts:
|
||||
call1, call2, wxId, Code, Remark,Name, Gender, Country, Province, City*/
|
||||
{ 0x75A4A0, 0xC089F0, 0x10, 0x24, 0x58, 0x6C, 0x0E, 0x00, 0x00, 0x00 },
|
||||
/* Exec Sql:
|
||||
Exec, base, start, end, slot, name*/
|
||||
{ 0x141BDF0, 0x2366934, 0x1428, 0x142C, 0x3C, 0x50 },
|
||||
{ 0xA17D50, 0xF59E40, 0xA18BD0, 0xA17E70 }, // Accept New Friend application
|
||||
{ 0x78CF20, 0xF59E40, 0xBD1DC0 }, // Add chatroom members
|
||||
{ 0x78CF20, 0xF59E40, 0xBD22A0 }, // Delete chatroom members
|
||||
{ 0x7B2E60, 0x15E2C20, 0x79C250 }, // Receive transfer
|
||||
/* Receive PYQ
|
||||
hook, call, call1, call2, call3, start, end, ts, wxid, content, xml, step*/
|
||||
{ 0x14F9E15, 0x14FA0A0, 0xC39680, 0x14E2140, 0x14E21E0, 0x20, 0x24, 0x2C, 0x18, 0x3C, 0x384, 0xB48 },
|
||||
/* call1, call2, call3, call4, call5, call6*/
|
||||
{ 0x76F010, 0x792700, 0xBC0370, 0x80F110, 0x82BB40, 0x756E30},
|
||||
/* call1, call2, call3, call4, call5*/
|
||||
{0x76F010, 0x792700, 0xBC0370, 0xBB5F70, 0x756E30},
|
||||
/* call1, call2, call3, call4, call5*/
|
||||
{0x76E630, 0x76AE20, 0xF59E40, 0xB73000, 0x76E350},
|
||||
/* call1, call2, call3 */
|
||||
{0x931730, 0x1D58751, 0x1421940},
|
||||
/* call1, call2, call3, call4, call5, call6, call7, call8*/
|
||||
{0x78CB40, 0x7F99D0, 0x78CF20, 0x78CEF0, 0xF59E40, 0xBD1A00, 0x7FA980, 0x755060},
|
||||
/* call1, call2, call3 */
|
||||
{0x80A800, 0x80F270, 0x13DA3E0},
|
||||
/* call1, call2 */
|
||||
{0xF59E40, 0xCE6730},
|
||||
/* call1, call2, url */
|
||||
{0xAE9DB0, 0xCDA6F0, 0x3040DE8}
|
||||
};
|
||||
|
||||
int LoadCalls(const wchar_t *version, WxCalls_t *calls)
|
||||
{
|
||||
if (wcscmp(version, SUPPORT_VERSION) != 0) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
memcpy_s(calls, sizeof(WxCalls_t), &wxCalls, sizeof(WxCalls_t));
|
||||
|
||||
return 0;
|
||||
}
|
@ -1,5 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "spy_types.h"
|
||||
|
||||
int LoadCalls(const wchar_t *version, WxCalls_t *calls);
|
@ -6,25 +6,52 @@
|
||||
#include <mutex>
|
||||
#include <queue>
|
||||
|
||||
#include "load_calls.h"
|
||||
#include "log.h"
|
||||
#include "receive_msg.h"
|
||||
#include "user_info.h"
|
||||
#include "util.h"
|
||||
|
||||
// Defined in rpc_server.cpp
|
||||
extern bool gIsListening, gIsListeningPyq;
|
||||
extern bool gIsLogging, gIsListening, gIsListeningPyq;
|
||||
extern mutex gMutex;
|
||||
extern condition_variable gCV;
|
||||
extern queue<WxMsg_t> gMsgQueue;
|
||||
|
||||
// Defined in spy.cpp
|
||||
extern WxCalls_t g_WxCalls;
|
||||
extern UINT64 g_WeChatWinDllAddr;
|
||||
extern QWORD g_WeChatWinDllAddr;
|
||||
|
||||
typedef UINT64 (*funcRecvMsg_t)(UINT64, UINT64);
|
||||
static funcRecvMsg_t funcRecvMsg = nullptr;
|
||||
static funcRecvMsg_t realRecvMsg = nullptr;
|
||||
#define OS_RECV_MSG_ID 0x30
|
||||
#define OS_RECV_MSG_TYPE 0x38
|
||||
#define OS_RECV_MSG_SELF 0x3C
|
||||
#define OS_RECV_MSG_TS 0x44
|
||||
#define OS_RECV_MSG_ROOMID 0x48
|
||||
#define OS_RECV_MSG_CONTENT 0x88
|
||||
#define OS_RECV_MSG_WXID 0x240
|
||||
#define OS_RECV_MSG_SIGN 0x260
|
||||
#define OS_RECV_MSG_THUMB 0x280
|
||||
#define OS_RECV_MSG_EXTRA 0x2A0
|
||||
#define OS_RECV_MSG_XML 0x308
|
||||
#define OS_RECV_MSG_CALL 0x2205510
|
||||
#define OS_PYQ_MSG_START 0x30
|
||||
#define OS_PYQ_MSG_END 0x38
|
||||
#define OS_PYQ_MSG_TS 0x38
|
||||
#define OS_PYQ_MSG_XML 0x9B8
|
||||
#define OS_PYQ_MSG_SENDER 0x18
|
||||
#define OS_PYQ_MSG_CONTENT 0x48
|
||||
#define OS_PYQ_MSG_CALL 0x2EFAA10
|
||||
#define OS_WXLOG 0x26DA2D0
|
||||
|
||||
typedef QWORD (*RecvMsg_t)(QWORD, QWORD);
|
||||
typedef QWORD (*WxLog_t)(QWORD, QWORD, QWORD, QWORD, QWORD, QWORD, QWORD, QWORD, QWORD, QWORD, QWORD, QWORD);
|
||||
typedef QWORD (*RecvPyq_t)(QWORD, QWORD, QWORD);
|
||||
|
||||
static RecvMsg_t funcRecvMsg = nullptr;
|
||||
static RecvMsg_t realRecvMsg = nullptr;
|
||||
static WxLog_t funcWxLog = nullptr;
|
||||
static WxLog_t realWxLog = nullptr;
|
||||
static RecvPyq_t funcRecvPyq = nullptr;
|
||||
static RecvPyq_t realRecvPyq = nullptr;
|
||||
static bool isMH_Initialized = false;
|
||||
|
||||
MsgTypes_t GetMsgTypes()
|
||||
{
|
||||
@ -67,26 +94,26 @@ MsgTypes_t GetMsgTypes()
|
||||
return m;
|
||||
}
|
||||
|
||||
static UINT64 DispatchMsg(UINT64 arg1, UINT64 arg2)
|
||||
static QWORD DispatchMsg(QWORD arg1, QWORD arg2)
|
||||
{
|
||||
WxMsg_t wxMsg = { 0 };
|
||||
try {
|
||||
wxMsg.id = GET_QWORD(arg2 + g_WxCalls.recvMsg.msgId);
|
||||
wxMsg.type = GET_DWORD(arg2 + g_WxCalls.recvMsg.type);
|
||||
wxMsg.is_self = GET_DWORD(arg2 + g_WxCalls.recvMsg.isSelf);
|
||||
wxMsg.ts = GET_DWORD(arg2 + g_WxCalls.recvMsg.ts);
|
||||
wxMsg.content = GetStringByWstrAddr(arg2 + g_WxCalls.recvMsg.content);
|
||||
wxMsg.sign = GetStringByWstrAddr(arg2 + g_WxCalls.recvMsg.sign);
|
||||
wxMsg.xml = GetStringByWstrAddr(arg2 + g_WxCalls.recvMsg.msgXml);
|
||||
wxMsg.id = GET_QWORD(arg2 + OS_RECV_MSG_ID);
|
||||
wxMsg.type = GET_DWORD(arg2 + OS_RECV_MSG_TYPE);
|
||||
wxMsg.is_self = GET_DWORD(arg2 + OS_RECV_MSG_SELF);
|
||||
wxMsg.ts = GET_DWORD(arg2 + OS_RECV_MSG_TS);
|
||||
wxMsg.content = GetStringByWstrAddr(arg2 + OS_RECV_MSG_CONTENT);
|
||||
wxMsg.sign = GetStringByWstrAddr(arg2 + OS_RECV_MSG_SIGN);
|
||||
wxMsg.xml = GetStringByWstrAddr(arg2 + OS_RECV_MSG_XML);
|
||||
|
||||
string roomid = GetStringByWstrAddr(arg2 + g_WxCalls.recvMsg.roomId);
|
||||
string roomid = GetStringByWstrAddr(arg2 + OS_RECV_MSG_ROOMID);
|
||||
wxMsg.roomid = roomid;
|
||||
if (roomid.find("@chatroom") != string::npos) { // 群 ID 的格式为 xxxxxxxxxxx@chatroom
|
||||
wxMsg.is_group = true;
|
||||
wxMsg.roomid = roomid;
|
||||
if (wxMsg.is_self) {
|
||||
wxMsg.sender = GetSelfWxid();
|
||||
} else {
|
||||
wxMsg.sender = GetStringByWstrAddr(arg2 + g_WxCalls.recvMsg.wxid);
|
||||
wxMsg.sender = GetStringByWstrAddr(arg2 + OS_RECV_MSG_WXID);
|
||||
}
|
||||
} else {
|
||||
wxMsg.is_group = false;
|
||||
@ -97,13 +124,13 @@ static UINT64 DispatchMsg(UINT64 arg1, UINT64 arg2)
|
||||
}
|
||||
}
|
||||
|
||||
wxMsg.thumb = GetStringByWstrAddr(arg2 + g_WxCalls.recvMsg.thumb);
|
||||
wxMsg.thumb = GetStringByWstrAddr(arg2 + OS_RECV_MSG_THUMB);
|
||||
if (!wxMsg.thumb.empty()) {
|
||||
wxMsg.thumb = GetHomePath() + wxMsg.thumb;
|
||||
replace(wxMsg.thumb.begin(), wxMsg.thumb.end(), '\\', '/');
|
||||
}
|
||||
|
||||
wxMsg.extra = GetStringByWstrAddr(arg2 + g_WxCalls.recvMsg.extra);
|
||||
wxMsg.extra = GetStringByWstrAddr(arg2 + OS_RECV_MSG_EXTRA);
|
||||
if (!wxMsg.extra.empty()) {
|
||||
wxMsg.extra = GetHomePath() + wxMsg.extra;
|
||||
replace(wxMsg.extra.begin(), wxMsg.extra.end(), '\\', '/');
|
||||
@ -123,20 +150,123 @@ static UINT64 DispatchMsg(UINT64 arg1, UINT64 arg2)
|
||||
return realRecvMsg(arg1, arg2);
|
||||
}
|
||||
|
||||
void ListenMessage()
|
||||
static QWORD PrintWxLog(QWORD a1, QWORD a2, QWORD a3, QWORD a4, QWORD a5, QWORD a6, QWORD a7, QWORD a8, QWORD a9,
|
||||
QWORD a10, QWORD a11, QWORD a12)
|
||||
{
|
||||
MH_STATUS status = MH_UNKNOWN;
|
||||
if (gIsListening || (g_WeChatWinDllAddr == 0)) {
|
||||
LOG_WARN("gIsListening || (g_WeChatWinDllAddr == 0)");
|
||||
QWORD p = realWxLog(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11, a12);
|
||||
if (p == 0 || p == 1) {
|
||||
return p;
|
||||
}
|
||||
|
||||
LOG_INFO("【WX】\n{}", GB2312ToUtf8((char *)p));
|
||||
|
||||
return p;
|
||||
}
|
||||
|
||||
static void DispatchPyq(QWORD arg1, QWORD arg2, QWORD arg3)
|
||||
{
|
||||
QWORD startAddr = *(QWORD *)(arg2 + OS_PYQ_MSG_START);
|
||||
QWORD endAddr = *(QWORD *)(arg2 + OS_PYQ_MSG_END);
|
||||
|
||||
if (startAddr == 0) {
|
||||
return;
|
||||
}
|
||||
funcRecvMsg = (funcRecvMsg_t)(g_WeChatWinDllAddr + g_WxCalls.recvMsg.call);
|
||||
|
||||
while (startAddr < endAddr) {
|
||||
WxMsg_t wxMsg;
|
||||
|
||||
wxMsg.type = 0x00; // 朋友圈消息
|
||||
wxMsg.is_self = false;
|
||||
wxMsg.is_group = false;
|
||||
wxMsg.id = GET_QWORD(startAddr);
|
||||
wxMsg.ts = GET_DWORD(startAddr + OS_PYQ_MSG_TS);
|
||||
wxMsg.xml = GetStringByWstrAddr(startAddr + OS_PYQ_MSG_XML);
|
||||
wxMsg.sender = GetStringByWstrAddr(startAddr + OS_PYQ_MSG_SENDER);
|
||||
wxMsg.content = GetStringByWstrAddr(startAddr + OS_PYQ_MSG_CONTENT);
|
||||
|
||||
{
|
||||
unique_lock<mutex> lock(gMutex);
|
||||
gMsgQueue.push(wxMsg); // 推送到队列
|
||||
}
|
||||
|
||||
gCV.notify_all(); // 通知各方消息就绪
|
||||
|
||||
startAddr += 0x1618;
|
||||
}
|
||||
}
|
||||
|
||||
void EnableLog()
|
||||
{
|
||||
MH_STATUS status = MH_UNKNOWN;
|
||||
if (gIsLogging) {
|
||||
LOG_WARN("gIsLogging");
|
||||
return;
|
||||
}
|
||||
WxLog_t funcWxLog = (WxLog_t)(g_WeChatWinDllAddr + OS_WXLOG);
|
||||
|
||||
if (!isMH_Initialized) {
|
||||
status = MH_Initialize();
|
||||
if (status != MH_OK) {
|
||||
LOG_ERROR("MH_Initialize failed: {}", to_string(status));
|
||||
return;
|
||||
}
|
||||
isMH_Initialized = true;
|
||||
}
|
||||
|
||||
status = MH_CreateHook(funcWxLog, &PrintWxLog, reinterpret_cast<LPVOID *>(&realWxLog));
|
||||
if (status != MH_OK) {
|
||||
LOG_ERROR("MH_CreateHook failed: {}", to_string(status));
|
||||
return;
|
||||
}
|
||||
|
||||
status = MH_EnableHook(funcWxLog);
|
||||
if (status != MH_OK) {
|
||||
LOG_ERROR("MH_EnableHook failed: {}", to_string(status));
|
||||
return;
|
||||
}
|
||||
gIsLogging = true;
|
||||
}
|
||||
|
||||
void DisableLog()
|
||||
{
|
||||
MH_STATUS status = MH_UNKNOWN;
|
||||
if (!gIsLogging) {
|
||||
return;
|
||||
}
|
||||
|
||||
status = MH_DisableHook(funcWxLog);
|
||||
if (status != MH_OK) {
|
||||
LOG_ERROR("MH_DisableHook failed: {}", to_string(status));
|
||||
return;
|
||||
}
|
||||
|
||||
gIsLogging = false;
|
||||
if (isMH_Initialized && !gIsLogging && !gIsListening && !gIsListeningPyq) {
|
||||
status = MH_Uninitialize();
|
||||
if (status != MH_OK) {
|
||||
LOG_ERROR("MH_Uninitialize failed: {}", to_string(status));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ListenMessage()
|
||||
{
|
||||
MH_STATUS status = MH_UNKNOWN;
|
||||
if (gIsListening) {
|
||||
LOG_WARN("gIsListening");
|
||||
return;
|
||||
}
|
||||
funcRecvMsg = (RecvMsg_t)(g_WeChatWinDllAddr + OS_RECV_MSG_CALL);
|
||||
|
||||
if (!isMH_Initialized) {
|
||||
status = MH_Initialize();
|
||||
if (status != MH_OK) {
|
||||
LOG_ERROR("MH_Initialize failed: {}", to_string(status));
|
||||
return;
|
||||
}
|
||||
isMH_Initialized = true;
|
||||
}
|
||||
|
||||
status = MH_CreateHook(funcRecvMsg, &DispatchMsg, reinterpret_cast<LPVOID *>(&realRecvMsg));
|
||||
if (status != MH_OK) {
|
||||
@ -173,208 +303,73 @@ void UnListenMessage()
|
||||
}
|
||||
|
||||
gIsListening = false;
|
||||
}
|
||||
|
||||
void ListenPyq() { }
|
||||
|
||||
void UnListenPyq() { }
|
||||
|
||||
#if 0
|
||||
// static DWORD reg_buffer = 0;
|
||||
// static DWORD recvMsgHookAddr = 0;
|
||||
// static DWORD recvMsgCallAddr = 0;
|
||||
// static DWORD recvMsgJumpBackAddr = 0;
|
||||
// static CHAR recvMsgBackupCode[5] = { 0 };
|
||||
|
||||
// static DWORD recvPyqHookAddr = 0;
|
||||
// static DWORD recvPyqCallAddr = 0;
|
||||
// static DWORD recvPyqJumpBackAddr = 0;
|
||||
// static CHAR recvPyqBackupCode[5] = { 0 };
|
||||
|
||||
void HookAddress(DWORD hookAddr, LPVOID funcAddr, CHAR recvMsgBackupCode[5])
|
||||
{
|
||||
// 组装跳转数据
|
||||
BYTE jmpCode[5] = { 0 };
|
||||
jmpCode[0] = 0xE9;
|
||||
|
||||
// 计算偏移
|
||||
*(DWORD *)&jmpCode[1] = (DWORD)funcAddr - hookAddr - 5;
|
||||
|
||||
// 备份原来的代码
|
||||
ReadProcessMemory(GetCurrentProcess(), (LPVOID)hookAddr, recvMsgBackupCode, 5, 0);
|
||||
// 写入新的代码
|
||||
WriteProcessMemory(GetCurrentProcess(), (LPVOID)hookAddr, jmpCode, 5, 0);
|
||||
}
|
||||
|
||||
void UnHookAddress(DWORD hookAddr, CHAR restoreCode[5])
|
||||
{
|
||||
WriteProcessMemory(GetCurrentProcess(), (LPVOID)hookAddr, restoreCode, 5, 0);
|
||||
}
|
||||
|
||||
void DispatchMsg(DWORD reg)
|
||||
{
|
||||
WxMsg_t wxMsg;
|
||||
try {
|
||||
wxMsg.id = GET_QWORD(reg + g_WxCalls.recvMsg.msgId);
|
||||
wxMsg.type = GET_DWORD(reg + g_WxCalls.recvMsg.type);
|
||||
wxMsg.is_self = GET_DWORD(reg + g_WxCalls.recvMsg.isSelf);
|
||||
wxMsg.ts = GET_DWORD(reg + g_WxCalls.recvMsg.ts);
|
||||
wxMsg.content = GetStringByWstrAddr(reg + g_WxCalls.recvMsg.content);
|
||||
wxMsg.sign = GetStringByStrAddr(reg + g_WxCalls.recvMsg.sign);
|
||||
wxMsg.xml = GetStringByStrAddr(reg + g_WxCalls.recvMsg.msgXml);
|
||||
|
||||
string roomid = GetStringByWstrAddr(reg + g_WxCalls.recvMsg.roomId);
|
||||
if (roomid.find("@chatroom") != string::npos) { // 群 ID 的格式为 xxxxxxxxxxx@chatroom
|
||||
wxMsg.is_group = true;
|
||||
wxMsg.roomid = roomid;
|
||||
if (wxMsg.is_self) {
|
||||
wxMsg.sender = GetSelfWxid();
|
||||
} else {
|
||||
wxMsg.sender = GetStringByStrAddr(reg + g_WxCalls.recvMsg.wxid);
|
||||
}
|
||||
} else {
|
||||
wxMsg.is_group = false;
|
||||
if (wxMsg.is_self) {
|
||||
wxMsg.sender = GetSelfWxid();
|
||||
} else {
|
||||
wxMsg.sender = roomid;
|
||||
}
|
||||
}
|
||||
|
||||
wxMsg.thumb = GetStringByStrAddr(reg + g_WxCalls.recvMsg.thumb);
|
||||
if (!wxMsg.thumb.empty()) {
|
||||
wxMsg.thumb = GetHomePath() + wxMsg.thumb;
|
||||
replace(wxMsg.thumb.begin(), wxMsg.thumb.end(), '\\', '/');
|
||||
}
|
||||
|
||||
wxMsg.extra = GetStringByStrAddr(reg + g_WxCalls.recvMsg.extra);
|
||||
if (!wxMsg.extra.empty()) {
|
||||
wxMsg.extra = GetHomePath() + wxMsg.extra;
|
||||
replace(wxMsg.extra.begin(), wxMsg.extra.end(), '\\', '/');
|
||||
}
|
||||
} catch (const std::exception &e) {
|
||||
LOG_ERROR(GB2312ToUtf8(e.what()));
|
||||
} catch (...) {
|
||||
LOG_ERROR("Unknow exception.");
|
||||
}
|
||||
|
||||
{
|
||||
unique_lock<mutex> lock(gMutex);
|
||||
gMsgQueue.push(wxMsg); // 推送到队列
|
||||
}
|
||||
|
||||
gCV.notify_all(); // 通知各方消息就绪
|
||||
}
|
||||
|
||||
__declspec(naked) void RecieveMsgFunc()
|
||||
{
|
||||
__asm {
|
||||
pushad
|
||||
pushfd
|
||||
push ecx
|
||||
call DispatchMsg
|
||||
add esp, 0x4
|
||||
popfd
|
||||
popad
|
||||
call recvMsgCallAddr // 这个为被覆盖的call
|
||||
jmp recvMsgJumpBackAddr // 跳回被HOOK指令的下一条指令
|
||||
}
|
||||
}
|
||||
|
||||
void ListenMessage()
|
||||
{
|
||||
// DbgMsg("ListenMessage");
|
||||
// OutputDebugString(L"ListenMessage\n");
|
||||
// MessageBox(NULL, L"ListenMessage", L"ListenMessage", 0);
|
||||
if (gIsListening || (g_WeChatWinDllAddr == 0)) {
|
||||
if (isMH_Initialized && !gIsLogging && !gIsListening && !gIsListeningPyq) {
|
||||
status = MH_Uninitialize();
|
||||
if (status != MH_OK) {
|
||||
LOG_ERROR("MH_Uninitialize failed: {}", to_string(status));
|
||||
return;
|
||||
}
|
||||
|
||||
recvMsgHookAddr = g_WeChatWinDllAddr + g_WxCalls.recvMsg.hook;
|
||||
recvMsgCallAddr = g_WeChatWinDllAddr + g_WxCalls.recvMsg.call;
|
||||
recvMsgJumpBackAddr = recvMsgHookAddr + 5;
|
||||
|
||||
HookAddress(recvMsgHookAddr, RecieveMsgFunc, recvMsgBackupCode);
|
||||
gIsListening = true;
|
||||
}
|
||||
|
||||
void UnListenMessage()
|
||||
{
|
||||
if (!gIsListening) {
|
||||
return;
|
||||
}
|
||||
UnHookAddress(recvMsgHookAddr, recvMsgBackupCode);
|
||||
gIsListening = false;
|
||||
}
|
||||
|
||||
void DispatchPyq(DWORD reg)
|
||||
{
|
||||
DWORD startAddr = *(DWORD *)(reg + g_WxCalls.pyq.start);
|
||||
DWORD endAddr = *(DWORD *)(reg + g_WxCalls.pyq.end);
|
||||
|
||||
if (startAddr == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
while (startAddr < endAddr) {
|
||||
WxMsg_t wxMsg;
|
||||
|
||||
wxMsg.type = 0x00; // 朋友圈消息
|
||||
wxMsg.is_self = false;
|
||||
wxMsg.is_group = false;
|
||||
wxMsg.id = GET_QWORD(startAddr);
|
||||
wxMsg.ts = GET_DWORD(startAddr + g_WxCalls.pyq.ts);
|
||||
wxMsg.xml = GetStringByWstrAddr(startAddr + g_WxCalls.pyq.xml);
|
||||
wxMsg.sender = GetStringByWstrAddr(startAddr + g_WxCalls.pyq.wxid);
|
||||
wxMsg.content = GetStringByWstrAddr(startAddr + g_WxCalls.pyq.content);
|
||||
|
||||
{
|
||||
unique_lock<mutex> lock(gMutex);
|
||||
gMsgQueue.push(wxMsg); // 推送到队列
|
||||
}
|
||||
|
||||
gCV.notify_all(); // 通知各方消息就绪
|
||||
|
||||
startAddr += g_WxCalls.pyq.step;
|
||||
}
|
||||
}
|
||||
|
||||
__declspec(naked) void RecievePyqFunc()
|
||||
{
|
||||
__asm {
|
||||
pushad
|
||||
pushfd
|
||||
push [esp + 0x24]
|
||||
call DispatchPyq
|
||||
add esp, 0x4
|
||||
popfd
|
||||
popad
|
||||
call recvPyqCallAddr // 这个为被覆盖的call
|
||||
jmp recvPyqJumpBackAddr // 跳回被HOOK指令的下一条指令
|
||||
}
|
||||
}
|
||||
|
||||
void ListenPyq()
|
||||
{
|
||||
if (gIsListeningPyq || (g_WeChatWinDllAddr == 0)) {
|
||||
MH_STATUS status = MH_UNKNOWN;
|
||||
if (gIsListeningPyq) {
|
||||
LOG_WARN("gIsListeningPyq");
|
||||
return;
|
||||
}
|
||||
funcRecvPyq = (RecvPyq_t)(g_WeChatWinDllAddr + OS_PYQ_MSG_CALL);
|
||||
|
||||
if (!isMH_Initialized) {
|
||||
status = MH_Initialize();
|
||||
if (status != MH_OK) {
|
||||
LOG_ERROR("MH_Initialize failed: {}", to_string(status));
|
||||
return;
|
||||
}
|
||||
isMH_Initialized = true;
|
||||
}
|
||||
|
||||
status = MH_CreateHook(funcRecvPyq, &DispatchPyq, reinterpret_cast<LPVOID *>(&realRecvPyq));
|
||||
if (status != MH_OK) {
|
||||
LOG_ERROR("MH_CreateHook failed: {}", to_string(status));
|
||||
return;
|
||||
}
|
||||
|
||||
recvPyqHookAddr = g_WeChatWinDllAddr + g_WxCalls.pyq.hook;
|
||||
recvPyqCallAddr = g_WeChatWinDllAddr + g_WxCalls.pyq.call;
|
||||
recvPyqJumpBackAddr = recvPyqHookAddr + 5;
|
||||
status = MH_EnableHook(funcRecvPyq);
|
||||
if (status != MH_OK) {
|
||||
LOG_ERROR("MH_EnableHook failed: {}", to_string(status));
|
||||
return;
|
||||
}
|
||||
|
||||
HookAddress(recvPyqHookAddr, RecievePyqFunc, recvPyqBackupCode);
|
||||
gIsListeningPyq = true;
|
||||
}
|
||||
|
||||
void UnListenPyq()
|
||||
{
|
||||
MH_STATUS status = MH_UNKNOWN;
|
||||
if (!gIsListeningPyq) {
|
||||
return;
|
||||
}
|
||||
|
||||
UnHookAddress(recvPyqHookAddr, recvPyqBackupCode);
|
||||
gIsListeningPyq = false;
|
||||
status = MH_DisableHook(funcRecvPyq);
|
||||
if (status != MH_OK) {
|
||||
LOG_ERROR("MH_DisableHook failed: {}", to_string(status));
|
||||
return;
|
||||
}
|
||||
|
||||
status = MH_Uninitialize();
|
||||
if (status != MH_OK) {
|
||||
LOG_ERROR("MH_Uninitialize failed: {}", to_string(status));
|
||||
return;
|
||||
}
|
||||
|
||||
gIsListeningPyq = false;
|
||||
if (isMH_Initialized && !gIsLogging && !gIsListening && !gIsListeningPyq) {
|
||||
status = MH_Uninitialize();
|
||||
if (status != MH_OK) {
|
||||
LOG_ERROR("MH_Uninitialize failed: {}", to_string(status));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -2,6 +2,8 @@
|
||||
|
||||
#include "pb_types.h"
|
||||
|
||||
void EnableLog();
|
||||
void DisableLog();
|
||||
void ListenPyq();
|
||||
void UnListenPyq();
|
||||
void ListenMessage();
|
||||
|
@ -1,56 +0,0 @@
|
||||
#include "receive_transfer.h"
|
||||
#include "load_calls.h"
|
||||
#include "log.h"
|
||||
#include "util.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
extern WxCalls_t g_WxCalls;
|
||||
extern UINT64 g_WeChatWinDllAddr;
|
||||
#if 0
|
||||
int ReceiveTransfer(string wxid, string transferid, string transactionid)
|
||||
{
|
||||
int rv = 0;
|
||||
DWORD recvTransferCall1 = g_WeChatWinDllAddr + g_WxCalls.tf.call1;
|
||||
DWORD recvTransferCall2 = g_WeChatWinDllAddr + g_WxCalls.tf.call2;
|
||||
DWORD recvTransferCall3 = g_WeChatWinDllAddr + g_WxCalls.tf.call3;
|
||||
|
||||
char payInfo[0x134] = { 0 };
|
||||
wstring wsWxid = String2Wstring(wxid);
|
||||
wstring wsTfid = String2Wstring(transferid);
|
||||
wstring wsTaid = String2Wstring(transactionid);
|
||||
|
||||
WxString wxWxid(wsWxid);
|
||||
WxString wxTfid(wsTfid);
|
||||
WxString wxTaid(wsTaid);
|
||||
|
||||
LOG_DEBUG("Receiving transfer, from: {}, transferid: {}, transactionid: {}", wxid, transferid, transactionid);
|
||||
__asm {
|
||||
pushad;
|
||||
lea ecx, payInfo;
|
||||
call recvTransferCall1;
|
||||
mov dword ptr[payInfo + 0x4], 0x1;
|
||||
mov dword ptr[payInfo + 0x4C], 0x1;
|
||||
popad;
|
||||
}
|
||||
memcpy(&payInfo[0x1C], &wxTaid, sizeof(wxTaid));
|
||||
memcpy(&payInfo[0x38], &wxTfid, sizeof(wxTfid));
|
||||
|
||||
__asm {
|
||||
pushad;
|
||||
push 0x1;
|
||||
sub esp, 0x8;
|
||||
lea edx, wxWxid;
|
||||
lea ecx, payInfo;
|
||||
call recvTransferCall2;
|
||||
mov rv, eax;
|
||||
add esp, 0xC;
|
||||
push 0x0;
|
||||
lea ecx, payInfo;
|
||||
call recvTransferCall3;
|
||||
popad;
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
#endif
|
@ -1,5 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include <string>
|
||||
|
||||
int ReceiveTransfer(std::string wxid, std::string transferid, std::string transactionid);
|
@ -26,7 +26,6 @@
|
||||
#include "pb_types.h"
|
||||
#include "pb_util.h"
|
||||
#include "receive_msg.h"
|
||||
#include "receive_transfer.h"
|
||||
#include "rpc_server.h"
|
||||
#include "send_msg.h"
|
||||
#include "spy.h"
|
||||
@ -40,6 +39,7 @@
|
||||
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
bool gIsLogging = false;
|
||||
bool gIsListening = false;
|
||||
bool gIsListeningPyq = false;
|
||||
mutex gMutex;
|
||||
@ -129,7 +129,7 @@ bool func_get_msg_types(uint8_t *out, size_t *len)
|
||||
|
||||
return true;
|
||||
}
|
||||
#if 0
|
||||
|
||||
bool func_get_contacts(uint8_t *out, size_t *len)
|
||||
{
|
||||
Response rsp = Response_init_default;
|
||||
@ -297,6 +297,7 @@ bool func_send_file(char *path, char *receiver, uint8_t *out, size_t *len)
|
||||
return true;
|
||||
}
|
||||
|
||||
#if 0
|
||||
bool func_send_xml(XmlMsg xml, uint8_t *out, size_t *len)
|
||||
{
|
||||
Response rsp = Response_init_default;
|
||||
@ -348,6 +349,7 @@ bool func_send_emotion(char *path, char *receiver, uint8_t *out, size_t *len)
|
||||
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
bool func_send_rich_txt(RichText rt, uint8_t *out, size_t *len)
|
||||
{
|
||||
@ -426,7 +428,7 @@ bool func_forward_msg(uint64_t id, char *receiver, uint8_t *out, size_t *len)
|
||||
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
static void PushMessage()
|
||||
{
|
||||
static uint8_t buffer[G_BUF_SIZE] = { 0 };
|
||||
@ -543,7 +545,6 @@ bool func_disable_recv_txt(uint8_t *out, size_t *len)
|
||||
return true;
|
||||
}
|
||||
|
||||
#if 0
|
||||
bool func_exec_db_query(char *db, char *sql, uint8_t *out, size_t *len)
|
||||
{
|
||||
Response rsp = Response_init_default;
|
||||
@ -570,52 +571,6 @@ bool func_exec_db_query(char *db, char *sql, uint8_t *out, size_t *len)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool func_accept_friend(char *v3, char *v4, int32_t scene, uint8_t *out, size_t *len)
|
||||
{
|
||||
Response rsp = Response_init_default;
|
||||
rsp.func = Functions_FUNC_ACCEPT_FRIEND;
|
||||
rsp.which_msg = Response_status_tag;
|
||||
|
||||
if ((v3 == NULL) || (v4 == NULL)) {
|
||||
rsp.msg.status = -1;
|
||||
LOG_ERROR("Empty V3 or V4.");
|
||||
} else {
|
||||
rsp.msg.status = AcceptNewFriend(v3, v4, scene);
|
||||
}
|
||||
|
||||
pb_ostream_t stream = pb_ostream_from_buffer(out, *len);
|
||||
if (!pb_encode(&stream, Response_fields, &rsp)) {
|
||||
LOG_ERROR("Encoding failed: {}", PB_GET_ERROR(&stream));
|
||||
return false;
|
||||
}
|
||||
*len = stream.bytes_written;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool func_receive_transfer(char *wxid, char *tfid, char *taid, uint8_t *out, size_t *len)
|
||||
{
|
||||
Response rsp = Response_init_default;
|
||||
rsp.func = Functions_FUNC_RECV_TRANSFER;
|
||||
rsp.which_msg = Response_status_tag;
|
||||
|
||||
if ((wxid == NULL) || (tfid == NULL) || (taid == NULL)) {
|
||||
rsp.msg.status = -1;
|
||||
LOG_ERROR("Empty wxid, tfid or taid.");
|
||||
} else {
|
||||
rsp.msg.status = ReceiveTransfer(wxid, tfid, taid);
|
||||
}
|
||||
|
||||
pb_ostream_t stream = pb_ostream_from_buffer(out, *len);
|
||||
if (!pb_encode(&stream, Response_fields, &rsp)) {
|
||||
LOG_ERROR("Encoding failed: {}", PB_GET_ERROR(&stream));
|
||||
return false;
|
||||
}
|
||||
*len = stream.bytes_written;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool func_refresh_pyq(uint64_t id, uint8_t *out, size_t *len)
|
||||
{
|
||||
Response rsp = Response_init_default;
|
||||
@ -656,29 +611,6 @@ bool func_download_attach(AttachMsg att, uint8_t *out, size_t *len)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool func_get_contact_info(string wxid, uint8_t *out, size_t *len)
|
||||
{
|
||||
/*借用 Functions_FUNC_GET_CONTACTS */
|
||||
Response rsp = Response_init_default;
|
||||
rsp.func = Functions_FUNC_GET_CONTACT_INFO;
|
||||
rsp.which_msg = Response_contacts_tag;
|
||||
|
||||
vector<RpcContact_t> contacts;
|
||||
contacts.push_back(GetContactByWxid(wxid));
|
||||
|
||||
rsp.msg.contacts.contacts.funcs.encode = encode_contacts;
|
||||
rsp.msg.contacts.contacts.arg = &contacts;
|
||||
|
||||
pb_ostream_t stream = pb_ostream_from_buffer(out, *len);
|
||||
if (!pb_encode(&stream, Response_fields, &rsp)) {
|
||||
LOG_ERROR("Encoding failed: {}", PB_GET_ERROR(&stream));
|
||||
return false;
|
||||
}
|
||||
*len = stream.bytes_written;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool func_revoke_msg(uint64_t id, uint8_t *out, size_t *len)
|
||||
{
|
||||
Response rsp = Response_init_default;
|
||||
@ -715,6 +647,77 @@ bool func_refresh_qrcode(uint8_t *out, size_t *len)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool func_receive_transfer(char *wxid, char *tfid, char *taid, uint8_t *out, size_t *len)
|
||||
{
|
||||
Response rsp = Response_init_default;
|
||||
rsp.func = Functions_FUNC_RECV_TRANSFER;
|
||||
rsp.which_msg = Response_status_tag;
|
||||
|
||||
if ((wxid == NULL) || (tfid == NULL) || (taid == NULL)) {
|
||||
rsp.msg.status = -1;
|
||||
LOG_ERROR("Empty wxid, tfid or taid.");
|
||||
} else {
|
||||
rsp.msg.status = ReceiveTransfer(wxid, tfid, taid);
|
||||
}
|
||||
|
||||
pb_ostream_t stream = pb_ostream_from_buffer(out, *len);
|
||||
if (!pb_encode(&stream, Response_fields, &rsp)) {
|
||||
LOG_ERROR("Encoding failed: {}", PB_GET_ERROR(&stream));
|
||||
return false;
|
||||
}
|
||||
*len = stream.bytes_written;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#if 0
|
||||
bool func_accept_friend(char *v3, char *v4, int32_t scene, uint8_t *out, size_t *len)
|
||||
{
|
||||
Response rsp = Response_init_default;
|
||||
rsp.func = Functions_FUNC_ACCEPT_FRIEND;
|
||||
rsp.which_msg = Response_status_tag;
|
||||
|
||||
if ((v3 == NULL) || (v4 == NULL)) {
|
||||
rsp.msg.status = -1;
|
||||
LOG_ERROR("Empty V3 or V4.");
|
||||
} else {
|
||||
rsp.msg.status = AcceptNewFriend(v3, v4, scene);
|
||||
}
|
||||
|
||||
pb_ostream_t stream = pb_ostream_from_buffer(out, *len);
|
||||
if (!pb_encode(&stream, Response_fields, &rsp)) {
|
||||
LOG_ERROR("Encoding failed: {}", PB_GET_ERROR(&stream));
|
||||
return false;
|
||||
}
|
||||
*len = stream.bytes_written;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool func_get_contact_info(string wxid, uint8_t *out, size_t *len)
|
||||
{
|
||||
/*借用 Functions_FUNC_GET_CONTACTS */
|
||||
Response rsp = Response_init_default;
|
||||
rsp.func = Functions_FUNC_GET_CONTACT_INFO;
|
||||
rsp.which_msg = Response_contacts_tag;
|
||||
|
||||
vector<RpcContact_t> contacts;
|
||||
contacts.push_back(GetContactByWxid(wxid));
|
||||
|
||||
rsp.msg.contacts.contacts.funcs.encode = encode_contacts;
|
||||
rsp.msg.contacts.contacts.arg = &contacts;
|
||||
|
||||
pb_ostream_t stream = pb_ostream_from_buffer(out, *len);
|
||||
if (!pb_encode(&stream, Response_fields, &rsp)) {
|
||||
LOG_ERROR("Encoding failed: {}", PB_GET_ERROR(&stream));
|
||||
return false;
|
||||
}
|
||||
*len = stream.bytes_written;
|
||||
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
bool func_decrypt_image(DecPath dec, uint8_t *out, size_t *len)
|
||||
{
|
||||
Response rsp = Response_init_default;
|
||||
@ -836,7 +839,7 @@ bool func_invite_room_members(char *roomid, char *wxids, uint8_t *out, size_t *l
|
||||
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
static bool dispatcher(uint8_t *in, size_t in_len, uint8_t *out, size_t *out_len)
|
||||
{
|
||||
bool ret = false;
|
||||
@ -867,7 +870,6 @@ static bool dispatcher(uint8_t *in, size_t in_len, uint8_t *out, size_t *out_len
|
||||
ret = func_get_msg_types(out, out_len);
|
||||
break;
|
||||
}
|
||||
#if 0
|
||||
case Functions_FUNC_GET_CONTACTS: {
|
||||
ret = func_get_contacts(out, out_len);
|
||||
break;
|
||||
@ -888,14 +890,6 @@ static bool dispatcher(uint8_t *in, size_t in_len, uint8_t *out, size_t *out_len
|
||||
ret = func_send_txt(req.msg.txt, out, out_len);
|
||||
break;
|
||||
}
|
||||
case Functions_FUNC_SEND_RICH_TXT: {
|
||||
ret = func_send_rich_txt(req.msg.rt, out, out_len);
|
||||
break;
|
||||
}
|
||||
case Functions_FUNC_SEND_PAT_MSG: {
|
||||
ret = func_send_pat_msg(req.msg.pm.roomid, req.msg.pm.wxid, out, out_len);
|
||||
break;
|
||||
}
|
||||
case Functions_FUNC_SEND_IMG: {
|
||||
ret = func_send_img(req.msg.file.path, req.msg.file.receiver, out, out_len);
|
||||
break;
|
||||
@ -904,10 +898,19 @@ static bool dispatcher(uint8_t *in, size_t in_len, uint8_t *out, size_t *out_len
|
||||
ret = func_send_file(req.msg.file.path, req.msg.file.receiver, out, out_len);
|
||||
break;
|
||||
}
|
||||
case Functions_FUNC_SEND_RICH_TXT: {
|
||||
ret = func_send_rich_txt(req.msg.rt, out, out_len);
|
||||
break;
|
||||
}
|
||||
case Functions_FUNC_SEND_PAT_MSG: {
|
||||
ret = func_send_pat_msg(req.msg.pm.roomid, req.msg.pm.wxid, out, out_len);
|
||||
break;
|
||||
}
|
||||
case Functions_FUNC_FORWARD_MSG: {
|
||||
ret = func_forward_msg(req.msg.fm.id, req.msg.fm.receiver, out, out_len);
|
||||
break;
|
||||
}
|
||||
#if 0
|
||||
case Functions_FUNC_SEND_XML: {
|
||||
ret = func_send_xml(req.msg.xml, out, out_len);
|
||||
break;
|
||||
@ -925,19 +928,10 @@ static bool dispatcher(uint8_t *in, size_t in_len, uint8_t *out, size_t *out_len
|
||||
ret = func_disable_recv_txt(out, out_len);
|
||||
break;
|
||||
}
|
||||
#if 0
|
||||
case Functions_FUNC_EXEC_DB_QUERY: {
|
||||
ret = func_exec_db_query(req.msg.query.db, req.msg.query.sql, out, out_len);
|
||||
break;
|
||||
}
|
||||
case Functions_FUNC_ACCEPT_FRIEND: {
|
||||
ret = func_accept_friend(req.msg.v.v3, req.msg.v.v4, req.msg.v.scene, out, out_len);
|
||||
break;
|
||||
}
|
||||
case Functions_FUNC_RECV_TRANSFER: {
|
||||
ret = func_receive_transfer(req.msg.tf.wxid, req.msg.tf.tfid, req.msg.tf.taid, out, out_len);
|
||||
break;
|
||||
}
|
||||
case Functions_FUNC_REFRESH_PYQ: {
|
||||
ret = func_refresh_pyq(req.msg.ui64, out, out_len);
|
||||
break;
|
||||
@ -946,8 +940,8 @@ static bool dispatcher(uint8_t *in, size_t in_len, uint8_t *out, size_t *out_len
|
||||
ret = func_download_attach(req.msg.att, out, out_len);
|
||||
break;
|
||||
}
|
||||
case Functions_FUNC_GET_CONTACT_INFO: {
|
||||
ret = func_get_contact_info(req.msg.str, out, out_len);
|
||||
case Functions_FUNC_RECV_TRANSFER: {
|
||||
ret = func_receive_transfer(req.msg.tf.wxid, req.msg.tf.tfid, req.msg.tf.taid, out, out_len);
|
||||
break;
|
||||
}
|
||||
case Functions_FUNC_REVOKE_MSG: {
|
||||
@ -958,6 +952,16 @@ static bool dispatcher(uint8_t *in, size_t in_len, uint8_t *out, size_t *out_len
|
||||
ret = func_refresh_qrcode(out, out_len);
|
||||
break;
|
||||
}
|
||||
#if 0
|
||||
case Functions_FUNC_ACCEPT_FRIEND: {
|
||||
ret = func_accept_friend(req.msg.v.v3, req.msg.v.v4, req.msg.v.scene, out, out_len);
|
||||
break;
|
||||
}
|
||||
case Functions_FUNC_GET_CONTACT_INFO: {
|
||||
ret = func_get_contact_info(req.msg.str, out, out_len);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
case Functions_FUNC_DECRYPT_IMAGE: {
|
||||
ret = func_decrypt_image(req.msg.dec, out, out_len);
|
||||
break;
|
||||
@ -978,7 +982,6 @@ static bool dispatcher(uint8_t *in, size_t in_len, uint8_t *out, size_t *out_len
|
||||
ret = func_invite_room_members(req.msg.m.roomid, req.msg.m.wxids, out, out_len);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
default: {
|
||||
LOG_ERROR("[UNKNOW FUNCTION]");
|
||||
break;
|
||||
@ -1043,6 +1046,7 @@ static int RunServer()
|
||||
}
|
||||
nng_free(in, in_len);
|
||||
}
|
||||
RpcStopServer();
|
||||
LOG_DEBUG("Leave RunServer");
|
||||
return rv;
|
||||
}
|
||||
@ -1059,7 +1063,9 @@ int RpcStartServer(int port)
|
||||
if (rpcThread != 0) {
|
||||
CloseHandle(rpcThread);
|
||||
}
|
||||
|
||||
#if ENABLE_WX_LOG
|
||||
EnableLog();
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1073,5 +1079,8 @@ int RpcStopServer()
|
||||
Sleep(1000);
|
||||
LOG_INFO("Server stoped.");
|
||||
}
|
||||
#if ENABLE_WX_LOG
|
||||
DisableLog();
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
@ -9,28 +9,47 @@
|
||||
#include "util.h"
|
||||
|
||||
extern HANDLE g_hEvent;
|
||||
extern WxCalls_t g_WxCalls;
|
||||
extern UINT64 g_WeChatWinDllAddr;
|
||||
extern QWORD g_WeChatWinDllAddr;
|
||||
extern string GetSelfWxid(); // Defined in spy.cpp
|
||||
#if 0
|
||||
|
||||
#define SRTM_SIZE 0x3F0
|
||||
|
||||
#define OS_NEW 0x1C28800
|
||||
#define OS_FREE 0x1C1FF10
|
||||
#define OS_SEND_MSG_MGR 0x1C1E690
|
||||
#define OS_SEND_TEXT 0x238DDD0
|
||||
#define OS_SEND_IMAGE 0x2383560
|
||||
#define OS_GET_APP_MSG_MGR 0x1C23630
|
||||
#define OS_SEND_FILE 0x21969E0
|
||||
#define OS_RTM_NEW 0x1C27D50
|
||||
#define OS_RTM_FREE 0x1C27120
|
||||
#define OS_SEND_RICH_TEXT 0x21A09C0
|
||||
#define OS_SEND_PAT_MSG 0x2D669B0
|
||||
#define OS_FORWARD_MSG 0x238D350
|
||||
|
||||
typedef QWORD (*New_t)(QWORD);
|
||||
typedef QWORD (*Free_t)(QWORD);
|
||||
typedef QWORD (*SendMsgMgr_t)();
|
||||
typedef QWORD (*GetAppMsgMgr_t)();
|
||||
typedef QWORD (*SendTextMsg_t)(QWORD, QWORD, QWORD, QWORD, QWORD, QWORD, QWORD, QWORD);
|
||||
typedef QWORD (*SendImageMsg_t)(QWORD, QWORD, QWORD, QWORD, QWORD);
|
||||
typedef QWORD (*SendFileMsg_t)(QWORD, QWORD, QWORD, QWORD, QWORD, QWORD *, QWORD, QWORD *, QWORD, QWORD *, QWORD,
|
||||
QWORD);
|
||||
typedef QWORD (*SendRichTextMsg_t)(QWORD, QWORD, QWORD);
|
||||
typedef QWORD (*SendPatMsg_t)(QWORD, QWORD);
|
||||
typedef QWORD (*ForwardMsg_t)(QWORD, QWORD, QWORD, QWORD);
|
||||
|
||||
void SendTextMessage(string wxid, string msg, string atWxids)
|
||||
{
|
||||
int success = 0;
|
||||
char buffer[0x2D8] = { 0 };
|
||||
|
||||
// 发送消息Call地址 = 微信基址 + 偏移
|
||||
DWORD sendCall1 = g_WeChatWinDllAddr + g_WxCalls.sendText.call1;
|
||||
DWORD sendCall2 = g_WeChatWinDllAddr + g_WxCalls.sendText.call2;
|
||||
DWORD sendCall3 = g_WeChatWinDllAddr + g_WxCalls.sendText.call3;
|
||||
|
||||
QWORD success = 0;
|
||||
wstring wsWxid = String2Wstring(wxid);
|
||||
wstring wsMsg = String2Wstring(msg);
|
||||
WxString wxMsg(wsMsg);
|
||||
WxString wxWxid(wsWxid);
|
||||
|
||||
vector<wstring> vAtWxids;
|
||||
vector<WxString> vWxAtWxids;
|
||||
if (!atWxids.empty()) {
|
||||
vector<wstring> vAtWxids;
|
||||
wstringstream wss(String2Wstring(atWxids));
|
||||
while (wss.good()) {
|
||||
wstring wstr;
|
||||
@ -39,141 +58,154 @@ void SendTextMessage(string wxid, string msg, string atWxids)
|
||||
WxString wxAtWxid(vAtWxids.back());
|
||||
vWxAtWxids.push_back(wxAtWxid);
|
||||
}
|
||||
} else {
|
||||
WxString wxEmpty = WxString();
|
||||
vWxAtWxids.push_back(wxEmpty);
|
||||
}
|
||||
|
||||
__asm
|
||||
{
|
||||
pushad;
|
||||
call sendCall1;
|
||||
push 0x0;
|
||||
push 0x0;
|
||||
push 0x0;
|
||||
push 0x1;
|
||||
lea eax, vWxAtWxids;
|
||||
push eax;
|
||||
lea eax, wxMsg;
|
||||
push eax;
|
||||
lea edx, wxWxid;
|
||||
lea ecx, buffer;
|
||||
call sendCall2;
|
||||
mov success, eax;
|
||||
add esp, 0x18;
|
||||
lea ecx, buffer;
|
||||
call sendCall3;
|
||||
popad;
|
||||
}
|
||||
QWORD wxAters = (QWORD) & ((RawVector_t *)&vWxAtWxids)->start;
|
||||
|
||||
char buffer[0x460] = { 0 };
|
||||
SendMsgMgr_t funcSendMsgMgr = (SendMsgMgr_t)(g_WeChatWinDllAddr + OS_SEND_MSG_MGR);
|
||||
SendTextMsg_t funcSendTextMsg = (SendTextMsg_t)(g_WeChatWinDllAddr + OS_SEND_TEXT);
|
||||
Free_t funcFree = (Free_t)(g_WeChatWinDllAddr + OS_FREE);
|
||||
funcSendMsgMgr();
|
||||
success = funcSendTextMsg((QWORD)(&buffer), (QWORD)(&wxWxid), (QWORD)(&wxMsg), wxAters, 1, 1, 0, 0);
|
||||
funcFree((QWORD)(&buffer));
|
||||
}
|
||||
|
||||
void SendImageMessage(string wxid, string path)
|
||||
{
|
||||
if (g_WeChatWinDllAddr == 0) {
|
||||
return;
|
||||
}
|
||||
int success = 0;
|
||||
DWORD tmpEAX = 0;
|
||||
char buf[0x2D8] = { 0 };
|
||||
|
||||
wstring wsWxid = String2Wstring(wxid);
|
||||
wstring wsPath = String2Wstring(path);
|
||||
|
||||
WxString wxWxid(wsWxid);
|
||||
WxString wxPath(wsPath);
|
||||
WxString nullbuffer;
|
||||
|
||||
// 发送图片Call地址 = 微信基址 + 偏移
|
||||
DWORD sendCall1 = g_WeChatWinDllAddr + g_WxCalls.sendImg.call1;
|
||||
DWORD sendCall2 = g_WeChatWinDllAddr + g_WxCalls.sendImg.call2;
|
||||
DWORD sendCall3 = g_WeChatWinDllAddr + g_WxCalls.sendImg.call3;
|
||||
DWORD sendCall4 = g_WeChatWinDllAddr + g_WxCalls.sendImg.call4;
|
||||
New_t funcNew = (New_t)(g_WeChatWinDllAddr + OS_NEW);
|
||||
Free_t funcFree = (Free_t)(g_WeChatWinDllAddr + OS_FREE);
|
||||
SendMsgMgr_t funcSendMsgMgr = (SendMsgMgr_t)(g_WeChatWinDllAddr + OS_SEND_MSG_MGR);
|
||||
SendImageMsg_t funcSendImage = (SendImageMsg_t)(g_WeChatWinDllAddr + OS_SEND_IMAGE);
|
||||
|
||||
__asm {
|
||||
pushad;
|
||||
call sendCall1;
|
||||
sub esp,0x14;
|
||||
mov tmpEAX,eax;
|
||||
lea eax,nullbuffer;
|
||||
mov ecx,esp;
|
||||
lea edi,wxPath;
|
||||
push eax;
|
||||
call sendCall2;
|
||||
mov ecx,dword ptr [tmpEAX];
|
||||
lea eax,wxWxid;
|
||||
push edi;
|
||||
push eax;
|
||||
lea eax,buf;
|
||||
push eax;
|
||||
call sendCall3;
|
||||
mov success,eax;
|
||||
lea ecx,buf;
|
||||
call sendCall4;
|
||||
popad;
|
||||
}
|
||||
char msg[0x460] = { 0 };
|
||||
char msgTmp[0x460] = { 0 };
|
||||
QWORD *flag[10] = { 0 };
|
||||
|
||||
QWORD tmp1 = 0, tmp2 = 0;
|
||||
QWORD pMsgTmp = funcNew((QWORD)(&msgTmp));
|
||||
flag[8] = &tmp1;
|
||||
flag[9] = &tmp2;
|
||||
flag[1] = (QWORD *)(pMsgTmp);
|
||||
|
||||
QWORD pMsg = funcNew((QWORD)(&msg));
|
||||
QWORD sendMgr = funcSendMsgMgr();
|
||||
funcSendImage(sendMgr, pMsg, (QWORD)(&wxWxid), (QWORD)(&wxPath), (QWORD)(&flag));
|
||||
funcFree(pMsg);
|
||||
funcFree(pMsgTmp);
|
||||
}
|
||||
|
||||
void SendFileMessage(string wxid, string path)
|
||||
{
|
||||
if (g_WeChatWinDllAddr == 0) {
|
||||
return;
|
||||
}
|
||||
int success = 0;
|
||||
DWORD tmpEAX = 0;
|
||||
char buffer[0x2D8] = { 0 };
|
||||
|
||||
wstring wsWxid = String2Wstring(wxid);
|
||||
wstring wsPath = String2Wstring(path);
|
||||
|
||||
WxString wxWxid(wsWxid);
|
||||
WxString wxPath(wsPath);
|
||||
WxString nullbuffer;
|
||||
|
||||
// 发送文件Call地址 = 微信基址 + 偏移
|
||||
DWORD sendCall1 = g_WeChatWinDllAddr + g_WxCalls.sendFile.call1;
|
||||
DWORD sendCall2 = g_WeChatWinDllAddr + g_WxCalls.sendFile.call2;
|
||||
DWORD sendCall3 = g_WeChatWinDllAddr + g_WxCalls.sendFile.call3;
|
||||
DWORD sendCall4 = g_WeChatWinDllAddr + g_WxCalls.sendFile.call4;
|
||||
New_t funcNew = (New_t)(g_WeChatWinDllAddr + OS_NEW);
|
||||
Free_t funcFree = (Free_t)(g_WeChatWinDllAddr + OS_FREE);
|
||||
GetAppMsgMgr_t funcGetAppMsgMgr = (GetAppMsgMgr_t)(g_WeChatWinDllAddr + OS_GET_APP_MSG_MGR);
|
||||
SendFileMsg_t funcSendFile = (SendFileMsg_t)(g_WeChatWinDllAddr + OS_SEND_FILE);
|
||||
|
||||
__asm {
|
||||
pushad;
|
||||
pushfd;
|
||||
call sendCall1;
|
||||
sub esp, 0x14;
|
||||
mov tmpEAX, eax;
|
||||
lea eax, nullbuffer;
|
||||
mov ecx, esp;
|
||||
push eax;
|
||||
call sendCall2;
|
||||
push 0x0;
|
||||
sub esp, 0x14;
|
||||
mov edi, esp;
|
||||
mov dword ptr[edi], 0;
|
||||
mov dword ptr[edi + 0x4], 0;
|
||||
mov dword ptr[edi + 0x8], 0;
|
||||
mov dword ptr[edi + 0xc], 0;
|
||||
mov dword ptr[edi + 0x10], 0;
|
||||
sub esp, 0x14;
|
||||
lea eax, wxPath;
|
||||
mov ecx, esp;
|
||||
push eax;
|
||||
call sendCall2;
|
||||
sub esp, 0x14;
|
||||
lea eax, wxWxid;
|
||||
mov ecx, esp;
|
||||
push eax;
|
||||
call sendCall2;
|
||||
mov ecx, dword ptr[tmpEAX];
|
||||
lea eax, buffer;
|
||||
push eax;
|
||||
call sendCall3;
|
||||
mov al, byte ptr[eax + 0x38];
|
||||
movzx eax, al;
|
||||
mov success, eax;
|
||||
lea ecx, buffer;
|
||||
call sendCall4;
|
||||
popfd;
|
||||
popad;
|
||||
}
|
||||
char msg[0x460] = { 0 };
|
||||
QWORD tmp1[4] = { 0 };
|
||||
QWORD tmp2[4] = { 0 };
|
||||
QWORD tmp3[4] = { 0 };
|
||||
|
||||
QWORD pMsg = funcNew((QWORD)(&msg));
|
||||
QWORD appMgr = funcGetAppMsgMgr();
|
||||
funcSendFile(appMgr, pMsg, (QWORD)(&wxWxid), (QWORD)(&wxPath), 1, tmp1, 0, tmp2, 0, tmp3, 0, 0);
|
||||
funcFree(pMsg);
|
||||
}
|
||||
|
||||
int SendRichTextMessage(RichText_t &rt)
|
||||
{ // TODO: Fix memory leak
|
||||
QWORD status = -1;
|
||||
|
||||
New_t funcNew = (New_t)(g_WeChatWinDllAddr + OS_RTM_NEW);
|
||||
Free_t funcFree = (Free_t)(g_WeChatWinDllAddr + OS_RTM_FREE);
|
||||
GetAppMsgMgr_t funcGetAppMsgMgr = (GetAppMsgMgr_t)(g_WeChatWinDllAddr + OS_GET_APP_MSG_MGR);
|
||||
SendRichTextMsg_t funcForwordPublicMsg = (SendRichTextMsg_t)(g_WeChatWinDllAddr + OS_SEND_RICH_TEXT);
|
||||
|
||||
char *buff = (char *)HeapAlloc(GetProcessHeap(), 0, SRTM_SIZE);
|
||||
if (buff == NULL) {
|
||||
LOG_ERROR("Out of Memory...");
|
||||
return -1;
|
||||
}
|
||||
|
||||
memset(buff, 0, SRTM_SIZE);
|
||||
funcNew((QWORD)buff);
|
||||
WxString *pReceiver = NewWxStringFromStr(rt.receiver);
|
||||
WxString *pTitle = NewWxStringFromStr(rt.title);
|
||||
WxString *pUrl = NewWxStringFromStr(rt.url);
|
||||
WxString *pThumburl = NewWxStringFromStr(rt.thumburl);
|
||||
WxString *pDigest = NewWxStringFromStr(rt.digest);
|
||||
WxString *pAccount = NewWxStringFromStr(rt.account);
|
||||
WxString *pName = NewWxStringFromStr(rt.name);
|
||||
|
||||
memcpy(buff + 0x8, pTitle, sizeof(WxString));
|
||||
memcpy(buff + 0x48, pUrl, sizeof(WxString));
|
||||
memcpy(buff + 0xB0, pThumburl, sizeof(WxString));
|
||||
memcpy(buff + 0xF0, pDigest, sizeof(WxString));
|
||||
memcpy(buff + 0x2C0, pAccount, sizeof(WxString));
|
||||
memcpy(buff + 0x2E0, pName, sizeof(WxString));
|
||||
|
||||
QWORD mgr = funcGetAppMsgMgr();
|
||||
status = funcForwordPublicMsg(mgr, (QWORD)(pReceiver), (QWORD)(buff));
|
||||
funcFree((QWORD)buff);
|
||||
|
||||
return (int)status;
|
||||
}
|
||||
|
||||
int SendPatMessage(string roomid, string wxid)
|
||||
{
|
||||
QWORD status = -1;
|
||||
|
||||
wstring wsRoomid = String2Wstring(roomid);
|
||||
wstring wsWxid = String2Wstring(wxid);
|
||||
WxString wxRoomid(wsRoomid);
|
||||
WxString wxWxid(wsWxid);
|
||||
|
||||
SendPatMsg_t funcSendPatMsg = (SendPatMsg_t)(g_WeChatWinDllAddr + OS_SEND_PAT_MSG);
|
||||
|
||||
status = funcSendPatMsg((QWORD)(&wxRoomid), (QWORD)(&wxWxid));
|
||||
return (int)status;
|
||||
}
|
||||
|
||||
int ForwardMessage(QWORD msgid, string receiver)
|
||||
{
|
||||
int status = -1;
|
||||
uint32_t dbIdx = 0;
|
||||
QWORD localId = 0;
|
||||
|
||||
ForwardMsg_t funcForwardMsg = (ForwardMsg_t)(g_WeChatWinDllAddr + OS_FORWARD_MSG);
|
||||
if (GetLocalIdandDbidx(msgid, &localId, &dbIdx) != 0) {
|
||||
LOG_ERROR("Failed to get localId, Please check id: {}", to_string(msgid));
|
||||
return status;
|
||||
}
|
||||
|
||||
WxString *pReceiver = NewWxStringFromStr(receiver);
|
||||
|
||||
LARGE_INTEGER l;
|
||||
l.HighPart = dbIdx;
|
||||
l.LowPart = (DWORD)localId;
|
||||
|
||||
status = (int)funcForwardMsg((QWORD)pReceiver, l.QuadPart, 0x4, 0x0);
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
#if 0
|
||||
void SendXmlMessage(string receiver, string xml, string path, int type)
|
||||
{
|
||||
if (g_WeChatWinDllAddr == 0) {
|
||||
@ -297,145 +329,4 @@ void SendEmotionMessage(string wxid, string path)
|
||||
popad;
|
||||
}
|
||||
}
|
||||
|
||||
int SendRichTextMessage(RichText_t &rt)
|
||||
{
|
||||
int status = -1;
|
||||
char buff[0x238] = { 0 };
|
||||
|
||||
DWORD rtCall3 = g_WeChatWinDllAddr + g_WxCalls.rt.call3;
|
||||
DWORD rtCall2 = g_WeChatWinDllAddr + g_WxCalls.rt.call2;
|
||||
DWORD rtCall1 = g_WeChatWinDllAddr + g_WxCalls.rt.call1;
|
||||
DWORD rtCall5 = g_WeChatWinDllAddr + g_WxCalls.rt.call5;
|
||||
DWORD rtCall4 = g_WeChatWinDllAddr + g_WxCalls.rt.call4;
|
||||
|
||||
__asm {
|
||||
pushad;
|
||||
pushfd;
|
||||
lea ecx,buff;
|
||||
call rtCall1;
|
||||
popfd;
|
||||
popad;
|
||||
}
|
||||
|
||||
wstring receiver = String2Wstring(rt.receiver);
|
||||
wstring title = String2Wstring(rt.title);
|
||||
wstring url = String2Wstring(rt.url);
|
||||
wstring thumburl = String2Wstring(rt.thumburl);
|
||||
wstring account = String2Wstring(rt.account);
|
||||
wstring name = String2Wstring(rt.name);
|
||||
wstring digest = String2Wstring(rt.digest);
|
||||
|
||||
WxString wxReceiver(receiver);
|
||||
WxString wxTitle(title);
|
||||
WxString wxUrl(url);
|
||||
WxString wxThumburl(thumburl);
|
||||
WxString wxAccount(account);
|
||||
WxString wxName(name);
|
||||
WxString wxDigest(digest);
|
||||
|
||||
memcpy(&buff[0x4], &wxTitle, sizeof(wxTitle));
|
||||
memcpy(&buff[0x2C], &wxUrl, sizeof(wxUrl));
|
||||
memcpy(&buff[0x6C], &wxThumburl, sizeof(wxThumburl));
|
||||
memcpy(&buff[0x94], &wxDigest, sizeof(wxDigest));
|
||||
memcpy(&buff[0x1A0], &wxAccount, sizeof(wxAccount));
|
||||
memcpy(&buff[0x1B4], &wxName, sizeof(wxName));
|
||||
|
||||
__asm {
|
||||
pushad;
|
||||
pushfd;
|
||||
call rtCall2;
|
||||
lea ecx, buff;
|
||||
push ecx;
|
||||
sub esp, 0x14;
|
||||
mov edi, eax;
|
||||
mov ecx, esp;
|
||||
lea ebx, wxReceiver;
|
||||
push ebx;
|
||||
call rtCall3;
|
||||
mov ecx, edi;
|
||||
call rtCall4;
|
||||
mov status, eax;
|
||||
add ebx, 0x14;
|
||||
lea ecx, buff;
|
||||
push 0x0;
|
||||
call rtCall5;
|
||||
popfd;
|
||||
popad;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
int SendPatMessage(string roomid, string wxid)
|
||||
{
|
||||
int status = -1;
|
||||
|
||||
wstring wsRoomid = String2Wstring(roomid);
|
||||
wstring wsWxid = String2Wstring(wxid);
|
||||
WxString wxRoomid(wsRoomid);
|
||||
WxString wxWxid(wsWxid);
|
||||
|
||||
DWORD pmCall1 = g_WeChatWinDllAddr + g_WxCalls.pm.call1;
|
||||
DWORD pmCall2 = g_WeChatWinDllAddr + g_WxCalls.pm.call2;
|
||||
DWORD pmCall3 = g_WeChatWinDllAddr + g_WxCalls.pm.call3;
|
||||
|
||||
__asm {
|
||||
pushad;
|
||||
call pmCall1;
|
||||
push pmCall2;
|
||||
push 0x0;
|
||||
push eax;
|
||||
lea ecx, wxRoomid;
|
||||
lea edx, wxWxid;
|
||||
call pmCall3;
|
||||
add esp, 0xc;
|
||||
movzx eax, al;
|
||||
mov status, eax;
|
||||
popad;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
int ForwardMessage(uint64_t msgid, string receiver)
|
||||
{
|
||||
int status = -1;
|
||||
uint32_t dbIdx = 0;
|
||||
uint64_t localId = 0;
|
||||
|
||||
if (GetLocalIdandDbidx(msgid, &localId, &dbIdx) != 0) {
|
||||
LOG_ERROR("Failed to get localId, Please check id: {}", to_string(msgid));
|
||||
return status;
|
||||
}
|
||||
|
||||
wstring wsReceiver = String2Wstring(receiver);
|
||||
WxString wxReceiver(wsReceiver);
|
||||
|
||||
DWORD fmCall1 = g_WeChatWinDllAddr + g_WxCalls.fm.call1;
|
||||
DWORD fmCall2 = g_WeChatWinDllAddr + g_WxCalls.fm.call2;
|
||||
|
||||
__asm {
|
||||
pushad;
|
||||
pushfd;
|
||||
mov edx, dword ptr [dbIdx];
|
||||
push edx;
|
||||
mov eax, dword ptr [localId];
|
||||
push eax;
|
||||
sub esp, 0x14;
|
||||
mov ecx, esp;
|
||||
lea esi, wxReceiver;
|
||||
push esi;
|
||||
call fmCall1;
|
||||
xor ecx, ecx;
|
||||
call fmCall2;
|
||||
movzx eax, al;
|
||||
mov status, eax;
|
||||
add esp, 0x1c;
|
||||
popfd;
|
||||
popad;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
#endif
|
||||
|
@ -1,14 +1,20 @@
|
||||
#include <filesystem>
|
||||
|
||||
#include "load_calls.h"
|
||||
#include "log.h"
|
||||
#include "rpc_server.h"
|
||||
#include "spy.h"
|
||||
#include "util.h"
|
||||
|
||||
WxCalls_t g_WxCalls = { 0 };
|
||||
UINT64 g_WeChatWinDllAddr = 0;
|
||||
|
||||
static bool IsWxVersionMatched(const wchar_t *version)
|
||||
{
|
||||
if (wcscmp(version, SUPPORT_VERSION) != 0) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void InitSpy(LPVOID args)
|
||||
{
|
||||
|
||||
@ -19,7 +25,7 @@ void InitSpy(LPVOID args)
|
||||
g_WeChatWinDllAddr = (UINT64)GetModuleHandle(L"WeChatWin.dll"); // 获取wechatWin模块地址
|
||||
if (g_WeChatWinDllAddr == 0) {
|
||||
LOG_ERROR("获取 wechatWin.dll 模块地址失败");
|
||||
return;
|
||||
return; // TODO: 退出进程,避免后面操作失败
|
||||
}
|
||||
|
||||
if (!GetWeChatVersion(version)) { // 获取微信版本
|
||||
@ -27,7 +33,7 @@ void InitSpy(LPVOID args)
|
||||
return;
|
||||
}
|
||||
LOG_INFO("WeChat version: {}", Wstring2String(version).c_str());
|
||||
if (LoadCalls(version, &g_WxCalls) != 0) { // 加载微信版本对应的Call地址
|
||||
if (!IsWxVersionMatched(version)) {
|
||||
LOG_ERROR("不支持当前版本");
|
||||
MessageBox(NULL, L"不支持当前版本", L"错误", 0);
|
||||
return;
|
||||
|
@ -2,5 +2,7 @@
|
||||
|
||||
#include "framework.h"
|
||||
|
||||
#define SUPPORT_VERSION L"3.9.10.27"
|
||||
|
||||
void InitSpy(int port);
|
||||
void CleanupSpy();
|
||||
|
@ -3,190 +3,7 @@
|
||||
#include "framework.h"
|
||||
#include <string>
|
||||
|
||||
typedef struct UserInfoCall {
|
||||
DWORD wxid;
|
||||
DWORD nickName;
|
||||
DWORD mobile;
|
||||
DWORD home;
|
||||
} UserInfoCall_t;
|
||||
|
||||
typedef struct RecvMsg {
|
||||
DWORD hook; // Hook地址
|
||||
DWORD call; // Call地址
|
||||
DWORD msgId; // 消息ID地址
|
||||
DWORD type; // 消息类型地址
|
||||
DWORD isSelf; // 是否自己发送标志地址
|
||||
DWORD ts; // TimeStamp
|
||||
DWORD roomId; // 群聊时,为群ID;私聊时,为微信ID
|
||||
DWORD content; // 消息内容地址
|
||||
DWORD wxid; // 私聊时,为空;群聊时,为发送者微信ID
|
||||
DWORD sign; // Sign
|
||||
DWORD thumb; // 缩略图
|
||||
DWORD extra; // 附加数据
|
||||
DWORD msgXml; // 消息xml内容地址
|
||||
} RecvMsg_t;
|
||||
|
||||
typedef struct SendText {
|
||||
DWORD call1;
|
||||
DWORD call2;
|
||||
DWORD call3;
|
||||
} SendText_t;
|
||||
|
||||
typedef struct Sendfile {
|
||||
DWORD call1;
|
||||
DWORD call2;
|
||||
DWORD call3;
|
||||
DWORD call4;
|
||||
} Sendfile_t;
|
||||
|
||||
typedef struct Contact {
|
||||
DWORD base;
|
||||
DWORD head;
|
||||
DWORD wxId;
|
||||
DWORD wxCode;
|
||||
DWORD wxRemark;
|
||||
DWORD wxName;
|
||||
DWORD wxGender;
|
||||
DWORD wxCountry;
|
||||
DWORD wxProvince;
|
||||
DWORD wxCity;
|
||||
} Contact_t;
|
||||
|
||||
typedef struct Sql {
|
||||
DWORD exec;
|
||||
DWORD base;
|
||||
DWORD start;
|
||||
DWORD end;
|
||||
DWORD slot;
|
||||
DWORD name;
|
||||
} Sql_t;
|
||||
|
||||
typedef struct NewFriend {
|
||||
DWORD call1;
|
||||
DWORD call2;
|
||||
DWORD call3;
|
||||
DWORD call4;
|
||||
} NewFriend_t;
|
||||
|
||||
typedef struct RoomMember {
|
||||
DWORD call1;
|
||||
DWORD call2;
|
||||
DWORD call3;
|
||||
} RoomMember_t;
|
||||
|
||||
typedef struct Xml {
|
||||
DWORD call1;
|
||||
DWORD call2;
|
||||
DWORD call3;
|
||||
DWORD call4;
|
||||
DWORD param;
|
||||
} Xml_t;
|
||||
|
||||
typedef struct TF {
|
||||
DWORD call1;
|
||||
DWORD call2;
|
||||
DWORD call3;
|
||||
} TF_t;
|
||||
|
||||
typedef struct Pyq {
|
||||
DWORD hook;
|
||||
DWORD call;
|
||||
DWORD call1;
|
||||
DWORD call2;
|
||||
DWORD call3;
|
||||
DWORD start;
|
||||
DWORD end;
|
||||
DWORD ts;
|
||||
DWORD wxid;
|
||||
DWORD content;
|
||||
DWORD xml;
|
||||
DWORD step;
|
||||
} Pyq_t;
|
||||
|
||||
typedef struct DlAttach {
|
||||
DWORD call1;
|
||||
DWORD call2;
|
||||
DWORD call3;
|
||||
DWORD call4;
|
||||
DWORD call5;
|
||||
DWORD call6;
|
||||
} DlAttach_t;
|
||||
|
||||
typedef struct RevokeMsg {
|
||||
DWORD call1;
|
||||
DWORD call2;
|
||||
DWORD call3;
|
||||
DWORD call4;
|
||||
DWORD call5;
|
||||
} RevokeMsg_t;
|
||||
|
||||
typedef struct CallRichText {
|
||||
DWORD call1;
|
||||
DWORD call2;
|
||||
DWORD call3;
|
||||
DWORD call4;
|
||||
DWORD call5;
|
||||
} CallRichText_t;
|
||||
|
||||
typedef struct CallPatMsg {
|
||||
DWORD call1;
|
||||
DWORD call2;
|
||||
DWORD call3;
|
||||
} CallPatMsg_t;
|
||||
|
||||
typedef struct CallInviteCM {
|
||||
DWORD call1;
|
||||
DWORD call2;
|
||||
DWORD call3;
|
||||
DWORD call4;
|
||||
DWORD call5;
|
||||
DWORD call6;
|
||||
DWORD call7;
|
||||
DWORD call8;
|
||||
} CallInviteCM_t;
|
||||
|
||||
typedef struct CallOcr {
|
||||
DWORD call1;
|
||||
DWORD call2;
|
||||
DWORD call3;
|
||||
} CallOcr_t;
|
||||
|
||||
typedef struct CallFm {
|
||||
DWORD call1;
|
||||
DWORD call2;
|
||||
} CallFm_t;
|
||||
|
||||
typedef struct CallRfLoginQr {
|
||||
DWORD call1;
|
||||
DWORD call2;
|
||||
DWORD url;
|
||||
} CallRfLoginQr_t;
|
||||
|
||||
typedef struct WxCalls {
|
||||
DWORD login; // 登录状态
|
||||
UserInfoCall_t ui; // 用户信息
|
||||
SendText_t sendText; // 发送消息
|
||||
RecvMsg_t recvMsg; // 接收消息
|
||||
Sendfile_t sendImg; // 发送图片
|
||||
Sendfile_t sendFile; // 发送文件
|
||||
Xml_t sendXml; // 发送XML
|
||||
Sendfile_t sendEmo; // 发送表情
|
||||
Contact_t contact; // 获取联系人
|
||||
Sql_t sql; // 执行 SQL
|
||||
NewFriend_t anf; // 通过好友申请
|
||||
RoomMember_t arm; // 添加群成员
|
||||
RoomMember_t drm; // 删除群成员
|
||||
TF_t tf; // 接收转账
|
||||
Pyq_t pyq; // 接收朋友圈消息
|
||||
DlAttach_t da; // 下载资源(图片、文件、视频)
|
||||
RevokeMsg_t rm; // 撤回消息
|
||||
CallRichText_t rt; // 发送消息卡片
|
||||
CallPatMsg_t pm; // 发送拍一拍消息
|
||||
CallInviteCM_t irm; // 邀请群成员
|
||||
CallOcr_t ocr; // OCR
|
||||
CallFm_t fm; // 转发消息
|
||||
CallRfLoginQr_t rlq; // 刷新登录二维码
|
||||
} WxCalls_t;
|
||||
typedef uint64_t QWORD;
|
||||
|
||||
struct WxString {
|
||||
const wchar_t *wptr;
|
||||
@ -214,7 +31,10 @@ struct WxString {
|
||||
};
|
||||
|
||||
typedef struct RawVector {
|
||||
DWORD start;
|
||||
DWORD finish;
|
||||
DWORD end;
|
||||
#ifdef _DEBUG
|
||||
QWORD head;
|
||||
#endif
|
||||
QWORD start;
|
||||
QWORD finish;
|
||||
QWORD end;
|
||||
} RawVector_t;
|
||||
|
@ -1,7 +1,9 @@
|
||||
#pragma once
|
||||
#pragma once
|
||||
|
||||
#include "Windows.h"
|
||||
|
||||
#include "spy_types.h"
|
||||
|
||||
#define SQLITE_OK 0 /* Successful result */
|
||||
|
||||
/* beginning-of-error-codes */
|
||||
@ -136,9 +138,9 @@
|
||||
#define SQLITE_NULL 5
|
||||
#define SQLITE_TEXT 3
|
||||
|
||||
#define SQLITE3_EXEC_OFFSET 0x1E24F70
|
||||
#define SQLITE3_EXEC_OFFSET 0x3AFBCE0
|
||||
#define SQLITE3_BACKUP_INIT_OFFSET 0x1DEA900
|
||||
#define SQLITE3_PREPARE_OFFSET 0x1E2B8C0
|
||||
#define SQLITE3_PREPARE_OFFSET 0x3B03990
|
||||
#define SQLITE3_OPEN_OFFSET 0x1E598B0
|
||||
#define SQLITE3_BACKUP_STEP_OFFSET 0x1DEAD00
|
||||
#define SQLITE3_BACKUP_REMAINING_OFFSET 0x1DEB440
|
||||
@ -147,46 +149,46 @@
|
||||
#define SQLITE3_SLEEP_OFFSET 0x1E5A0F0
|
||||
#define SQLITE3_ERRCODE_OFFSET 0x1E58550
|
||||
#define SQLITE3_CLOSE_OFFSET 0x1E56CD0
|
||||
#define SQLITE3_STEP_OFFSET 0x1DF3770
|
||||
#define SQLITE3_COLUMN_COUNT_OFFSET 0x1DF3C80
|
||||
#define SQLITE3_COLUMN_NAME_OFFSET 0x1DF4570
|
||||
#define SQLITE3_COLUMN_TYPE_OFFSET 0x1DF4410
|
||||
#define SQLITE3_COLUMN_BLOB_OFFSET 0x1DF3CC0
|
||||
#define SQLITE3_COLUMN_BYTES_OFFSET 0x1DF3DA0
|
||||
#define SQLITE3_FINALIZE_OFFSET 0x1DF2740
|
||||
#define SQLITE3_STEP_OFFSET 0x3ABFCE0
|
||||
#define SQLITE3_COLUMN_COUNT_OFFSET 0x3AC0500
|
||||
#define SQLITE3_COLUMN_NAME_OFFSET 0x3AC0F00
|
||||
#define SQLITE3_COLUMN_TYPE_OFFSET 0x3AC0D50
|
||||
#define SQLITE3_COLUMN_BLOB_OFFSET 0x3AC0530
|
||||
#define SQLITE3_COLUMN_BYTES_OFFSET 0x3AC0620
|
||||
#define SQLITE3_FINALIZE_OFFSET 0x3ABED90
|
||||
|
||||
typedef int (*Sqlite3_callback)(void *, int, char **, char **);
|
||||
|
||||
typedef int(__cdecl *Sqlite3_exec)(DWORD, /* An open database */
|
||||
typedef int(__cdecl *Sqlite3_exec)(QWORD, /* An open database */
|
||||
const char *sql, /* SQL to be evaluated */
|
||||
Sqlite3_callback, /* Callback function */
|
||||
void *, /* 1st argument to callback */
|
||||
char **errmsg /* Error msg written here */
|
||||
);
|
||||
typedef DWORD(__cdecl *Sqlite3_backup_init)(DWORD *pDest, /* Destination database handle */
|
||||
typedef QWORD(__cdecl *Sqlite3_backup_init)(QWORD *pDest, /* Destination database handle */
|
||||
const char *zDestName, /* Destination database name */
|
||||
DWORD *pSource, /* Source database handle */
|
||||
QWORD *pSource, /* Source database handle */
|
||||
const char *zSourceName /* Source database name */
|
||||
);
|
||||
typedef int(__cdecl *Sqlite3_prepare)(DWORD db, /* Database handle */
|
||||
typedef int(__cdecl *Sqlite3_prepare)(QWORD db, /* Database handle */
|
||||
const char *zSql, /* SQL statement, UTF-8 encoded */
|
||||
int nByte, /* Maximum length of zSql in bytes. */
|
||||
DWORD **ppStmt, /* OUT: Statement handle */
|
||||
QWORD **ppStmt, /* OUT: Statement handle */
|
||||
const char **pzTail /* OUT: Pointer to unused portion of zSql */
|
||||
);
|
||||
typedef int(__cdecl *Sqlite3_open)(const char *filename, DWORD **ppDb);
|
||||
typedef int(__cdecl *Sqlite3_backup_step)(DWORD *p, int nPage);
|
||||
typedef int(__cdecl *Sqlite3_backup_remaining)(DWORD *p);
|
||||
typedef int(__cdecl *Sqlite3_backup_pagecount)(DWORD *p);
|
||||
typedef int(__cdecl *Sqlite3_backup_finish)(DWORD *p);
|
||||
typedef int(__cdecl *Sqlite3_open)(const char *filename, QWORD **ppDb);
|
||||
typedef int(__cdecl *Sqlite3_backup_step)(QWORD *p, int nPage);
|
||||
typedef int(__cdecl *Sqlite3_backup_remaining)(QWORD *p);
|
||||
typedef int(__cdecl *Sqlite3_backup_pagecount)(QWORD *p);
|
||||
typedef int(__cdecl *Sqlite3_backup_finish)(QWORD *p);
|
||||
typedef int(__cdecl *Sqlite3_sleep)(int);
|
||||
typedef int(__cdecl *Sqlite3_errcode)(DWORD *db);
|
||||
typedef int(__cdecl *Sqlite3_close)(DWORD *);
|
||||
typedef int(__cdecl *Sqlite3_errcode)(QWORD *db);
|
||||
typedef int(__cdecl *Sqlite3_close)(QWORD *);
|
||||
|
||||
typedef int(__cdecl *Sqlite3_step)(DWORD *);
|
||||
typedef int(__cdecl *Sqlite3_column_count)(DWORD *pStmt);
|
||||
typedef const char *(__cdecl *Sqlite3_column_name)(DWORD *, int N);
|
||||
typedef int(__cdecl *Sqlite3_column_type)(DWORD *, int iCol);
|
||||
typedef const void *(__cdecl *Sqlite3_column_blob)(DWORD *, int iCol);
|
||||
typedef int(__cdecl *Sqlite3_column_bytes)(DWORD *, int iCol);
|
||||
typedef int(__cdecl *Sqlite3_finalize)(DWORD *pStmt);
|
||||
typedef int(__cdecl *Sqlite3_step)(QWORD *);
|
||||
typedef int(__cdecl *Sqlite3_column_count)(QWORD *pStmt);
|
||||
typedef const char *(__cdecl *Sqlite3_column_name)(QWORD *, int N);
|
||||
typedef int(__cdecl *Sqlite3_column_type)(QWORD *, int iCol);
|
||||
typedef const void *(__cdecl *Sqlite3_column_blob)(QWORD *, int iCol);
|
||||
typedef int(__cdecl *Sqlite3_column_bytes)(QWORD *, int iCol);
|
||||
typedef int(__cdecl *Sqlite3_finalize)(QWORD *pStmt);
|
||||
|
@ -1,17 +1,20 @@
|
||||
#include "user_info.h"
|
||||
#include "load_calls.h"
|
||||
#include "log.h"
|
||||
#include "util.h"
|
||||
|
||||
extern WxCalls_t g_WxCalls;
|
||||
extern UINT64 g_WeChatWinDllAddr;
|
||||
|
||||
#define OS_USER_HOME 0x5A7E190
|
||||
#define OS_USER_WXID 0x5AB7FB8
|
||||
#define OS_USER_NAME 0x5AB8098
|
||||
#define OS_USER_MOBILE 0x5AB7FD8
|
||||
|
||||
static char home[MAX_PATH] = { 0 };
|
||||
|
||||
string GetHomePath()
|
||||
{
|
||||
if (home[0] == 0) {
|
||||
string path = Wstring2String(GET_WSTRING(g_WeChatWinDllAddr + g_WxCalls.ui.home)) + "\\WeChat Files\\";
|
||||
string path = Wstring2String(GET_WSTRING(g_WeChatWinDllAddr + OS_USER_HOME)) + "\\WeChat Files\\";
|
||||
strncpy_s(home, path.c_str(), path.size());
|
||||
}
|
||||
|
||||
@ -22,15 +25,15 @@ string GetSelfWxid()
|
||||
{
|
||||
UINT64 wxidType = 0;
|
||||
try {
|
||||
wxidType = GET_UINT64(g_WeChatWinDllAddr + g_WxCalls.ui.wxid + 0x18);
|
||||
wxidType = GET_UINT64(g_WeChatWinDllAddr + OS_USER_WXID + 0x18);
|
||||
if (wxidType == 0xF) {
|
||||
return GET_STRING_FROM_P(g_WeChatWinDllAddr + g_WxCalls.ui.wxid);
|
||||
return GET_STRING_FROM_P(g_WeChatWinDllAddr + OS_USER_WXID);
|
||||
} else {
|
||||
return GET_STRING(g_WeChatWinDllAddr + g_WxCalls.ui.wxid);
|
||||
return GET_STRING(g_WeChatWinDllAddr + OS_USER_WXID);
|
||||
}
|
||||
} catch (...) {
|
||||
LOG_ERROR("wxid type: {:#x}", wxidType);
|
||||
LOG_BUFFER((uint8_t *)(g_WeChatWinDllAddr + g_WxCalls.ui.wxid), 20);
|
||||
LOG_BUFFER((uint8_t *)(g_WeChatWinDllAddr + OS_USER_WXID), 20);
|
||||
return "empty_wxid";
|
||||
}
|
||||
}
|
||||
@ -41,14 +44,14 @@ UserInfo_t GetUserInfo()
|
||||
|
||||
ui.wxid = GetSelfWxid();
|
||||
|
||||
UINT64 nameType = GET_UINT64(g_WeChatWinDllAddr + g_WxCalls.ui.nickName + 0x18);
|
||||
UINT64 nameType = GET_UINT64(g_WeChatWinDllAddr + OS_USER_NAME + 0x18);
|
||||
if (nameType == 0xF) {
|
||||
ui.name = GET_STRING_FROM_P(g_WeChatWinDllAddr + g_WxCalls.ui.nickName);
|
||||
ui.name = GET_STRING_FROM_P(g_WeChatWinDllAddr + OS_USER_NAME);
|
||||
} else { // 0x1F
|
||||
ui.name = GET_STRING(g_WeChatWinDllAddr + g_WxCalls.ui.nickName);
|
||||
ui.name = GET_STRING(g_WeChatWinDllAddr + OS_USER_NAME);
|
||||
}
|
||||
|
||||
ui.mobile = GET_STRING_FROM_P(g_WeChatWinDllAddr + g_WxCalls.ui.mobile);
|
||||
ui.mobile = GET_STRING_FROM_P(g_WeChatWinDllAddr + OS_USER_MOBILE);
|
||||
ui.home = GetHomePath();
|
||||
|
||||
return ui;
|
||||
|
16
clients/go_wcf_http/README.MD
vendored
Normal file
16
clients/go_wcf_http/README.MD
vendored
Normal file
@ -0,0 +1,16 @@
|
||||
# wechatFerry 的 go版本http端
|
||||
|
||||
接口文档:https://apifox.com/apidoc/shared-6e6950ec-1a6d-4545-90d6-d27d31af2b7c
|
||||
|
||||
http服务器的端口是 8000 需要修改的自行编译懒得写配置文件
|
||||
localhost:8000是本地接口文档
|
||||
|
||||
由于用到了cgo 编译需要安装Mingw
|
||||
Mingw下载地址:https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/mingw-builds/8.1.0/threads-win32/sjlj/x86_64-8.1.0-release-win32-sjlj-rt_v6-rev0.7z/download
|
||||
|
||||
打包命令
|
||||
|
||||
#x86 win 编译
|
||||
set GOOS=windows
|
||||
set GOARCH=amd64
|
||||
go build -ldflags="-s -w" -o go_wcf_http3.9.10.27.exe .\main.go
|
450
clients/go_wcf_http/app/api.go
vendored
Normal file
450
clients/go_wcf_http/app/api.go
vendored
Normal file
@ -0,0 +1,450 @@
|
||||
package app
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/gin-gonic/gin"
|
||||
"net/http"
|
||||
)
|
||||
|
||||
type Result struct {
|
||||
Code int `json:"code"`
|
||||
Message string `json:"message"`
|
||||
Data interface{} `json:"data"`
|
||||
}
|
||||
|
||||
// SetMessageCallbackUrl 设置消息回调地址
|
||||
func SetMessageCallbackUrl(c *gin.Context) {
|
||||
var result Result
|
||||
var RequestData struct {
|
||||
CallbackUrl string `json:"callback_url"`
|
||||
}
|
||||
if err := c.BindJSON(&RequestData); err != nil {
|
||||
result.Code = 0
|
||||
result.Message = "json解析失败"
|
||||
var data = make(map[string]interface{})
|
||||
result.Data = data
|
||||
c.JSON(http.StatusOK, result)
|
||||
return
|
||||
}
|
||||
result.Code = 1
|
||||
result.Message = "回调url设置成功"
|
||||
var data = map[string]string{"callback_url": RequestData.CallbackUrl}
|
||||
result.Data = data
|
||||
WxClient.MessageCallbackUrl = RequestData.CallbackUrl
|
||||
c.JSON(http.StatusOK, result)
|
||||
}
|
||||
|
||||
// GetSelfWXID 获取登录者的wxid
|
||||
func GetSelfWXID(c *gin.Context) {
|
||||
var result Result
|
||||
wxId := WxClient.GetSelfWXID()
|
||||
if wxId == "" {
|
||||
result.Code = 0
|
||||
result.Message = "获取登录者的wx_id失败"
|
||||
var data = map[string]string{"wx_id": wxId}
|
||||
result.Data = data
|
||||
c.JSON(http.StatusOK, result)
|
||||
return
|
||||
}
|
||||
result.Code = 1
|
||||
result.Message = "获取登录者的wx_id成功"
|
||||
var data = map[string]string{"wx_id": wxId}
|
||||
result.Data = data
|
||||
c.JSON(http.StatusOK, result)
|
||||
}
|
||||
|
||||
// GetUserInfo 获取自己的信息
|
||||
func GetUserInfo(c *gin.Context) {
|
||||
var result Result
|
||||
result.Code = 1
|
||||
result.Message = "获取个人信息成功"
|
||||
result.Data = WxClient.GetUserInfo()
|
||||
c.JSON(http.StatusOK, result)
|
||||
}
|
||||
|
||||
// GetMsgTypes 获取消息类型列表
|
||||
func GetMsgTypes(c *gin.Context) {
|
||||
var result Result
|
||||
result.Code = 1
|
||||
result.Message = "获取消息类型列表成功"
|
||||
result.Data = WxClient.GetMsgTypes()
|
||||
c.JSON(http.StatusOK, result)
|
||||
}
|
||||
|
||||
// GetContacts 获取通讯录
|
||||
func GetContacts(c *gin.Context) {
|
||||
var result Result
|
||||
// 此处手动修改了wcf.pd.go文件 原文件为json字段为空时不返回 如有需要可以自行补上, omitempty
|
||||
result.Code = 1
|
||||
result.Message = "获取通讯录成功"
|
||||
result.Data = WxClient.GetContacts()
|
||||
c.JSON(http.StatusOK, result)
|
||||
}
|
||||
|
||||
// GetRoomMembersAll 获取全部群的群成员
|
||||
func GetRoomMembersAll(c *gin.Context) {
|
||||
var result Result
|
||||
var RoomMemberList = make(map[string]string)
|
||||
contacts := WxClient.ExecDBQuery("MicroMsg.db", "SELECT UserName, NickName FROM Contact;")
|
||||
for _, v := range contacts {
|
||||
RoomMemberList[string(v.GetFields()[0].Content)] = string(v.GetFields()[1].Content)
|
||||
}
|
||||
result.Code = 1
|
||||
result.Message = "获取全部数据成功"
|
||||
result.Data = RoomMemberList
|
||||
c.JSON(http.StatusOK, result)
|
||||
}
|
||||
|
||||
// GetRoomMember 获取指定群成员
|
||||
func GetRoomMember(c *gin.Context) {
|
||||
var result Result
|
||||
var RequestData struct {
|
||||
RoomId string `json:"room_id"`
|
||||
}
|
||||
if err := c.BindJSON(&RequestData); err != nil {
|
||||
result.Code = 0
|
||||
result.Message = "json解析失败"
|
||||
var data = make(map[string]interface{})
|
||||
result.Data = data
|
||||
c.JSON(http.StatusOK, result)
|
||||
return
|
||||
}
|
||||
contacts := WxClient.ExecDBQuery("MicroMsg.db", "SELECT RoomData FROM ChatRoom WHERE ChatRoomName = '"+RequestData.RoomId+"';")
|
||||
for _, v := range contacts {
|
||||
fmt.Print(v.GetFields()[0].Content)
|
||||
}
|
||||
}
|
||||
|
||||
// GetDBNames 获取全部的数据库
|
||||
func GetDBNames(c *gin.Context) {
|
||||
var result Result
|
||||
// 此处手动修改了wcf.pd.go文件 原文件为json字段为空时不返回 如有需要可以自行补上, omitempty
|
||||
result.Code = 1
|
||||
result.Message = "获取全部的数据库成功"
|
||||
result.Data = WxClient.GetDBNames()
|
||||
c.JSON(http.StatusOK, result)
|
||||
}
|
||||
|
||||
// GetDBTables 获取表
|
||||
func GetDBTables(c *gin.Context) {
|
||||
var result Result
|
||||
var RequestData struct {
|
||||
DbName string `json:"db_name"`
|
||||
}
|
||||
if err := c.BindJSON(&RequestData); err != nil {
|
||||
result.Code = 0
|
||||
result.Message = "json解析失败"
|
||||
var data = make(map[string]interface{})
|
||||
result.Data = data
|
||||
c.JSON(http.StatusOK, result)
|
||||
return
|
||||
}
|
||||
result.Code = 1
|
||||
result.Message = "获取成功"
|
||||
result.Data = WxClient.GetDBTables(RequestData.DbName)
|
||||
c.JSON(http.StatusOK, result)
|
||||
}
|
||||
|
||||
// ExecDBQuery 执行sql
|
||||
func ExecDBQuery(c *gin.Context) {
|
||||
var result Result
|
||||
var RequestData struct {
|
||||
Db string `json:"db"`
|
||||
Sql string `json:"sql"`
|
||||
}
|
||||
if err := c.BindJSON(&RequestData); err != nil {
|
||||
result.Code = 0
|
||||
result.Message = "json解析失败"
|
||||
var data = make(map[string]interface{})
|
||||
result.Data = data
|
||||
c.JSON(http.StatusOK, result)
|
||||
return
|
||||
}
|
||||
result.Code = 1
|
||||
result.Message = "获取成功"
|
||||
var data = WxClient.ExecDBQuery(RequestData.Db, RequestData.Sql)
|
||||
result.Data = data
|
||||
c.JSON(http.StatusOK, result)
|
||||
}
|
||||
|
||||
// SendTxt 发送文本内容
|
||||
func SendTxt(c *gin.Context) {
|
||||
var result Result
|
||||
var RequestData struct {
|
||||
Msg string `json:"msg"`
|
||||
Receiver string `json:"receiver"`
|
||||
Ates []string `json:"ates"`
|
||||
}
|
||||
if err := c.BindJSON(&RequestData); err != nil {
|
||||
result.Code = 0
|
||||
result.Message = "json解析失败"
|
||||
var data = make(map[string]interface{})
|
||||
result.Data = data
|
||||
c.JSON(http.StatusOK, result)
|
||||
return
|
||||
}
|
||||
result.Code = 1
|
||||
result.Message = "发送完成"
|
||||
var data = WxClient.SendTxt(RequestData.Msg, RequestData.Receiver, RequestData.Ates)
|
||||
result.Data = data
|
||||
c.JSON(http.StatusOK, result)
|
||||
}
|
||||
|
||||
// SendIMG 发送图片
|
||||
func SendIMG(c *gin.Context) {
|
||||
var result Result
|
||||
var RequestData struct {
|
||||
Path string `json:"path"`
|
||||
Receiver string `json:"receiver"`
|
||||
}
|
||||
if err := c.BindJSON(&RequestData); err != nil {
|
||||
result.Code = 0
|
||||
result.Message = "json解析失败"
|
||||
var data = make(map[string]interface{})
|
||||
result.Data = data
|
||||
c.JSON(http.StatusOK, result)
|
||||
return
|
||||
}
|
||||
result.Code = 1
|
||||
result.Message = "发送完成"
|
||||
var data = WxClient.SendIMG(RequestData.Path, RequestData.Receiver)
|
||||
result.Data = data
|
||||
c.JSON(http.StatusOK, result)
|
||||
}
|
||||
|
||||
// SendFile 发送文件
|
||||
func SendFile(c *gin.Context) {
|
||||
var result Result
|
||||
var RequestData struct {
|
||||
Path string `json:"path"`
|
||||
Receiver string `json:"receiver"`
|
||||
}
|
||||
if err := c.BindJSON(&RequestData); err != nil {
|
||||
result.Code = 0
|
||||
result.Message = "json解析失败"
|
||||
var data = make(map[string]interface{})
|
||||
result.Data = data
|
||||
c.JSON(http.StatusOK, result)
|
||||
return
|
||||
}
|
||||
result.Code = 1
|
||||
result.Message = "发送完成"
|
||||
var data = WxClient.SendFile(RequestData.Path, RequestData.Receiver)
|
||||
result.Data = data
|
||||
c.JSON(http.StatusOK, result)
|
||||
}
|
||||
|
||||
// SendRichText 发送卡片消息
|
||||
func SendRichText(c *gin.Context) {
|
||||
var result Result
|
||||
var RequestData struct {
|
||||
Name string `json:"name"`
|
||||
Account string `json:"account"`
|
||||
Title string `json:"title"`
|
||||
Digest string `json:"digest"`
|
||||
Url string `json:"url"`
|
||||
ThumbUrl string `json:"thumb_url"`
|
||||
Receiver string `json:"receiver"`
|
||||
}
|
||||
if err := c.BindJSON(&RequestData); err != nil {
|
||||
result.Code = 0
|
||||
result.Message = "json解析失败"
|
||||
var data = make(map[string]interface{})
|
||||
result.Data = data
|
||||
c.JSON(http.StatusOK, result)
|
||||
return
|
||||
}
|
||||
result.Code = 1
|
||||
result.Message = "发送完成"
|
||||
var data = WxClient.SendRichText(RequestData.Name, RequestData.Account, RequestData.Title, RequestData.Digest, RequestData.Url, RequestData.ThumbUrl, RequestData.Receiver)
|
||||
result.Data = data
|
||||
c.JSON(http.StatusOK, result)
|
||||
}
|
||||
|
||||
// SendPat 发送拍一拍消息
|
||||
func SendPat(c *gin.Context) {
|
||||
var result Result
|
||||
var RequestData struct {
|
||||
RoomId string `json:"room_id"`
|
||||
WxId string `json:"wx_id"`
|
||||
}
|
||||
if err := c.BindJSON(&RequestData); err != nil {
|
||||
result.Code = 0
|
||||
result.Message = "json解析失败"
|
||||
var data = make(map[string]interface{})
|
||||
result.Data = data
|
||||
c.JSON(http.StatusOK, result)
|
||||
return
|
||||
}
|
||||
result.Code = 1
|
||||
result.Message = "发送完成"
|
||||
var data = WxClient.SendPat(RequestData.RoomId, RequestData.WxId)
|
||||
result.Data = data
|
||||
c.JSON(http.StatusOK, result)
|
||||
}
|
||||
|
||||
// ForwardMsg 发送拍一拍消息
|
||||
func ForwardMsg(c *gin.Context) {
|
||||
var result Result
|
||||
var RequestData struct {
|
||||
Id uint64 `json:"id"`
|
||||
Receiver string `json:"receiver"`
|
||||
}
|
||||
if err := c.BindJSON(&RequestData); err != nil {
|
||||
result.Code = 0
|
||||
result.Message = "json解析失败"
|
||||
var data = make(map[string]interface{})
|
||||
result.Data = data
|
||||
c.JSON(http.StatusOK, result)
|
||||
return
|
||||
}
|
||||
result.Code = 1
|
||||
result.Message = "转发完成"
|
||||
var data = WxClient.ForwardMsg(RequestData.Id, RequestData.Receiver)
|
||||
result.Data = data
|
||||
c.JSON(http.StatusOK, result)
|
||||
}
|
||||
|
||||
// SendEmotion 发送gif
|
||||
func SendEmotion(c *gin.Context) {
|
||||
var result Result
|
||||
var RequestData struct {
|
||||
Path string `json:"path"`
|
||||
Receiver string `json:"receiver"`
|
||||
}
|
||||
if err := c.BindJSON(&RequestData); err != nil {
|
||||
result.Code = 0
|
||||
result.Message = "json解析失败"
|
||||
var data = make(map[string]interface{})
|
||||
result.Data = data
|
||||
c.JSON(http.StatusOK, result)
|
||||
return
|
||||
}
|
||||
result.Code = 1
|
||||
result.Message = "发送完成"
|
||||
var data = WxClient.SendEmotion(RequestData.Path, RequestData.Receiver)
|
||||
result.Data = data
|
||||
c.JSON(http.StatusOK, result)
|
||||
}
|
||||
|
||||
// AcceptFriend 接受好友请求
|
||||
func AcceptFriend(c *gin.Context) {
|
||||
var result Result
|
||||
var RequestData struct {
|
||||
V3 string `json:"v3"`
|
||||
V4 string `json:"v4"`
|
||||
Scene int32 `json:"scene"`
|
||||
}
|
||||
if err := c.BindJSON(&RequestData); err != nil {
|
||||
result.Code = 0
|
||||
result.Message = "json解析失败"
|
||||
var data = make(map[string]interface{})
|
||||
result.Data = data
|
||||
c.JSON(http.StatusOK, result)
|
||||
return
|
||||
}
|
||||
result.Code = 1
|
||||
result.Message = "接收成功"
|
||||
var data = WxClient.AcceptFriend(RequestData.V3, RequestData.V4, RequestData.Scene)
|
||||
result.Data = data
|
||||
c.JSON(http.StatusOK, result)
|
||||
}
|
||||
|
||||
// AddChatroomMembers 添加群成员
|
||||
func AddChatroomMembers(c *gin.Context) {
|
||||
var result Result
|
||||
var RequestData struct {
|
||||
RoomId string `json:"room_id"`
|
||||
WxId []string `json:"wx_ids"`
|
||||
}
|
||||
if err := c.BindJSON(&RequestData); err != nil {
|
||||
result.Code = 0
|
||||
result.Message = "json解析失败"
|
||||
var data = make(map[string]interface{})
|
||||
result.Data = data
|
||||
c.JSON(http.StatusOK, result)
|
||||
return
|
||||
}
|
||||
result.Code = 1
|
||||
result.Message = "发送完成"
|
||||
var data = WxClient.AddChatRoomMembers(RequestData.RoomId, RequestData.WxId)
|
||||
result.Data = data
|
||||
c.JSON(http.StatusOK, result)
|
||||
}
|
||||
|
||||
// DelChatRoomMembers 添加群成员
|
||||
func DelChatRoomMembers(c *gin.Context) {
|
||||
var result Result
|
||||
var RequestData struct {
|
||||
RoomId string `json:"room_id"`
|
||||
WxId []string `json:"wx_ids"`
|
||||
}
|
||||
if err := c.BindJSON(&RequestData); err != nil {
|
||||
result.Code = 0
|
||||
result.Message = "json解析失败"
|
||||
var data = make(map[string]interface{})
|
||||
result.Data = data
|
||||
c.JSON(http.StatusOK, result)
|
||||
return
|
||||
}
|
||||
result.Code = 1
|
||||
result.Message = "发送完成"
|
||||
var data = WxClient.DelChatRoomMembers(RequestData.RoomId, RequestData.WxId)
|
||||
result.Data = data
|
||||
c.JSON(http.StatusOK, result)
|
||||
}
|
||||
|
||||
// InvChatRoomMembers 邀请群成员
|
||||
func InvChatRoomMembers(c *gin.Context) {
|
||||
var result Result
|
||||
var RequestData struct {
|
||||
RoomId string `json:"room_id"`
|
||||
WxId []string `json:"wx_ids"`
|
||||
}
|
||||
if err := c.BindJSON(&RequestData); err != nil {
|
||||
result.Code = 0
|
||||
result.Message = "json解析失败"
|
||||
var data = make(map[string]interface{})
|
||||
result.Data = data
|
||||
c.JSON(http.StatusOK, result)
|
||||
return
|
||||
}
|
||||
result.Code = 1
|
||||
result.Message = "发送完成"
|
||||
var data = WxClient.InvChatRoomMembers(RequestData.RoomId, RequestData.WxId)
|
||||
result.Data = data
|
||||
c.JSON(http.StatusOK, result)
|
||||
}
|
||||
|
||||
// RefreshPyq 刷新朋友圈
|
||||
func RefreshPyq(c *gin.Context) {
|
||||
var result Result
|
||||
result.Code = 1
|
||||
result.Message = "发送完成"
|
||||
var data = WxClient.RefreshPYQ()
|
||||
result.Data = data
|
||||
c.JSON(http.StatusOK, result)
|
||||
}
|
||||
|
||||
// DownloadAttach 下载附件
|
||||
func DownloadAttach(c *gin.Context) {
|
||||
var result Result
|
||||
var RequestData struct {
|
||||
Id uint64 `json:"id"`
|
||||
Thumb string `json:"thumb"`
|
||||
Extra string `json:"extra"`
|
||||
}
|
||||
if err := c.BindJSON(&RequestData); err != nil {
|
||||
result.Code = 0
|
||||
result.Message = "json解析失败"
|
||||
var data = make(map[string]interface{})
|
||||
result.Data = data
|
||||
c.JSON(http.StatusOK, result)
|
||||
return
|
||||
}
|
||||
result.Code = 1
|
||||
result.Message = "下载附件调用成功"
|
||||
var data = WxClient.DownloadAttach(RequestData.Id, RequestData.Thumb, RequestData.Extra)
|
||||
result.Data = data
|
||||
c.JSON(http.StatusOK, result)
|
||||
}
|
88
clients/go_wcf_http/app/robot.go
vendored
Normal file
88
clients/go_wcf_http/app/robot.go
vendored
Normal file
@ -0,0 +1,88 @@
|
||||
package app
|
||||
|
||||
/*
|
||||
#cgo LDFLAGS: -L../ -lsdk
|
||||
#include <stdlib.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
extern int WxInitSDK(bool, int);
|
||||
extern int WxDestroySDK();
|
||||
*/
|
||||
import "C"
|
||||
import (
|
||||
"fmt"
|
||||
"go_wechatFerry/wcf"
|
||||
"time"
|
||||
)
|
||||
|
||||
var WxClient *wcf.Client
|
||||
|
||||
// Message 组装成一个结构体展示消息
|
||||
type Message struct {
|
||||
IsGroup bool `json:"is_group,omitempty"`
|
||||
MessageId uint64 `json:"message_id,omitempty"`
|
||||
Type uint32 `json:"type,omitempty"`
|
||||
Ts uint32 `json:"ts,omitempty"`
|
||||
RoomId string `json:"room_id,omitempty"`
|
||||
Content string `json:"content,omitempty"`
|
||||
WxId string `json:"wx_id,omitempty"`
|
||||
Sign string `json:"sign,omitempty"`
|
||||
Xml string `json:"xml,omitempty"`
|
||||
}
|
||||
|
||||
// WechatFerryInit 调用sdk.dll中的WxInitSdk 进行启动微信并注入
|
||||
func WechatFerryInit() {
|
||||
|
||||
// 调试模式 端口
|
||||
initSuccess := C.WxInitSDK(C.bool(false), C.int(10086))
|
||||
if initSuccess == 0 {
|
||||
fmt.Println("SDK 初始化成功")
|
||||
} else {
|
||||
fmt.Println("SDK 初始化失败")
|
||||
}
|
||||
time.Sleep(time.Millisecond * 5000)
|
||||
// 连接服务器
|
||||
client, errs := wcf.NewWCF("")
|
||||
if errs != nil {
|
||||
return
|
||||
}
|
||||
// 一定要在这里判断是否登录成功 否则会导致用户列表获取失败
|
||||
for true {
|
||||
if client.IsLogin() == true {
|
||||
fmt.Println("登录成功...等待初始化中...")
|
||||
time.Sleep(2000 * time.Millisecond)
|
||||
break
|
||||
}
|
||||
time.Sleep(1000 * time.Millisecond)
|
||||
}
|
||||
WxClient = client
|
||||
ContactsInit()
|
||||
fmt.Println("初始化完成")
|
||||
}
|
||||
|
||||
// ContactsInit 通讯录初始化
|
||||
func ContactsInit() {
|
||||
var contactsMap []map[string]string
|
||||
contacts := WxClient.GetContacts()
|
||||
for _, v := range contacts {
|
||||
gender := ""
|
||||
if v.Gender == 1 {
|
||||
gender = "男"
|
||||
}
|
||||
if v.Gender == 2 {
|
||||
gender = "女"
|
||||
}
|
||||
contactsMaps := map[string]string{
|
||||
"wxId": v.Wxid,
|
||||
"code": v.Code,
|
||||
"remark": v.Remark,
|
||||
"name": v.Name,
|
||||
"country": v.Country,
|
||||
"province": v.Province,
|
||||
"city": v.City,
|
||||
"gender": gender,
|
||||
}
|
||||
contactsMap = append(contactsMap, contactsMaps)
|
||||
}
|
||||
WxClient.ContactsMap = contactsMap
|
||||
}
|
43
clients/go_wcf_http/go.mod
vendored
Normal file
43
clients/go_wcf_http/go.mod
vendored
Normal file
@ -0,0 +1,43 @@
|
||||
module go_wechatFerry
|
||||
|
||||
go 1.21.5
|
||||
|
||||
require (
|
||||
github.com/danbai225/go-logs v0.3.2
|
||||
github.com/gin-gonic/gin v1.10.0
|
||||
github.com/go-resty/resty/v2 v2.13.1
|
||||
github.com/gorilla/websocket v1.5.0
|
||||
go.nanomsg.org/mangos/v3 v3.4.2
|
||||
google.golang.org/protobuf v1.34.2
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/Microsoft/go-winio v0.5.2 // indirect
|
||||
github.com/bytedance/sonic v1.11.6 // indirect
|
||||
github.com/bytedance/sonic/loader v0.1.1 // indirect
|
||||
github.com/cloudwego/base64x v0.1.4 // indirect
|
||||
github.com/cloudwego/iasm v0.2.0 // indirect
|
||||
github.com/gabriel-vasile/mimetype v1.4.3 // indirect
|
||||
github.com/gin-contrib/sse v0.1.0 // indirect
|
||||
github.com/go-playground/locales v0.14.1 // indirect
|
||||
github.com/go-playground/universal-translator v0.18.1 // indirect
|
||||
github.com/go-playground/validator/v10 v10.20.0 // indirect
|
||||
github.com/goccy/go-json v0.10.2 // indirect
|
||||
github.com/json-iterator/go v1.1.12 // indirect
|
||||
github.com/klauspost/cpuid/v2 v2.2.7 // indirect
|
||||
github.com/kpango/fastime v1.1.9 // indirect
|
||||
github.com/kpango/glg v1.6.15 // indirect
|
||||
github.com/leodido/go-urn v1.4.0 // indirect
|
||||
github.com/mattn/go-isatty v0.0.20 // indirect
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
|
||||
github.com/modern-go/reflect2 v1.0.2 // indirect
|
||||
github.com/pelletier/go-toml/v2 v2.2.2 // indirect
|
||||
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
|
||||
github.com/ugorji/go/codec v1.2.12 // indirect
|
||||
golang.org/x/arch v0.8.0 // indirect
|
||||
golang.org/x/crypto v0.23.0 // indirect
|
||||
golang.org/x/net v0.25.0 // indirect
|
||||
golang.org/x/sys v0.20.0 // indirect
|
||||
golang.org/x/text v0.15.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
)
|
181
clients/go_wcf_http/go.sum
vendored
Normal file
181
clients/go_wcf_http/go.sum
vendored
Normal file
@ -0,0 +1,181 @@
|
||||
github.com/Microsoft/go-winio v0.5.2 h1:a9IhgEQBCUEk6QCdml9CiJGhAws+YwffDHEMp1VMrpA=
|
||||
github.com/Microsoft/go-winio v0.5.2/go.mod h1:WpS1mjBmmwHBEWmogvA2mj8546UReBk4v8QkMxJ6pZY=
|
||||
github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=
|
||||
github.com/bytedance/sonic v1.11.6 h1:oUp34TzMlL+OY1OUWxHqsdkgC/Zfc85zGqw9siXjrc0=
|
||||
github.com/bytedance/sonic v1.11.6/go.mod h1:LysEHSvpvDySVdC2f87zGWf6CIKJcAvqab1ZaiQtds4=
|
||||
github.com/bytedance/sonic/loader v0.1.1 h1:c+e5Pt1k/cy5wMveRDyk2X4B9hF4g7an8N3zCYjJFNM=
|
||||
github.com/bytedance/sonic/loader v0.1.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU=
|
||||
github.com/cloudwego/base64x v0.1.4 h1:jwCgWpFanWmN8xoIUHa2rtzmkd5J2plF/dnLS6Xd/0Y=
|
||||
github.com/cloudwego/base64x v0.1.4/go.mod h1:0zlkT4Wn5C6NdauXdJRhSKRlJvmclQ1hhJgA0rcu/8w=
|
||||
github.com/cloudwego/iasm v0.2.0 h1:1KNIy1I1H9hNNFEEH3DVnI4UujN+1zjpuk6gwHLTssg=
|
||||
github.com/cloudwego/iasm v0.2.0/go.mod h1:8rXZaNYT2n95jn+zTI1sDr+IgcD2GVs0nlbbQPiEFhY=
|
||||
github.com/danbai225/go-logs v0.3.2 h1:CXMudhrC9rj5hb3tyZvn2APZStioB68QZauZeBPFkmU=
|
||||
github.com/danbai225/go-logs v0.3.2/go.mod h1:hHxvTTAIkZ3a6XRksnN50gxkqGIlQ1XkNl2U//2erH0=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/gabriel-vasile/mimetype v1.4.3 h1:in2uUcidCuFcDKtdcBxlR0rJ1+fsokWf+uqxgUFjbI0=
|
||||
github.com/gabriel-vasile/mimetype v1.4.3/go.mod h1:d8uq/6HKRL6CGdk+aubisF/M5GcPfT7nKyLpA0lbSSk=
|
||||
github.com/gdamore/optopia v0.2.0/go.mod h1:YKYEwo5C1Pa617H7NlPcmQXl+vG6YnSSNB44n8dNL0Q=
|
||||
github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE=
|
||||
github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI=
|
||||
github.com/gin-gonic/gin v1.10.0 h1:nTuyha1TYqgedzytsKYqna+DfLos46nTv2ygFy86HFU=
|
||||
github.com/gin-gonic/gin v1.10.0/go.mod h1:4PMNQiOhvDRa013RKVbsiNwoyezlm2rm0uX/T7kzp5Y=
|
||||
github.com/go-playground/assert/v2 v2.2.0 h1:JvknZsQTYeFEAhQwI4qEt9cyV5ONwRHC+lYKSsYSR8s=
|
||||
github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
|
||||
github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA=
|
||||
github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY=
|
||||
github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY=
|
||||
github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
|
||||
github.com/go-playground/validator/v10 v10.20.0 h1:K9ISHbSaI0lyB2eWMPJo+kOS/FBExVwjEviJTixqxL8=
|
||||
github.com/go-playground/validator/v10 v10.20.0/go.mod h1:dbuPbCMFw/DrkbEynArYaCwl3amGuJotoKCe95atGMM=
|
||||
github.com/go-resty/resty/v2 v2.13.1 h1:x+LHXBI2nMB1vqndymf26quycC4aggYJ7DECYbiz03g=
|
||||
github.com/go-resty/resty/v2 v2.13.1/go.mod h1:GznXlLxkq6Nh4sU59rPmUw3VtgpO3aS96ORAI6Q7d+0=
|
||||
github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU=
|
||||
github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I=
|
||||
github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
|
||||
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
||||
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
|
||||
github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc=
|
||||
github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
|
||||
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
|
||||
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
|
||||
github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
|
||||
github.com/klauspost/cpuid/v2 v2.2.7 h1:ZWSB3igEs+d0qvnxR/ZBzXVmxkgt8DdzP6m9pfuVLDM=
|
||||
github.com/klauspost/cpuid/v2 v2.2.7/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws=
|
||||
github.com/knz/go-libedit v1.10.1/go.mod h1:MZTVkCWyz0oBc7JOWP3wNAzd002ZbM/5hgShxwh4x8M=
|
||||
github.com/kpango/fastime v1.1.9 h1:xVQHcqyPt5M69DyFH7g1EPRns1YQNap9d5eLhl/Jy84=
|
||||
github.com/kpango/fastime v1.1.9/go.mod h1:vyD7FnUn08zxY4b/QFBZVG+9EWMYsNl+QF0uE46urD4=
|
||||
github.com/kpango/glg v1.6.15 h1:nw0xSxpSyrDIWHeb3dvnE08PW+SCbK+aYFETT75IeLA=
|
||||
github.com/kpango/glg v1.6.15/go.mod h1:cmsc7Yeu8AS3wHLmN7bhwENXOpxfq+QoqxCIk2FneRk=
|
||||
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
|
||||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
|
||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
||||
github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ=
|
||||
github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI=
|
||||
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
|
||||
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
||||
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
|
||||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
|
||||
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
|
||||
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
|
||||
github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM=
|
||||
github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs=
|
||||
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
|
||||
github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0=
|
||||
github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
|
||||
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
|
||||
github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA=
|
||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
|
||||
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
|
||||
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
||||
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
|
||||
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||
github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI=
|
||||
github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08=
|
||||
github.com/ugorji/go/codec v1.2.12 h1:9LC83zGrHhuUA9l16C9AHXAqEV/2wBQ4nkvumAE65EE=
|
||||
github.com/ugorji/go/codec v1.2.12/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg=
|
||||
github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k=
|
||||
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
|
||||
go.nanomsg.org/mangos/v3 v3.4.2 h1:gHlopxjWvJcVCcUilQIsRQk9jdj6/HB7wrTiUN8Ki7Q=
|
||||
go.nanomsg.org/mangos/v3 v3.4.2/go.mod h1:8+hjBMQub6HvXmuGvIq6hf19uxGQIjCofmc62lbedLA=
|
||||
go.uber.org/atomic v1.7.0 h1:ADUqmZGgLDDfbSL9ZmPxKTybcoEYHgpYfELNoN+7hsw=
|
||||
go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
|
||||
go.uber.org/goleak v1.1.11/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ=
|
||||
go.uber.org/multierr v1.6.0 h1:y6IPFStTAIT5Ytl7/XYmHvzXQ7S3g/IeZW9hyZ5thw4=
|
||||
go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU=
|
||||
go.uber.org/zap v1.24.0 h1:FiJd5l1UOLj0wCgbSE0rwwXHzEdAZS6hiiSnxJN/D60=
|
||||
go.uber.org/zap v1.24.0/go.mod h1:2kMP+WWQ8aoFoedH3T2sq6iJ2yDWpHbP0f6MQbS9Gkg=
|
||||
golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8=
|
||||
golang.org/x/arch v0.8.0 h1:3wRIsP3pM4yUptoR96otTUOXI367OS0+c9eeRi9doIc=
|
||||
golang.org/x/arch v0.8.0/go.mod h1:FEVrYAQjsQXMVJ1nsMoVVXPZg6p2JE2mx8psSWTDQys=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||
golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU=
|
||||
golang.org/x/crypto v0.23.0 h1:dIJU/v2J8Mdglj/8rJ6UUOM3Zc9zLZxVZwwxMooUSAI=
|
||||
golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8=
|
||||
golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
||||
golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
||||
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
|
||||
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
|
||||
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
|
||||
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
|
||||
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
|
||||
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
|
||||
golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44=
|
||||
golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac=
|
||||
golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM=
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y=
|
||||
golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
|
||||
golang.org/x/term v0.8.0/go.mod h1:xPskH00ivmX89bAKVGSKKtLOWNx2+17Eiy94tnKShWo=
|
||||
golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk=
|
||||
golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
||||
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
||||
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
|
||||
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
||||
golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk=
|
||||
golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
||||
golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk=
|
||||
golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM=
|
||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
|
||||
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
|
||||
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
|
||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE=
|
||||
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg=
|
||||
google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw=
|
||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=
|
||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
nullprogram.com/x/optparse v1.0.0/go.mod h1:KdyPE+Igbe0jQUrVfMqDMeJQIJZEuyV7pjYmp6pbG50=
|
||||
rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4=
|
213
clients/go_wcf_http/mian.go
vendored
Normal file
213
clients/go_wcf_http/mian.go
vendored
Normal file
@ -0,0 +1,213 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"github.com/gin-gonic/gin"
|
||||
resty "github.com/go-resty/resty/v2"
|
||||
"github.com/gorilla/websocket"
|
||||
"go_wechatFerry/app"
|
||||
"go_wechatFerry/wcf"
|
||||
"log"
|
||||
"net"
|
||||
"net/http"
|
||||
"os"
|
||||
"os/signal"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
func init() {
|
||||
// 运行sdk.dll中的函数
|
||||
app.WechatFerryInit()
|
||||
}
|
||||
|
||||
func httpInit() {
|
||||
// 1.创建路由
|
||||
r := gin.New()
|
||||
gin.SetMode(gin.ReleaseMode)
|
||||
// 2.绑定路由规则,执行的函数
|
||||
// gin.Context,封装了request和response
|
||||
// 设置模板目录
|
||||
r.LoadHTMLGlob("templates/*")
|
||||
r.GET("/", func(c *gin.Context) {
|
||||
c.HTML(http.StatusOK, "wechatFerryGoHttp.html", gin.H{})
|
||||
})
|
||||
|
||||
r.POST("/testHttp", func(c *gin.Context) {
|
||||
type RequestData struct {
|
||||
Code int `json:"code"`
|
||||
Message string `json:"message"`
|
||||
Data struct {
|
||||
IsGroup bool `json:"is_group"`
|
||||
MessageId uint64 `json:"message_id"`
|
||||
Type uint32 `json:"type"`
|
||||
Ts uint32 `json:"ts"`
|
||||
RoomId string `json:"room_id"`
|
||||
Content string `json:"content"`
|
||||
WxId string `json:"wx_id"`
|
||||
Sign string `json:"sign"`
|
||||
Xml string `json:"xml"`
|
||||
} `json:"data"`
|
||||
}
|
||||
var requestData RequestData
|
||||
c.BindJSON(&requestData)
|
||||
fmt.Println(requestData)
|
||||
})
|
||||
|
||||
// 设置消息回调地址
|
||||
r.POST("/api/SetMessageCallbackUrl", app.SetMessageCallbackUrl)
|
||||
// 获取登录的wx_id
|
||||
r.GET("/api/GetSelfWXID", app.GetSelfWXID)
|
||||
// 获取自己的信息
|
||||
r.GET("/api/GetUserInfo", app.GetUserInfo)
|
||||
// 获取消息类型列表
|
||||
r.GET("/api/GetMsgTypes", app.GetMsgTypes)
|
||||
// 获取通讯录成功
|
||||
r.GET("/api/GetContacts", app.GetContacts)
|
||||
// 获取全部群的群成员
|
||||
r.GET("/api/GetRoomMembersAll", app.GetRoomMembersAll)
|
||||
// 获取单个群成员列表
|
||||
r.POST("/api/GetRoomMember", app.GetRoomMember)
|
||||
// 获取数据库名
|
||||
r.GET("/api/GetDBNames", app.GetDBNames)
|
||||
// 获取表
|
||||
r.POST("/api/GetDBTables", app.GetDBTables)
|
||||
// 执行sql
|
||||
r.POST("/api/ExecDBQuery", app.ExecDBQuery)
|
||||
// 发送文本消息
|
||||
r.POST("/api/SendTxt", app.SendTxt)
|
||||
// 发送图片
|
||||
r.POST("/api/SendIMG", app.SendIMG)
|
||||
// 发送文件
|
||||
r.POST("/api/SendFile", app.SendFile)
|
||||
// 发送卡片消息
|
||||
r.POST("/api/SendRichText", app.SendRichText)
|
||||
// 发送拍一拍消息
|
||||
r.POST("/api/SendPat", app.SendPat)
|
||||
// 转发消息
|
||||
r.POST("/api/ForwardMsg", app.ForwardMsg)
|
||||
|
||||
// 发送emoji消息
|
||||
r.POST("/api/SendEmotion", app.SendEmotion)
|
||||
// 接受好友请求
|
||||
r.POST("/api/AcceptFriend", app.AcceptFriend)
|
||||
// 添加群成员
|
||||
r.POST("/api/AddChatroomMembers", app.AddChatroomMembers)
|
||||
// 邀请群成员
|
||||
r.POST("/api/InvChatRoomMembers", app.InvChatRoomMembers)
|
||||
// 删除群成员
|
||||
r.POST("/api/DelChatRoomMembers", app.DelChatRoomMembers)
|
||||
// 刷新朋友圈
|
||||
r.POST("/api/RefreshPyq", app.RefreshPyq)
|
||||
// 下载附件
|
||||
r.POST("/api/DownloadAttach", app.DownloadAttach)
|
||||
|
||||
r.Run(":8000")
|
||||
}
|
||||
|
||||
func OnMsg() {
|
||||
err := app.WxClient.OnMSG(func(msg *wcf.WxMsg) {
|
||||
var message app.Message
|
||||
message.IsGroup = msg.IsGroup
|
||||
message.MessageId = msg.Id
|
||||
message.Type = msg.Type
|
||||
message.Ts = msg.Ts
|
||||
message.RoomId = msg.Roomid
|
||||
message.Content = msg.Content
|
||||
message.Sign = msg.Sign
|
||||
message.WxId = msg.Sender
|
||||
message.Xml = msg.Xml
|
||||
if app.WxClient.MessageCallbackUrl != "" {
|
||||
var data = map[string]interface{}{
|
||||
"code": 0,
|
||||
"message": "微信消息",
|
||||
"data": message,
|
||||
}
|
||||
jsonData, _ := json.Marshal(data)
|
||||
if strings.Contains(app.WxClient.MessageCallbackUrl, "tcp://") {
|
||||
conn, err := net.Dial("tcp", app.WxClient.MessageCallbackUrl)
|
||||
defer conn.Close()
|
||||
if err != nil {
|
||||
fmt.Println("err :", err)
|
||||
} else {
|
||||
_, err := conn.Write(jsonData)
|
||||
fmt.Println("err :", err)
|
||||
}
|
||||
}
|
||||
if strings.Contains(app.WxClient.MessageCallbackUrl, "udp://") {
|
||||
addr, err := net.ResolveUDPAddr("udp", app.WxClient.MessageCallbackUrl)
|
||||
if err != nil {
|
||||
fmt.Println("Error resolving address:", err)
|
||||
return
|
||||
}
|
||||
// 创建 UDP 连接
|
||||
conn, err := net.DialUDP("udp", nil, addr)
|
||||
if err != nil {
|
||||
fmt.Println("Error dialing:", err)
|
||||
return
|
||||
}
|
||||
defer conn.Close()
|
||||
// 发送消息
|
||||
_, err = conn.Write(jsonData)
|
||||
if err != nil {
|
||||
fmt.Println("Error sending message:", err)
|
||||
return
|
||||
}
|
||||
}
|
||||
if strings.Contains(app.WxClient.MessageCallbackUrl, "ws://") {
|
||||
// 创建 WebSocket 连接
|
||||
conn, _, err := websocket.DefaultDialer.Dial(app.WxClient.MessageCallbackUrl, nil)
|
||||
if err != nil {
|
||||
log.Fatal("Dial error:", err)
|
||||
}
|
||||
defer conn.Close()
|
||||
// 设置写入超时
|
||||
conn.SetWriteDeadline(time.Now().Add(5 * time.Second))
|
||||
// 发送消息
|
||||
err = conn.WriteMessage(websocket.TextMessage, jsonData)
|
||||
if err != nil {
|
||||
log.Fatal("Write error:", err)
|
||||
}
|
||||
}
|
||||
if strings.Contains(app.WxClient.MessageCallbackUrl, "http") {
|
||||
_, err := resty.New().SetTimeout(5 * time.Second).R().SetBody(jsonData).Post(app.WxClient.MessageCallbackUrl)
|
||||
if err != nil {
|
||||
fmt.Println("http消息发送失败")
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// 植入我自己的功能接口
|
||||
fmt.Println("请设置消息回调的url")
|
||||
}
|
||||
})
|
||||
fmt.Println(err)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
OnMsg()
|
||||
} else {
|
||||
fmt.Println("为正常接受消息状态")
|
||||
}
|
||||
}
|
||||
|
||||
// 入口
|
||||
func main() {
|
||||
// 注册Ctrl+C信号处理函数
|
||||
signalChan := make(chan os.Signal, 1)
|
||||
signal.Notify(signalChan, os.Interrupt)
|
||||
go func() {
|
||||
<-signalChan
|
||||
// 在收到Ctrl+C信号时执行清理操作
|
||||
fmt.Println("\n感谢温柔的ctrl+c关闭,下次可直接运行程序,无需重启微信。")
|
||||
app.WxClient.Close()
|
||||
os.Exit(0)
|
||||
}()
|
||||
// 开启接收消息
|
||||
_ = app.WxClient.EnableRecvTxt()
|
||||
// 先启动http服务器 下面的会阻塞
|
||||
go httpInit()
|
||||
// 启动推送消息的地方
|
||||
go OnMsg()
|
||||
// 防止主goroutine退出
|
||||
select {}
|
||||
}
|
236
clients/go_wcf_http/proto/wcf.proto
vendored
Normal file
236
clients/go_wcf_http/proto/wcf.proto
vendored
Normal file
@ -0,0 +1,236 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package wcf;
|
||||
option java_package = "com.iamteer";
|
||||
option go_package = "../wcf";
|
||||
|
||||
enum Functions {
|
||||
FUNC_RESERVED = 0x00;
|
||||
FUNC_IS_LOGIN = 0x01;
|
||||
FUNC_GET_SELF_WXID = 0x10;
|
||||
FUNC_GET_MSG_TYPES = 0x11;
|
||||
FUNC_GET_CONTACTS = 0x12;
|
||||
FUNC_GET_DB_NAMES = 0x13;
|
||||
FUNC_GET_DB_TABLES = 0x14;
|
||||
FUNC_GET_USER_INFO = 0x15;
|
||||
FUNC_GET_AUDIO_MSG = 0x16;
|
||||
FUNC_SEND_TXT = 0x20;
|
||||
FUNC_SEND_IMG = 0x21;
|
||||
FUNC_SEND_FILE = 0x22;
|
||||
FUNC_SEND_XML = 0x23;
|
||||
FUNC_SEND_EMOTION = 0x24;
|
||||
FUNC_SEND_RICH_TXT = 0x25;
|
||||
FUNC_SEND_PAT_MSG = 0x26;
|
||||
FUNC_FORWARD_MSG = 0x27;
|
||||
FUNC_ENABLE_RECV_TXT = 0x30;
|
||||
FUNC_DISABLE_RECV_TXT = 0x40;
|
||||
FUNC_EXEC_DB_QUERY = 0x50;
|
||||
FUNC_ACCEPT_FRIEND = 0x51;
|
||||
FUNC_RECV_TRANSFER = 0x52;
|
||||
FUNC_REFRESH_PYQ = 0x53;
|
||||
FUNC_DOWNLOAD_ATTACH = 0x54;
|
||||
FUNC_GET_CONTACT_INFO = 0x55;
|
||||
FUNC_REVOKE_MSG = 0x56;
|
||||
FUNC_DECRYPT_IMAGE = 0x60;
|
||||
FUNC_EXEC_OCR = 0x61;
|
||||
FUNC_ADD_ROOM_MEMBERS = 0x70;
|
||||
FUNC_DEL_ROOM_MEMBERS = 0x71;
|
||||
FUNC_INV_ROOM_MEMBERS = 0x72;
|
||||
}
|
||||
|
||||
message Request
|
||||
{
|
||||
Functions func = 1;
|
||||
oneof msg
|
||||
{
|
||||
Empty empty = 2;
|
||||
string str = 3;
|
||||
TextMsg txt = 4;
|
||||
PathMsg file = 5;
|
||||
DbQuery query = 6;
|
||||
Verification v = 7;
|
||||
MemberMgmt m = 8; // 群成员管理,添加、删除、邀请
|
||||
XmlMsg xml = 9;
|
||||
DecPath dec = 10;
|
||||
Transfer tf = 11;
|
||||
uint64 ui64 = 12; // 64 位整数,通用
|
||||
bool flag = 13;
|
||||
AttachMsg att = 14;
|
||||
AudioMsg am = 15;
|
||||
RichText rt = 16;
|
||||
PatMsg pm = 17;
|
||||
ForwardMsg fm = 18;
|
||||
}
|
||||
}
|
||||
|
||||
message Response
|
||||
{
|
||||
Functions func = 1;
|
||||
oneof msg
|
||||
{
|
||||
int32 status = 2; // Int 状态,通用
|
||||
string str = 3; // 字符串
|
||||
WxMsg wxmsg = 4; // 微信消息
|
||||
MsgTypes types = 5; // 消息类型
|
||||
RpcContacts contacts = 6; // 联系人
|
||||
DbNames dbs = 7; // 数据库列表
|
||||
DbTables tables = 8; // 表列表
|
||||
DbRows rows = 9; // 行列表
|
||||
UserInfo ui = 10; // 个人信息
|
||||
OcrMsg ocr = 11; // OCR 结果
|
||||
};
|
||||
}
|
||||
|
||||
message Empty { }
|
||||
|
||||
message WxMsg
|
||||
{
|
||||
bool is_self = 1; // 是否自己发送的
|
||||
bool is_group = 2; // 是否群消息
|
||||
uint64 id = 3; // 消息 id
|
||||
uint32 type = 4; // 消息类型
|
||||
uint32 ts = 5; // 消息类型
|
||||
string roomid = 6; // 群 id(如果是群消息的话)
|
||||
string content = 7; // 消息内容
|
||||
string sender = 8; // 消息发送者
|
||||
string sign = 9; // Sign
|
||||
string thumb = 10; // 缩略图
|
||||
string extra = 11; // 附加内容
|
||||
string xml = 12; // 消息 xml
|
||||
}
|
||||
|
||||
message TextMsg
|
||||
{
|
||||
string msg = 1; // 要发送的消息内容
|
||||
string receiver = 2; // 消息接收人,当为群时可@
|
||||
string aters = 3; // 要@的人列表,逗号分隔
|
||||
}
|
||||
|
||||
message PathMsg
|
||||
{
|
||||
string path = 1; // 要发送的图片的路径
|
||||
string receiver = 2; // 消息接收人
|
||||
}
|
||||
|
||||
message XmlMsg
|
||||
{
|
||||
string receiver = 1; // 消息接收人
|
||||
string content = 2; // xml 内容
|
||||
string path = 3; // 图片路径
|
||||
int32 type = 4; // 消息类型
|
||||
}
|
||||
|
||||
message MsgTypes { map<int32, string> types = 1; }
|
||||
|
||||
message RpcContact
|
||||
{
|
||||
string wxid = 1; // 微信 id
|
||||
string code = 2; // 微信号
|
||||
string remark = 3; // 备注
|
||||
string name = 4; // 微信昵称
|
||||
string country = 5; // 国家
|
||||
string province = 6; // 省/州
|
||||
string city = 7; // 城市
|
||||
int32 gender = 8; // 性别
|
||||
}
|
||||
message RpcContacts { repeated RpcContact contacts = 1; }
|
||||
|
||||
message DbNames { repeated string names = 1; }
|
||||
|
||||
message DbTable
|
||||
{
|
||||
string name = 1; // 表名
|
||||
string sql = 2; // 建表 SQL
|
||||
}
|
||||
message DbTables { repeated DbTable tables = 1; }
|
||||
|
||||
message DbQuery
|
||||
{
|
||||
string db = 1; // 目标数据库
|
||||
string sql = 2; // 查询 SQL
|
||||
}
|
||||
|
||||
message DbField
|
||||
{
|
||||
int32 type = 1; // 字段类型
|
||||
string column = 2; // 字段名称
|
||||
bytes content = 3; // 字段内容
|
||||
}
|
||||
message DbRow { repeated DbField fields = 1; }
|
||||
message DbRows { repeated DbRow rows = 1; }
|
||||
|
||||
message Verification
|
||||
{
|
||||
string v3 = 1; // 加密的用户名
|
||||
string v4 = 2; // Ticket
|
||||
int32 scene = 3; // 添加方式:17 名片,30 扫码
|
||||
}
|
||||
|
||||
message MemberMgmt
|
||||
{
|
||||
string roomid = 1; // 要加的群ID
|
||||
string wxids = 2; // 要加群的人列表,逗号分隔
|
||||
}
|
||||
|
||||
message UserInfo
|
||||
{
|
||||
string wxid = 1; // 微信ID
|
||||
string name = 2; // 昵称
|
||||
string mobile = 3; // 手机号
|
||||
string home = 4; // 文件/图片等父路径
|
||||
}
|
||||
|
||||
message DecPath
|
||||
{
|
||||
string src = 1; // 源路径
|
||||
string dst = 2; // 目标路径
|
||||
}
|
||||
|
||||
message Transfer
|
||||
{
|
||||
string wxid = 1; // 转账人
|
||||
string tfid = 2; // 转账id transferid
|
||||
string taid = 3; // Transaction id
|
||||
}
|
||||
|
||||
message AttachMsg
|
||||
{
|
||||
uint64 id = 1; // 消息 id
|
||||
string thumb = 2; // 消息中的 thumb
|
||||
string extra = 3; // 消息中的 extra
|
||||
}
|
||||
|
||||
message AudioMsg
|
||||
{
|
||||
uint64 id = 1; // 语音消息 id
|
||||
string dir = 2; // 存放目录
|
||||
}
|
||||
|
||||
message RichText
|
||||
{
|
||||
string name = 1; // 显示名字
|
||||
string account = 2; // 公众号 id
|
||||
string title = 3; // 标题
|
||||
string digest = 4; // 摘要
|
||||
string url = 5; // 链接
|
||||
string thumburl = 6; // 缩略图
|
||||
string receiver = 7; // 接收人
|
||||
}
|
||||
|
||||
message PatMsg
|
||||
{
|
||||
string roomid = 1; // 群 id
|
||||
string wxid = 2; // wxid
|
||||
}
|
||||
|
||||
message OcrMsg
|
||||
{
|
||||
int32 status = 1; // 状态
|
||||
string result = 2; // 结果
|
||||
}
|
||||
|
||||
message ForwardMsg
|
||||
{
|
||||
uint64 id = 1; // 待转发消息 ID
|
||||
string receiver = 2; // 转发接收目标,群为 roomId,个人为 wxid
|
||||
}
|
224
clients/go_wcf_http/templates/wechatFerryGoHttp.html
vendored
Normal file
224
clients/go_wcf_http/templates/wechatFerryGoHttp.html
vendored
Normal file
File diff suppressed because one or more lines are too long
605
clients/go_wcf_http/wcf/wcf.go
vendored
Normal file
605
clients/go_wcf_http/wcf/wcf.go
vendored
Normal file
@ -0,0 +1,605 @@
|
||||
package wcf
|
||||
|
||||
import (
|
||||
logs "github.com/danbai225/go-logs"
|
||||
"go.nanomsg.org/mangos/v3"
|
||||
"go.nanomsg.org/mangos/v3/protocol"
|
||||
"go.nanomsg.org/mangos/v3/protocol/pair1"
|
||||
_ "go.nanomsg.org/mangos/v3/transport/all"
|
||||
"google.golang.org/protobuf/proto"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
type Client struct {
|
||||
add string
|
||||
socket protocol.Socket
|
||||
RecvTxt bool
|
||||
ContactsMap []map[string]string
|
||||
MessageCallbackUrl string
|
||||
}
|
||||
|
||||
func (c *Client) conn() error {
|
||||
socket, err := pair1.NewSocket()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = socket.Dial(c.add)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
c.socket = socket
|
||||
return err
|
||||
}
|
||||
|
||||
func (c *Client) send(data []byte) error {
|
||||
return c.socket.Send(data)
|
||||
}
|
||||
|
||||
func (c *Client) Recv() (*Response, error) {
|
||||
msg := &Response{}
|
||||
recv, err := c.socket.Recv()
|
||||
if err != nil {
|
||||
return msg, err
|
||||
}
|
||||
err = proto.Unmarshal(recv, msg)
|
||||
return msg, err
|
||||
}
|
||||
|
||||
// Close 退出
|
||||
func (c *Client) Close() error {
|
||||
c.DisableRecvTxt()
|
||||
return c.socket.Close()
|
||||
}
|
||||
|
||||
// IsLogin 查看是否登录
|
||||
func (c *Client) IsLogin() bool {
|
||||
err := c.send(genFunReq(Functions_FUNC_IS_LOGIN).build())
|
||||
if err != nil {
|
||||
logs.Err(err)
|
||||
}
|
||||
recv, err := c.Recv()
|
||||
if err != nil {
|
||||
logs.Err(err)
|
||||
}
|
||||
if recv.GetStatus() == 1 {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// GetSelfWXID 获取登录的id
|
||||
func (c *Client) GetSelfWXID() string {
|
||||
err := c.send(genFunReq(Functions_FUNC_GET_SELF_WXID).build())
|
||||
if err != nil {
|
||||
logs.Err(err)
|
||||
}
|
||||
recv, err := c.Recv()
|
||||
if err != nil {
|
||||
logs.Err(err)
|
||||
}
|
||||
return recv.GetStr()
|
||||
}
|
||||
|
||||
// GetMsgTypes 获取消息类型
|
||||
func (c *Client) GetMsgTypes() map[int32]string {
|
||||
err := c.send(genFunReq(Functions_FUNC_GET_MSG_TYPES).build())
|
||||
if err != nil {
|
||||
logs.Err(err)
|
||||
}
|
||||
recv, err := c.Recv()
|
||||
if err != nil {
|
||||
logs.Err(err)
|
||||
}
|
||||
return recv.GetTypes().GetTypes()
|
||||
}
|
||||
|
||||
// GetContacts 获取通讯录
|
||||
func (c *Client) GetContacts() []*RpcContact {
|
||||
err := c.send(genFunReq(Functions_FUNC_GET_CONTACTS).build())
|
||||
if err != nil {
|
||||
logs.Err(err)
|
||||
}
|
||||
recv, err := c.Recv()
|
||||
if err != nil {
|
||||
logs.Err(err)
|
||||
}
|
||||
return recv.GetContacts().GetContacts()
|
||||
}
|
||||
|
||||
// GetDBNames 获取数据库名
|
||||
func (c *Client) GetDBNames() []string {
|
||||
err := c.send(genFunReq(Functions_FUNC_GET_DB_NAMES).build())
|
||||
if err != nil {
|
||||
logs.Err(err)
|
||||
}
|
||||
recv, err := c.Recv()
|
||||
if err != nil {
|
||||
logs.Err(err)
|
||||
}
|
||||
return recv.GetDbs().Names
|
||||
}
|
||||
|
||||
// GetDBTables 获取表
|
||||
func (c *Client) GetDBTables(tab string) []*DbTable {
|
||||
req := genFunReq(Functions_FUNC_GET_DB_TABLES)
|
||||
str := &Request_Str{Str: tab}
|
||||
req.Msg = str
|
||||
err := c.send(req.build())
|
||||
if err != nil {
|
||||
logs.Err(err)
|
||||
}
|
||||
recv, err := c.Recv()
|
||||
if err != nil {
|
||||
logs.Err(err)
|
||||
}
|
||||
return recv.GetTables().GetTables()
|
||||
}
|
||||
|
||||
// ExecDBQuery 执行sql
|
||||
func (c *Client) ExecDBQuery(db, sql string) []*DbRow {
|
||||
req := genFunReq(Functions_FUNC_EXEC_DB_QUERY)
|
||||
q := Request_Query{
|
||||
Query: &DbQuery{
|
||||
Db: db,
|
||||
Sql: sql,
|
||||
},
|
||||
}
|
||||
req.Msg = &q
|
||||
err := c.send(req.build())
|
||||
if err != nil {
|
||||
logs.Err(err)
|
||||
}
|
||||
recv, err := c.Recv()
|
||||
if err != nil {
|
||||
logs.Err(err)
|
||||
}
|
||||
return recv.GetRows().GetRows()
|
||||
}
|
||||
|
||||
// AcceptFriend 接收好友请求
|
||||
func (c *Client) AcceptFriend(v3, v4 string, scene int32) int32 {
|
||||
req := genFunReq(Functions_FUNC_ACCEPT_FRIEND)
|
||||
q := Request_V{
|
||||
V: &Verification{
|
||||
V3: v3,
|
||||
V4: v4,
|
||||
Scene: scene,
|
||||
}}
|
||||
|
||||
req.Msg = &q
|
||||
err := c.send(req.build())
|
||||
if err != nil {
|
||||
logs.Err(err)
|
||||
}
|
||||
recv, err := c.Recv()
|
||||
if err != nil {
|
||||
logs.Err(err)
|
||||
}
|
||||
return recv.GetStatus()
|
||||
}
|
||||
|
||||
func (c *Client) AddChatroomMembers(roomID, wxIDs string) int32 {
|
||||
req := genFunReq(Functions_FUNC_ADD_ROOM_MEMBERS)
|
||||
q := Request_M{
|
||||
M: &MemberMgmt{Roomid: roomID, Wxids: wxIDs},
|
||||
}
|
||||
req.Msg = &q
|
||||
err := c.send(req.build())
|
||||
if err != nil {
|
||||
logs.Err(err)
|
||||
}
|
||||
recv, err := c.Recv()
|
||||
if err != nil {
|
||||
logs.Err(err)
|
||||
}
|
||||
return recv.GetStatus()
|
||||
}
|
||||
|
||||
// ReceiveTransfer 接收转账
|
||||
func (c *Client) ReceiveTransfer(wxid, tfid, taid string) int32 {
|
||||
req := genFunReq(Functions_FUNC_RECV_TRANSFER)
|
||||
q := Request_Tf{
|
||||
Tf: &Transfer{
|
||||
Wxid: wxid,
|
||||
Tfid: tfid,
|
||||
Taid: taid,
|
||||
},
|
||||
}
|
||||
req.Msg = &q
|
||||
err := c.send(req.build())
|
||||
if err != nil {
|
||||
logs.Err(err)
|
||||
}
|
||||
recv, err := c.Recv()
|
||||
if err != nil {
|
||||
logs.Err(err)
|
||||
}
|
||||
return recv.GetStatus()
|
||||
}
|
||||
|
||||
// RefreshPYQ 刷新朋友圈
|
||||
func (c *Client) RefreshPYQ() int32 {
|
||||
req := genFunReq(Functions_FUNC_REFRESH_PYQ)
|
||||
q := Request_Ui64{
|
||||
Ui64: 0,
|
||||
}
|
||||
req.Msg = &q
|
||||
err := c.send(req.build())
|
||||
if err != nil {
|
||||
logs.Err(err)
|
||||
}
|
||||
recv, err := c.Recv()
|
||||
if err != nil {
|
||||
logs.Err(err)
|
||||
}
|
||||
return recv.GetStatus()
|
||||
}
|
||||
|
||||
// DecryptImage 解密图片 加密路径,解密路径
|
||||
func (c *Client) DecryptImage(src, dst string) int32 {
|
||||
req := genFunReq(Functions_FUNC_DECRYPT_IMAGE)
|
||||
q := Request_Dec{
|
||||
Dec: &DecPath{Src: src, Dst: dst},
|
||||
}
|
||||
req.Msg = &q
|
||||
err := c.send(req.build())
|
||||
if err != nil {
|
||||
logs.Err(err)
|
||||
}
|
||||
recv, err := c.Recv()
|
||||
if err != nil {
|
||||
logs.Err(err)
|
||||
}
|
||||
return recv.GetStatus()
|
||||
}
|
||||
|
||||
// AddChatRoomMembers 添加群成员
|
||||
func (c *Client) AddChatRoomMembers(roomId string, wxIds []string) int32 {
|
||||
req := genFunReq(Functions_FUNC_ADD_ROOM_MEMBERS)
|
||||
q := Request_M{
|
||||
M: &MemberMgmt{Roomid: roomId,
|
||||
Wxids: strings.Join(wxIds, ",")},
|
||||
}
|
||||
req.Msg = &q
|
||||
err := c.send(req.build())
|
||||
if err != nil {
|
||||
logs.Err(err)
|
||||
}
|
||||
recv, err := c.Recv()
|
||||
if err != nil {
|
||||
logs.Err(err)
|
||||
}
|
||||
return recv.GetStatus()
|
||||
}
|
||||
|
||||
// InvChatRoomMembers 邀请群成员
|
||||
func (c *Client) InvChatRoomMembers(roomId string, wxIds []string) int32 {
|
||||
req := genFunReq(Functions_FUNC_INV_ROOM_MEMBERS)
|
||||
q := Request_M{
|
||||
M: &MemberMgmt{Roomid: roomId,
|
||||
Wxids: strings.Join(wxIds, ",")},
|
||||
}
|
||||
req.Msg = &q
|
||||
err := c.send(req.build())
|
||||
if err != nil {
|
||||
logs.Err(err)
|
||||
}
|
||||
recv, err := c.Recv()
|
||||
if err != nil {
|
||||
logs.Err(err)
|
||||
}
|
||||
return recv.GetStatus()
|
||||
}
|
||||
|
||||
// DelChatRoomMembers 删除群成员
|
||||
func (c *Client) DelChatRoomMembers(roomId string, wxIds []string) int32 {
|
||||
req := genFunReq(Functions_FUNC_DEL_ROOM_MEMBERS)
|
||||
q := Request_M{
|
||||
M: &MemberMgmt{Roomid: roomId,
|
||||
Wxids: strings.Join(wxIds, ",")},
|
||||
}
|
||||
req.Msg = &q
|
||||
err := c.send(req.build())
|
||||
if err != nil {
|
||||
logs.Err(err)
|
||||
}
|
||||
recv, err := c.Recv()
|
||||
if err != nil {
|
||||
logs.Err(err)
|
||||
}
|
||||
return recv.GetStatus()
|
||||
}
|
||||
|
||||
// GetUserInfo 获取自己的信息
|
||||
func (c *Client) GetUserInfo() *UserInfo {
|
||||
err := c.send(genFunReq(Functions_FUNC_GET_USER_INFO).build())
|
||||
if err != nil {
|
||||
logs.Err(err)
|
||||
}
|
||||
recv, err := c.Recv()
|
||||
if err != nil {
|
||||
logs.Err(err)
|
||||
}
|
||||
return recv.GetUi()
|
||||
}
|
||||
|
||||
// SendTxt 发送文本内容
|
||||
func (c *Client) SendTxt(msg string, receiver string, ates []string) int32 {
|
||||
req := genFunReq(Functions_FUNC_SEND_TXT)
|
||||
req.Msg = &Request_Txt{
|
||||
Txt: &TextMsg{
|
||||
Msg: msg,
|
||||
Receiver: receiver,
|
||||
Aters: strings.Join(ates, ","),
|
||||
},
|
||||
}
|
||||
err := c.send(req.build())
|
||||
if err != nil {
|
||||
logs.Err(err)
|
||||
}
|
||||
recv, err := c.Recv()
|
||||
if err != nil {
|
||||
logs.Err(err)
|
||||
}
|
||||
return recv.GetStatus()
|
||||
}
|
||||
|
||||
// ForwardMsg 转发消息
|
||||
func (c *Client) ForwardMsg(Id uint64, receiver string) int32 {
|
||||
req := genFunReq(Functions_FUNC_FORWARD_MSG)
|
||||
req.Msg = &Request_Fm{
|
||||
Fm: &ForwardMsg{
|
||||
Id: Id,
|
||||
Receiver: receiver,
|
||||
},
|
||||
}
|
||||
err := c.send(req.build())
|
||||
if err != nil {
|
||||
logs.Err(err)
|
||||
}
|
||||
recv, err := c.Recv()
|
||||
if err != nil {
|
||||
logs.Err(err)
|
||||
}
|
||||
return recv.GetStatus()
|
||||
}
|
||||
|
||||
// SendIMG 发送图片
|
||||
func (c *Client) SendIMG(path string, receiver string) int32 {
|
||||
req := genFunReq(Functions_FUNC_SEND_IMG)
|
||||
req.Msg = &Request_File{
|
||||
File: &PathMsg{
|
||||
Path: path,
|
||||
Receiver: receiver,
|
||||
},
|
||||
}
|
||||
err := c.send(req.build())
|
||||
if err != nil {
|
||||
logs.Err(err)
|
||||
}
|
||||
recv, err := c.Recv()
|
||||
if err != nil {
|
||||
logs.Err(err)
|
||||
}
|
||||
return recv.GetStatus()
|
||||
}
|
||||
|
||||
// SendFile 发送文件
|
||||
func (c *Client) SendFile(path string, receiver string) int32 {
|
||||
req := genFunReq(Functions_FUNC_SEND_FILE)
|
||||
req.Msg = &Request_File{
|
||||
File: &PathMsg{
|
||||
Path: path,
|
||||
Receiver: receiver,
|
||||
},
|
||||
}
|
||||
err := c.send(req.build())
|
||||
if err != nil {
|
||||
logs.Err(err)
|
||||
}
|
||||
recv, err := c.Recv()
|
||||
if err != nil {
|
||||
logs.Err(err)
|
||||
}
|
||||
return recv.GetStatus()
|
||||
}
|
||||
|
||||
// SendRichText 发送卡片消息
|
||||
func (c *Client) SendRichText(name string, account string, title string, digest string, url string, thumburl string, receiver string) int32 {
|
||||
req := genFunReq(Functions_FUNC_SEND_RICH_TXT)
|
||||
req.Msg = &Request_Rt{
|
||||
Rt: &RichText{
|
||||
Name: name,
|
||||
Account: account,
|
||||
Title: title,
|
||||
Digest: digest,
|
||||
Url: url,
|
||||
Thumburl: thumburl,
|
||||
Receiver: receiver,
|
||||
},
|
||||
}
|
||||
err := c.send(req.build())
|
||||
if err != nil {
|
||||
logs.Err(err)
|
||||
}
|
||||
recv, err := c.Recv()
|
||||
if err != nil {
|
||||
logs.Err(err)
|
||||
}
|
||||
return recv.GetStatus()
|
||||
}
|
||||
|
||||
// SendXml 发送xml数据
|
||||
func (c *Client) SendXml(path, content, receiver string, Type int32) int32 {
|
||||
req := genFunReq(Functions_FUNC_SEND_XML)
|
||||
req.Msg = &Request_Xml{
|
||||
Xml: &XmlMsg{
|
||||
Receiver: receiver,
|
||||
Content: content,
|
||||
Path: path,
|
||||
Type: Type,
|
||||
},
|
||||
}
|
||||
err := c.send(req.build())
|
||||
if err != nil {
|
||||
logs.Err(err)
|
||||
}
|
||||
recv, err := c.Recv()
|
||||
if err != nil {
|
||||
logs.Err(err)
|
||||
}
|
||||
return recv.GetStatus()
|
||||
}
|
||||
|
||||
// SendEmotion 发送emoji
|
||||
func (c *Client) SendEmotion(path, receiver string) int32 {
|
||||
req := genFunReq(Functions_FUNC_SEND_EMOTION)
|
||||
req.Msg = &Request_File{
|
||||
File: &PathMsg{
|
||||
Path: path,
|
||||
Receiver: receiver,
|
||||
},
|
||||
}
|
||||
err := c.send(req.build())
|
||||
if err != nil {
|
||||
logs.Err(err)
|
||||
}
|
||||
recv, err := c.Recv()
|
||||
if err != nil {
|
||||
logs.Err(err)
|
||||
}
|
||||
return recv.GetStatus()
|
||||
}
|
||||
|
||||
// SendPat 发送拍一拍消息
|
||||
func (c *Client) SendPat(roomId, wxId string) int32 {
|
||||
req := genFunReq(Functions_FUNC_SEND_PAT_MSG)
|
||||
req.Msg = &Request_Pm{
|
||||
Pm: &PatMsg{
|
||||
Roomid: roomId,
|
||||
Wxid: wxId,
|
||||
},
|
||||
}
|
||||
err := c.send(req.build())
|
||||
if err != nil {
|
||||
logs.Err(err)
|
||||
}
|
||||
recv, err := c.Recv()
|
||||
if err != nil {
|
||||
logs.Err(err)
|
||||
}
|
||||
return recv.GetStatus()
|
||||
}
|
||||
|
||||
// DownloadAttach 下载附件
|
||||
func (c *Client) DownloadAttach(id uint64, thumb, extra string) int32 {
|
||||
req := genFunReq(Functions_FUNC_SEND_PAT_MSG)
|
||||
req.Msg = &Request_Att{
|
||||
Att: &AttachMsg{
|
||||
Id: id,
|
||||
Thumb: thumb,
|
||||
Extra: extra,
|
||||
},
|
||||
}
|
||||
err := c.send(req.build())
|
||||
if err != nil {
|
||||
logs.Err(err)
|
||||
}
|
||||
recv, err := c.Recv()
|
||||
if err != nil {
|
||||
logs.Err(err)
|
||||
}
|
||||
return recv.GetStatus()
|
||||
}
|
||||
|
||||
// EnableRecvTxt 开启接收数据
|
||||
func (c *Client) EnableRecvTxt() int32 {
|
||||
req := genFunReq(Functions_FUNC_ENABLE_RECV_TXT)
|
||||
req.Msg = &Request_Flag{
|
||||
Flag: true,
|
||||
}
|
||||
err := c.send(req.build())
|
||||
if err != nil {
|
||||
logs.Err(err)
|
||||
}
|
||||
recv, err := c.Recv()
|
||||
if err != nil {
|
||||
logs.Err(err)
|
||||
}
|
||||
c.RecvTxt = true
|
||||
return recv.GetStatus()
|
||||
}
|
||||
|
||||
// DisableRecvTxt 关闭接收消息
|
||||
func (c *Client) DisableRecvTxt() int32 {
|
||||
err := c.send(genFunReq(Functions_FUNC_DISABLE_RECV_TXT).build())
|
||||
if err != nil {
|
||||
logs.Err(err)
|
||||
}
|
||||
recv, err := c.Recv()
|
||||
if err != nil {
|
||||
logs.Err(err)
|
||||
}
|
||||
c.RecvTxt = false
|
||||
return recv.GetStatus()
|
||||
}
|
||||
|
||||
// OnMSG 接收消息
|
||||
func (c *Client) OnMSG(f func(msg *WxMsg)) error {
|
||||
socket, err := pair1.NewSocket()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_ = socket.SetOption(mangos.OptionRecvDeadline, 5000)
|
||||
_ = socket.SetOption(mangos.OptionSendDeadline, 5000)
|
||||
err = socket.Dial(addPort(c.add))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer socket.Close()
|
||||
for c.RecvTxt {
|
||||
msg := &Response{}
|
||||
recv, err := socket.Recv()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_ = proto.Unmarshal(recv, msg)
|
||||
go f(msg.GetWxmsg())
|
||||
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
// NewWCF 连接
|
||||
func NewWCF(add string) (*Client, error) {
|
||||
if add == "" {
|
||||
add = "tcp://127.0.0.1:10086"
|
||||
}
|
||||
client := &Client{add: add}
|
||||
err := client.conn()
|
||||
return client, err
|
||||
}
|
||||
|
||||
type cmdMSG struct {
|
||||
*Request
|
||||
}
|
||||
|
||||
func (c *cmdMSG) build() []byte {
|
||||
marshal, _ := proto.Marshal(c)
|
||||
return marshal
|
||||
}
|
||||
|
||||
func genFunReq(fun Functions) *cmdMSG {
|
||||
return &cmdMSG{
|
||||
&Request{Func: fun,
|
||||
Msg: nil},
|
||||
}
|
||||
}
|
||||
|
||||
func addPort(add string) string {
|
||||
parts := strings.Split(add, ":")
|
||||
port, _ := strconv.Atoi(parts[2])
|
||||
newPort := port + 1
|
||||
return parts[0] + ":" + parts[1] + ":" + strconv.Itoa(newPort)
|
||||
}
|
2982
clients/go_wcf_http/wcf/wcf.pb.go
vendored
Normal file
2982
clients/go_wcf_http/wcf/wcf.pb.go
vendored
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user