diff --git a/ComWeChatRobot.sln b/ComWeChatRobot.sln index 102dc6f0231160d3221f943fd9783a3af1d72212..5a749781a51451835913c8f4babb21711fa2080b 100644 --- a/ComWeChatRobot.sln +++ b/ComWeChatRobot.sln @@ -5,10 +5,14 @@ VisualStudioVersion = 16.0.31605.320 MinimumVisualStudioVersion = 10.0.40219.1 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CWeChatRobot", "CWeChatRobot\WeChatRobotCOM.vcxproj", "{F54A8A7E-C2C0-4FD8-B625-59C77FF613BA}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DWeChatRobot", "DWeChatRobot\DWeChatRobot.vcxproj", "{7EDE81C4-63BC-4C4F-8424-210D91034FDE}" -EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WeChatTools", "WeChatTools\WeChatTools.vcxproj", "{3F7198C7-68D1-4BBA-9BF2-B7FC67A9426E}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "DWeChatRobot", "DWeChatRobot", "{9C5F2C6B-73CE-49FC-B19C-478C50550FE4}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DWeChatRobot_3.5.0.46", "DWeChatRobot_3.5.0.46\DWeChatRobot_3.5.0.46.vcxproj", "{7EDE81C4-63BC-4C4F-8424-210D91034FDE}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DWeChatRobot_3.6.0.18", "DWeChatRobot_3.6.0.18\DWeChatRobot_3.6.0.18.vcxproj", "{C0FC8DAB-0590-46AC-9270-6FEA45D52390}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|x64 = Debug|x64 @@ -25,14 +29,6 @@ Global {F54A8A7E-C2C0-4FD8-B625-59C77FF613BA}.Release|x64.Build.0 = Release|x64 {F54A8A7E-C2C0-4FD8-B625-59C77FF613BA}.Release|x86.ActiveCfg = Release|Win32 {F54A8A7E-C2C0-4FD8-B625-59C77FF613BA}.Release|x86.Build.0 = Release|Win32 - {7EDE81C4-63BC-4C4F-8424-210D91034FDE}.Debug|x64.ActiveCfg = Debug|x64 - {7EDE81C4-63BC-4C4F-8424-210D91034FDE}.Debug|x64.Build.0 = Debug|x64 - {7EDE81C4-63BC-4C4F-8424-210D91034FDE}.Debug|x86.ActiveCfg = Debug|Win32 - {7EDE81C4-63BC-4C4F-8424-210D91034FDE}.Debug|x86.Build.0 = Debug|Win32 - {7EDE81C4-63BC-4C4F-8424-210D91034FDE}.Release|x64.ActiveCfg = Release|x64 - {7EDE81C4-63BC-4C4F-8424-210D91034FDE}.Release|x64.Build.0 = Release|x64 - {7EDE81C4-63BC-4C4F-8424-210D91034FDE}.Release|x86.ActiveCfg = Release|Win32 - {7EDE81C4-63BC-4C4F-8424-210D91034FDE}.Release|x86.Build.0 = Release|Win32 {3F7198C7-68D1-4BBA-9BF2-B7FC67A9426E}.Debug|x64.ActiveCfg = Debug|x64 {3F7198C7-68D1-4BBA-9BF2-B7FC67A9426E}.Debug|x64.Build.0 = Debug|x64 {3F7198C7-68D1-4BBA-9BF2-B7FC67A9426E}.Debug|x86.ActiveCfg = Debug|Win32 @@ -41,10 +37,30 @@ Global {3F7198C7-68D1-4BBA-9BF2-B7FC67A9426E}.Release|x64.Build.0 = Release|x64 {3F7198C7-68D1-4BBA-9BF2-B7FC67A9426E}.Release|x86.ActiveCfg = Release|Win32 {3F7198C7-68D1-4BBA-9BF2-B7FC67A9426E}.Release|x86.Build.0 = Release|Win32 + {7EDE81C4-63BC-4C4F-8424-210D91034FDE}.Debug|x64.ActiveCfg = Debug|x64 + {7EDE81C4-63BC-4C4F-8424-210D91034FDE}.Debug|x64.Build.0 = Debug|x64 + {7EDE81C4-63BC-4C4F-8424-210D91034FDE}.Debug|x86.ActiveCfg = Debug|Win32 + {7EDE81C4-63BC-4C4F-8424-210D91034FDE}.Debug|x86.Build.0 = Debug|Win32 + {7EDE81C4-63BC-4C4F-8424-210D91034FDE}.Release|x64.ActiveCfg = Release|x64 + {7EDE81C4-63BC-4C4F-8424-210D91034FDE}.Release|x64.Build.0 = Release|x64 + {7EDE81C4-63BC-4C4F-8424-210D91034FDE}.Release|x86.ActiveCfg = Release|Win32 + {7EDE81C4-63BC-4C4F-8424-210D91034FDE}.Release|x86.Build.0 = Release|Win32 + {C0FC8DAB-0590-46AC-9270-6FEA45D52390}.Debug|x64.ActiveCfg = Debug|x64 + {C0FC8DAB-0590-46AC-9270-6FEA45D52390}.Debug|x64.Build.0 = Debug|x64 + {C0FC8DAB-0590-46AC-9270-6FEA45D52390}.Debug|x86.ActiveCfg = Debug|Win32 + {C0FC8DAB-0590-46AC-9270-6FEA45D52390}.Debug|x86.Build.0 = Debug|Win32 + {C0FC8DAB-0590-46AC-9270-6FEA45D52390}.Release|x64.ActiveCfg = Release|x64 + {C0FC8DAB-0590-46AC-9270-6FEA45D52390}.Release|x64.Build.0 = Release|x64 + {C0FC8DAB-0590-46AC-9270-6FEA45D52390}.Release|x86.ActiveCfg = Release|Win32 + {C0FC8DAB-0590-46AC-9270-6FEA45D52390}.Release|x86.Build.0 = Release|Win32 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {7EDE81C4-63BC-4C4F-8424-210D91034FDE} = {9C5F2C6B-73CE-49FC-B19C-478C50550FE4} + {C0FC8DAB-0590-46AC-9270-6FEA45D52390} = {9C5F2C6B-73CE-49FC-B19C-478C50550FE4} + EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {20BD2B3B-13AA-4C38-8216-127895041F93} EndGlobalSection diff --git a/DWeChatRobot/DWeChatRobot.vcxproj b/DWeChatRobot_3.5.0.46/DWeChatRobot_3.5.0.46.vcxproj similarity index 96% rename from DWeChatRobot/DWeChatRobot.vcxproj rename to DWeChatRobot_3.5.0.46/DWeChatRobot_3.5.0.46.vcxproj index 2281cb2694b7c75386baac382be11e3f18e8b5b6..a45391466f89b5bdac5f6700615c7081dd5550cc 100644 --- a/DWeChatRobot/DWeChatRobot.vcxproj +++ b/DWeChatRobot_3.5.0.46/DWeChatRobot_3.5.0.46.vcxproj @@ -24,7 +24,7 @@ {7ede81c4-63bc-4c4f-8424-210d91034fde} MyWeChatRobot 10.0 - DWeChatRobot + DWeChatRobot_3.5.0.46 @@ -73,9 +73,11 @@ true + DWeChatRobot false + DWeChatRobot true diff --git a/DWeChatRobot/DWeChatRobot.vcxproj.filters b/DWeChatRobot_3.5.0.46/DWeChatRobot_3.5.0.46.vcxproj.filters similarity index 100% rename from DWeChatRobot/DWeChatRobot.vcxproj.filters rename to DWeChatRobot_3.5.0.46/DWeChatRobot_3.5.0.46.vcxproj.filters diff --git a/DWeChatRobot/DWeChatRobot.vcxproj.user b/DWeChatRobot_3.5.0.46/DWeChatRobot_3.5.0.46.vcxproj.user similarity index 100% rename from DWeChatRobot/DWeChatRobot.vcxproj.user rename to DWeChatRobot_3.5.0.46/DWeChatRobot_3.5.0.46.vcxproj.user diff --git a/DWeChatRobot/FriendList.cpp b/DWeChatRobot_3.5.0.46/FriendList.cpp similarity index 100% rename from DWeChatRobot/FriendList.cpp rename to DWeChatRobot_3.5.0.46/FriendList.cpp diff --git a/DWeChatRobot/FriendList.h b/DWeChatRobot_3.5.0.46/FriendList.h similarity index 100% rename from DWeChatRobot/FriendList.h rename to DWeChatRobot_3.5.0.46/FriendList.h diff --git a/DWeChatRobot/SaveGif.cpp b/DWeChatRobot_3.5.0.46/SaveGif.cpp similarity index 100% rename from DWeChatRobot/SaveGif.cpp rename to DWeChatRobot_3.5.0.46/SaveGif.cpp diff --git a/DWeChatRobot/SaveGif.h b/DWeChatRobot_3.5.0.46/SaveGif.h similarity index 100% rename from DWeChatRobot/SaveGif.h rename to DWeChatRobot_3.5.0.46/SaveGif.h diff --git a/DWeChatRobot/SelfInfo.cpp b/DWeChatRobot_3.5.0.46/SelfInfo.cpp similarity index 96% rename from DWeChatRobot/SelfInfo.cpp rename to DWeChatRobot_3.5.0.46/SelfInfo.cpp index 393cc934c9e92d7fe54068b93af460f1066dc4f5..1b9fe224c3a30cb0524b69cd2de92409c0bd445e 100644 --- a/DWeChatRobot/SelfInfo.cpp +++ b/DWeChatRobot_3.5.0.46/SelfInfo.cpp @@ -71,7 +71,7 @@ DWORD GetSelfInfoRemote() { } wchar_t* wtemp = new wchar_t[strlen(temp) + 1]; ZeroMemory(wtemp, (strlen(temp) + 1) * 2); - MultiByteToWideChar(CP_UTF8, MB_COMPOSITE, temp, -1, wtemp, strlen(temp) + 1); + MultiByteToWideChar(CP_UTF8, 0, temp, -1, wtemp, strlen(temp) + 1); selfinfo = selfinfo + wtemp; selfinfo = selfinfo + L"\""; if(i!= SelfInfoAddr.size() - 1) diff --git a/DWeChatRobot/SelfInfo.h b/DWeChatRobot_3.5.0.46/SelfInfo.h similarity index 100% rename from DWeChatRobot/SelfInfo.h rename to DWeChatRobot_3.5.0.46/SelfInfo.h diff --git a/DWeChatRobot/SendArticle.cpp b/DWeChatRobot_3.5.0.46/SendArticle.cpp similarity index 100% rename from DWeChatRobot/SendArticle.cpp rename to DWeChatRobot_3.5.0.46/SendArticle.cpp diff --git a/DWeChatRobot/SendArticle.h b/DWeChatRobot_3.5.0.46/SendArticle.h similarity index 100% rename from DWeChatRobot/SendArticle.h rename to DWeChatRobot_3.5.0.46/SendArticle.h diff --git a/DWeChatRobot/SendCard.cpp b/DWeChatRobot_3.5.0.46/SendCard.cpp similarity index 100% rename from DWeChatRobot/SendCard.cpp rename to DWeChatRobot_3.5.0.46/SendCard.cpp diff --git a/DWeChatRobot/SendCard.h b/DWeChatRobot_3.5.0.46/SendCard.h similarity index 100% rename from DWeChatRobot/SendCard.h rename to DWeChatRobot_3.5.0.46/SendCard.h diff --git a/DWeChatRobot/SendFile.cpp b/DWeChatRobot_3.5.0.46/SendFile.cpp similarity index 100% rename from DWeChatRobot/SendFile.cpp rename to DWeChatRobot_3.5.0.46/SendFile.cpp diff --git a/DWeChatRobot/SendFile.h b/DWeChatRobot_3.5.0.46/SendFile.h similarity index 100% rename from DWeChatRobot/SendFile.h rename to DWeChatRobot_3.5.0.46/SendFile.h diff --git a/DWeChatRobot/SendImage.cpp b/DWeChatRobot_3.5.0.46/SendImage.cpp similarity index 100% rename from DWeChatRobot/SendImage.cpp rename to DWeChatRobot_3.5.0.46/SendImage.cpp diff --git a/DWeChatRobot/SendImage.h b/DWeChatRobot_3.5.0.46/SendImage.h similarity index 100% rename from DWeChatRobot/SendImage.h rename to DWeChatRobot_3.5.0.46/SendImage.h diff --git a/DWeChatRobot/SendText.cpp b/DWeChatRobot_3.5.0.46/SendText.cpp similarity index 100% rename from DWeChatRobot/SendText.cpp rename to DWeChatRobot_3.5.0.46/SendText.cpp diff --git a/DWeChatRobot/SendText.h b/DWeChatRobot_3.5.0.46/SendText.h similarity index 100% rename from DWeChatRobot/SendText.h rename to DWeChatRobot_3.5.0.46/SendText.h diff --git a/DWeChatRobot/UserInfo.cpp b/DWeChatRobot_3.5.0.46/UserInfo.cpp similarity index 100% rename from DWeChatRobot/UserInfo.cpp rename to DWeChatRobot_3.5.0.46/UserInfo.cpp diff --git a/DWeChatRobot/UserInfo.h b/DWeChatRobot_3.5.0.46/UserInfo.h similarity index 100% rename from DWeChatRobot/UserInfo.h rename to DWeChatRobot_3.5.0.46/UserInfo.h diff --git a/DWeChatRobot/dllmain.cpp b/DWeChatRobot_3.5.0.46/dllmain.cpp similarity index 100% rename from DWeChatRobot/dllmain.cpp rename to DWeChatRobot_3.5.0.46/dllmain.cpp diff --git a/DWeChatRobot/framework.h b/DWeChatRobot_3.5.0.46/framework.h similarity index 100% rename from DWeChatRobot/framework.h rename to DWeChatRobot_3.5.0.46/framework.h diff --git a/DWeChatRobot/pch.cpp b/DWeChatRobot_3.5.0.46/pch.cpp similarity index 100% rename from DWeChatRobot/pch.cpp rename to DWeChatRobot_3.5.0.46/pch.cpp diff --git a/DWeChatRobot/pch.h b/DWeChatRobot_3.5.0.46/pch.h similarity index 100% rename from DWeChatRobot/pch.h rename to DWeChatRobot_3.5.0.46/pch.h diff --git a/DWeChatRobot_3.6.0.18/DWeChatRobot_3.6.0.18.vcxproj b/DWeChatRobot_3.6.0.18/DWeChatRobot_3.6.0.18.vcxproj new file mode 100644 index 0000000000000000000000000000000000000000..82fc3b931dd70278984eaf7c54ee88074253d234 --- /dev/null +++ b/DWeChatRobot_3.6.0.18/DWeChatRobot_3.6.0.18.vcxproj @@ -0,0 +1,188 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 16.0 + Win32Proj + {C0FC8DAB-0590-46AC-9270-6FEA45D52390} + MyWeChatRobot + 10.0 + DWeChatRobot_3.6.0.18 + + + + DynamicLibrary + true + v142 + Unicode + + + DynamicLibrary + false + v142 + true + Unicode + + + DynamicLibrary + true + v142 + Unicode + + + DynamicLibrary + false + v142 + true + Unicode + + + + + + + + + + + + + + + + + + + + + true + DWeChatRobot + + + false + DWeChatRobot + + + true + + + false + + + + Level3 + true + WIN32;_DEBUG;MYWECHATROBOT_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + true + Use + pch.h + + + Windows + true + false + + + + + Level3 + true + true + true + WIN32;NDEBUG;MYWECHATROBOT_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + true + Use + pch.h + + + Windows + true + true + true + false + + + + + Level3 + true + _DEBUG;MYWECHATROBOT_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + true + Use + pch.h + + + Windows + true + false + + + + + Level3 + true + true + true + NDEBUG;MYWECHATROBOT_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + true + Use + pch.h + + + Windows + true + true + true + false + + + + + + + + + + + + + + + + + + + Create + Create + Create + Create + + + + + + + + + + + + + \ No newline at end of file diff --git a/DWeChatRobot_3.6.0.18/DWeChatRobot_3.6.0.18.vcxproj.filters b/DWeChatRobot_3.6.0.18/DWeChatRobot_3.6.0.18.vcxproj.filters new file mode 100644 index 0000000000000000000000000000000000000000..19aec15fb2a5caa88ed6b1baa0ef38f13252f460 --- /dev/null +++ b/DWeChatRobot_3.6.0.18/DWeChatRobot_3.6.0.18.vcxproj.filters @@ -0,0 +1,114 @@ + + + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx + + + {b1463ca2-6055-4c67-8c42-6319a6171dd2} + + + {b22823ee-f629-4e0a-8358-da017f0e5c3a} + + + {912e6334-b078-4ba6-813c-66d0de3ee123} + + + {069b8c09-e473-4bba-a49e-571f35f2efef} + + + {25f77de8-b12c-4f2b-a3ac-0260b6a16897} + + + {8ad1ff87-550b-4942-8ebd-afbe1cfaddc9} + + + {24dc11dd-cb6a-4c63-bf21-35823cd389ab} + + + {564cc9ef-a939-4bfd-a420-a08b3072d198} + + + {722c02ee-dda5-4a6a-9443-f1ed3c112709} + + + {edd6e39f-235b-4db5-aea1-ec2c8d0072c5} + + + {fc747a68-6314-4f23-92de-a1e55275a01e} + + + + + 通用标头 + + + 通用标头 + + + 发送消息\发送图片 + + + 发送消息\发送文本 + + + 发送消息\发送文件 + + + 好友相关\好友列表 + + + 好友相关\好友信息 + + + 个人信息 + + + 发送消息\发送文章 + + + 发送消息\发送名片 + + + + + 通用函数 + + + 通用函数 + + + 发送消息\发送图片 + + + 发送消息\发送文本 + + + 发送消息\发送文件 + + + 好友相关\好友列表 + + + 好友相关\好友信息 + + + 个人信息 + + + 发送消息\发送文章 + + + 发送消息\发送名片 + + + \ No newline at end of file diff --git a/DWeChatRobot_3.6.0.18/DWeChatRobot_3.6.0.18.vcxproj.user b/DWeChatRobot_3.6.0.18/DWeChatRobot_3.6.0.18.vcxproj.user new file mode 100644 index 0000000000000000000000000000000000000000..0f14913f3c72094bb7b1e695e153ade04b17d5b0 --- /dev/null +++ b/DWeChatRobot_3.6.0.18/DWeChatRobot_3.6.0.18.vcxproj.user @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/DWeChatRobot_3.6.0.18/FriendList.cpp b/DWeChatRobot_3.6.0.18/FriendList.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e365b42e3f1afb8c5eb2ed5653900934e2fc44a5 --- /dev/null +++ b/DWeChatRobot_3.6.0.18/FriendList.cpp @@ -0,0 +1,97 @@ +#include "pch.h" +#include +using namespace std; +#define LeftTreeOffset 0x222F3BC + + +struct WxFriendStructW { + DWORD wxIdAddr; + DWORD wxNumberAddr; + DWORD wxNickNameAddr; + DWORD wxRemarkAddr; + WxFriendStructW(DWORD wxIdAddr, DWORD wxNumberAddr, DWORD wxNickNameAddr, DWORD wxRemarkAddr) { + this->wxIdAddr = wxIdAddr; + this->wxNumberAddr = wxNumberAddr; + this->wxNickNameAddr = wxNickNameAddr; + this->wxRemarkAddr = wxRemarkAddr; + } +}; + +vector WxFriendList; + +int GetFriendListInit() { + GetFriendList(); +#ifdef _DEBUG + cout << WxFriendList.size() << endl; +#endif + return WxFriendList.size(); +} + +DWORD GetFriendListRemote() { + if (WxFriendList.size() == 0) + return 0; +#ifdef _DEBUG + printf("0x%08X\n", (DWORD)&WxFriendList[0]); + printf("0x%08X\n", (DWORD)&(WxFriendList[0].wxIdAddr)); +#endif + return (DWORD)&WxFriendList[0].wxIdAddr; +} + +void GetFriendListFinish() { + WxFriendList.clear(); + cout << WxFriendList.size() << endl; +} + +void __stdcall GetFriendList() { + + DWORD WeChatWinBase = GetWeChatWinBase(); + DWORD LeftTreeAddr = 0; + DWORD RightTreeAddr = 0; + DWORD LeftTreeHead = 0; + DWORD baseAddr = WeChatWinBase + LeftTreeOffset; + printf("0x%08X\n", baseAddr); + __asm { + pushad; + mov eax, dword ptr[baseAddr]; + mov eax, dword ptr[eax]; + mov eax, dword ptr[eax + 0x4C]; + mov ecx, dword ptr[eax]; + mov LeftTreeAddr, ecx; + mov LeftTreeHead, eax; + mov ecx, dword ptr[eax + 0x4]; + mov RightTreeAddr, ecx; + popad; + } + + while (1) { + DWORD wxIdAddr = 0; + DWORD wxNumberAddr = 0; + DWORD wxNickNameAddr = 0; + DWORD wxRemarkAddr = 0; + + __asm { + pushad; + mov eax, dword ptr [LeftTreeAddr]; + mov ecx, eax; + add ecx, 0x30; + mov wxIdAddr, ecx; + mov ecx, eax; + add ecx, 0x44; + mov wxNumberAddr, ecx; + mov ecx, eax; + add ecx, 0x8C; + mov wxNickNameAddr, ecx; + mov ecx, eax; + add ecx, 0x78; + mov wxRemarkAddr, ecx; + mov ecx, dword ptr [eax]; + mov LeftTreeAddr, ecx; + popad; + } + WxFriendStructW p(wxIdAddr, wxNumberAddr, wxNickNameAddr, wxRemarkAddr); + WxFriendList.push_back(p); + if (LeftTreeAddr == LeftTreeHead) { + break; + } + } +} \ No newline at end of file diff --git a/DWeChatRobot_3.6.0.18/FriendList.h b/DWeChatRobot_3.6.0.18/FriendList.h new file mode 100644 index 0000000000000000000000000000000000000000..5ab556de2bb610b131b67d0c5c409fade0a78df3 --- /dev/null +++ b/DWeChatRobot_3.6.0.18/FriendList.h @@ -0,0 +1,6 @@ +#pragma once +void __stdcall GetFriendList(); + +extern "C" __declspec(dllexport) DWORD GetFriendListRemote(); +extern "C" __declspec(dllexport) int GetFriendListInit(); +extern "C" __declspec(dllexport) void GetFriendListFinish(); \ No newline at end of file diff --git a/DWeChatRobot_3.6.0.18/SelfInfo.cpp b/DWeChatRobot_3.6.0.18/SelfInfo.cpp new file mode 100644 index 0000000000000000000000000000000000000000..66138101a2aab7171e750e0bfa068037068667e1 --- /dev/null +++ b/DWeChatRobot_3.6.0.18/SelfInfo.cpp @@ -0,0 +1,85 @@ +#include "pch.h" +#include + +wstring selfinfo = L""; + +struct SelfInfoStruct { + DWORD message; + DWORD length; +} ret; + +DWORD GetSelfInfoRemote() { + DWORD WeChatWinBase = GetWeChatWinBase(); + vector SelfInfoAddr = { + *(DWORD*)(WeChatWinBase + 0x222EB3C), + WeChatWinBase + 0x222ED30, + WeChatWinBase + 0x222EBB4, + *(DWORD*)(WeChatWinBase + 0x222ECEC), + *(DWORD*)(WeChatWinBase + 0x222EE94), + *(DWORD*)(WeChatWinBase + 0x222EEAC), + WeChatWinBase + 0x222EF30, + WeChatWinBase + 0x222ECBC, + WeChatWinBase + 0x222ECD4, + WeChatWinBase + 0x222EBE8 + }; + + vector SelfInfoKey = { + L"\"wxId\"", + L"\"wxNumber\"", + L"\"wxNickName\"", + L"\"wxSignature\"", + L"\"wxBigAvatar\"", + L"\"wxSmallAvatar\"", + L"\"wxNation\"", + L"\"wxProvince\"", + L"\"wxCity\"", + L"\"PhoneNumber\"" + }; +#ifdef _DEBUG + wcout.imbue(locale("chs")); +#endif + selfinfo = selfinfo + L"{"; + for (unsigned int i = 0; i < SelfInfoAddr.size(); i++) { + selfinfo = selfinfo + SelfInfoKey[i] + L":"; + selfinfo = selfinfo + L"\""; + char* temp = NULL; + if (!SelfInfoKey[i].compare(L"\"wxNickName\"")) { + if (*(DWORD*)(SelfInfoAddr[i] + 0x14) == 0xF) { + temp = (*((DWORD*)SelfInfoAddr[i]) != 0) ? (char*)SelfInfoAddr[i] : (char*)"null"; + } + else { + temp = (*((DWORD*)SelfInfoAddr[i]) != 0) ? (char*)(*(DWORD*)SelfInfoAddr[i]) : (char*)"null"; + } + } + else { + temp = (char*)SelfInfoAddr[i]; + if (strlen(temp) == 0) + temp = (char*)"null"; + } + wchar_t* wtemp = new wchar_t[strlen(temp) + 1]; + ZeroMemory(wtemp, (strlen(temp) + 1) * 2); + MultiByteToWideChar(CP_UTF8, 0, temp, -1, wtemp, strlen(temp) + 1); + selfinfo = selfinfo + wtemp; + selfinfo = selfinfo + L"\""; + if(i!= SelfInfoAddr.size() - 1) + selfinfo = selfinfo + L","; + delete[] wtemp; + wtemp = NULL; + } + selfinfo = selfinfo + L"}"; + ret.message = (DWORD)selfinfo.c_str(); + ret.length = selfinfo.length(); +#ifdef _DEBUG + wcout << selfinfo << endl; + DeleteSelfInfoCacheRemote(); +#endif + return (DWORD)&ret; +} + +VOID DeleteSelfInfoCacheRemote() { + if (ret.length) { + ZeroMemory((wchar_t*)ret.message, ret.length*2 + 2); + ret.length = 0; + selfinfo = L""; + } +} \ No newline at end of file diff --git a/DWeChatRobot_3.6.0.18/SelfInfo.h b/DWeChatRobot_3.6.0.18/SelfInfo.h new file mode 100644 index 0000000000000000000000000000000000000000..910ba8ebbd484c653e8001e73ab9f3a1b0e03971 --- /dev/null +++ b/DWeChatRobot_3.6.0.18/SelfInfo.h @@ -0,0 +1,6 @@ +#pragma once +#include +#include +using namespace std; +extern "C" __declspec(dllexport) DWORD GetSelfInfoRemote(); +extern "C" __declspec(dllexport) VOID DeleteSelfInfoCacheRemote(); \ No newline at end of file diff --git a/DWeChatRobot_3.6.0.18/SendArticle.cpp b/DWeChatRobot_3.6.0.18/SendArticle.cpp new file mode 100644 index 0000000000000000000000000000000000000000..b1507b800796205f8715a205443114414434e47f --- /dev/null +++ b/DWeChatRobot_3.6.0.18/SendArticle.cpp @@ -0,0 +1,100 @@ +#include "pch.h" + +#define SendArticleCall1Offset 0x0F7454F0 - 0x0F6B0000 +#define SendArticleCall2Offset 0x0FA41F80 - 0x0F6B0000 +#define SendArticleCall3Offset 0x0F7794A0 - 0x0F6B0000 +#define SendArticleCall4Offset 0x0FA42150 - 0x0F6B0000 +#define SendArticleParamOffset 0x118EEC34 - 0x0F6B0000 + +#define SendArticleClearCacheCall1Offset 0x0FCEB4F0 - 0x0F6B0000 +#define SendArticleClearCacheCall2Offset 0x0F744200 - 0x0F6B0000 + +struct SendArticleStruct { + DWORD wxid; + DWORD title; + DWORD abstract; + DWORD url; +}; + +VOID SendArticleRemote(LPVOID lparameter) { + SendArticleStruct* sas = (SendArticleStruct*)lparameter; + wchar_t* wxid = (wchar_t*)sas->wxid; + wchar_t* title = (wchar_t*)sas->title; + wchar_t* abstract = (wchar_t*)sas->abstract; + wchar_t* url = (wchar_t*)sas->url; + SendArticle(wxid,title,abstract,url); +} + +BOOL __stdcall SendArticle(wchar_t* wxid,wchar_t* title, wchar_t* abstract, wchar_t* url) { + DWORD WeChatWinBase = GetWeChatWinBase(); + DWORD SendArticleCall1 = WeChatWinBase + SendArticleCall1Offset; + DWORD SendArticleCall2 = WeChatWinBase + SendArticleCall2Offset; + DWORD SendArticleCall3 = WeChatWinBase + SendArticleCall3Offset; + DWORD SendArticleCall4 = WeChatWinBase + SendArticleCall4Offset; + + DWORD SendArticleParam = WeChatWinBase + SendArticleParamOffset; + + DWORD SendArticleClearCacheCall1 = WeChatWinBase + SendArticleClearCacheCall1Offset; + DWORD SendArticleClearCacheCall2 = WeChatWinBase + SendArticleClearCacheCall2Offset; + // Լwxid + char* sselfwxid = (char*)(*(DWORD*)(WeChatWinBase + 0x222EB3C)); + wchar_t* wselfwxid = new wchar_t[strlen(sselfwxid) + 1]; + MultiByteToWideChar(CP_ACP, MB_COMPOSITE, sselfwxid, -1, wselfwxid, strlen(sselfwxid) + 1); + // xml + wchar_t* xmlbuffer = new wchar_t[0x2000]; + ZeroMemory(xmlbuffer, 0x2000 * 2); + swprintf_s(xmlbuffer,0x2000, (wchar_t*)L"\n %ws\n 0\n \n \n %ws\n %ws\n view\n 5\n 0\n \n %ws\n \n \n \n \n \n \n \n \n \n \n \n \n \n 0\n \n \n \n \n \n \n \n \n \n 0\n \n \n \n \n 1\n Window wechat\n \n", + wselfwxid,title,abstract,url); + + DWORD sendtype = 0x5; + WxBaseStruct pSender(wselfwxid); + char nullbuffer[0x1C] = { 0 }; + WxBaseStruct pXml(xmlbuffer); + WxBaseStruct pReceiver(wxid); + WxString imgbuffer = { 0 }; + WxString nullStruct = { 0 }; + char buffer[0xF90] = { 0 }; + DWORD isSuccess = 0x0; + __asm { + pushad; + pushfd; + lea ecx, buffer; + call SendArticleCall1; + mov eax, [sendtype]; + push eax; + lea eax, nullbuffer; + lea edx, pSender; + push eax; + lea eax, imgbuffer; + push eax; + lea eax, pXml; + push eax; + lea edi, pReceiver; + push edi; + lea ecx, buffer; + call SendArticleCall2; + add esp, 0x14; + lea eax, nullStruct; + push eax; + lea ecx, buffer; + call SendArticleCall3; + mov dl, 0x0; + lea ecx, buffer; + push SendArticleParam; + push SendArticleParam; + call SendArticleCall4; + mov isSuccess, eax; + add esp, 0x8; + lea ecx, buffer; + call SendArticleClearCacheCall1; + lea ecx, buffer; + call SendArticleClearCacheCall2; + popfd; + popad; + } + delete[] xmlbuffer; + xmlbuffer = NULL; + delete[] wselfwxid; + wselfwxid = NULL; + return (isSuccess == 0x1); +} \ No newline at end of file diff --git a/DWeChatRobot_3.6.0.18/SendArticle.h b/DWeChatRobot_3.6.0.18/SendArticle.h new file mode 100644 index 0000000000000000000000000000000000000000..5ce08585361e42d6c9f57af62256b9ef231fb826 --- /dev/null +++ b/DWeChatRobot_3.6.0.18/SendArticle.h @@ -0,0 +1,4 @@ +#pragma once +#include +extern "C" __declspec(dllexport) VOID SendArticleRemote(LPVOID lparameter); +BOOL __stdcall SendArticle(wchar_t* wxid, wchar_t* title, wchar_t* abstract, wchar_t* url); \ No newline at end of file diff --git a/DWeChatRobot_3.6.0.18/SendCard.cpp b/DWeChatRobot_3.6.0.18/SendCard.cpp new file mode 100644 index 0000000000000000000000000000000000000000..76d37dbccc943e55df7e9249e763f953f904cafc --- /dev/null +++ b/DWeChatRobot_3.6.0.18/SendCard.cpp @@ -0,0 +1,51 @@ +#include "pch.h" + +#define SendCardCallOffset 0x644FE7B0 - 0x64040000 +#define DeleteCardCacheCallOffset 0x640D4200 - 0x64040000 + +struct SendCardStruct { + DWORD receiver; + DWORD sharedwxid; + DWORD nickname; +}; + +VOID SendCardRemote(LPVOID lparameter) { + SendCardStruct* scs = (SendCardStruct*)lparameter; + wchar_t* receiver = (WCHAR*)scs->receiver; + wchar_t* sharedwxid = (WCHAR*)scs->sharedwxid; + wchar_t* nickname = (WCHAR*)scs->nickname; + SendCard(receiver,sharedwxid,nickname); +} + +BOOL __stdcall SendCard(wchar_t* receiver, wchar_t* sharedwxid, wchar_t* nickname) { + DWORD WeChatWinBase = GetWeChatWinBase(); + DWORD SendCardCall = WeChatWinBase + SendCardCallOffset; + DWORD DeleteCardCacheCall = WeChatWinBase + DeleteCardCacheCallOffset; + wchar_t* xml = new wchar_t[0x2000]; + ZeroMemory(xml, 0x2000 * 2); + swprintf_s(xml, 0x2000,L"", + sharedwxid, nickname, sharedwxid); + WxBaseStruct pReceiver(receiver); + WxBaseStruct pXml(xml); + char buffer[0x2D0] = { 0 }; + DWORD isSuccess = 0x1; + + __asm { + pushad; + push 0x2A; + lea eax, pXml; + lea edx, pReceiver; + push 0x0; + push eax; + lea ecx, buffer; + call SendCardCall; + add esp, 0xC; + lea ecx, buffer; + call DeleteCardCacheCall; + mov isSuccess, eax; + popad; + } + delete[] xml; + xml = NULL; + return isSuccess; +} \ No newline at end of file diff --git a/DWeChatRobot_3.6.0.18/SendCard.h b/DWeChatRobot_3.6.0.18/SendCard.h new file mode 100644 index 0000000000000000000000000000000000000000..892ab26a44650eeaadd054fccd466f9892ff7323 --- /dev/null +++ b/DWeChatRobot_3.6.0.18/SendCard.h @@ -0,0 +1,4 @@ +#pragma once +#include +extern "C" __declspec(dllexport) VOID SendCardRemote(LPVOID lparameter); +BOOL __stdcall SendCard(wchar_t* receiver, wchar_t* sharedwxid, wchar_t* nickname); \ No newline at end of file diff --git a/DWeChatRobot_3.6.0.18/SendFile.cpp b/DWeChatRobot_3.6.0.18/SendFile.cpp new file mode 100644 index 0000000000000000000000000000000000000000..3ce9478b49aa7c77feeb1f8773baa119cce9755e --- /dev/null +++ b/DWeChatRobot_3.6.0.18/SendFile.cpp @@ -0,0 +1,126 @@ +#include "pch.h" + +#define SendFileCall1Offset (0x67A71DC0 - 0x67370000) +#define SendFileCall2Offset (0x68D81C83 - 0x67370000) +#define SendFileCall3Offset (0x68D8047A - 0x67370000) +#define SendFileCall4Offset (0x67702260 - 0x67370000) +#define SendFileParamsOffset (0x6959F170 - 0x67370000) + +#define DeleteSendFileCacheCallOffset (0x67404200 - 0x67370000) + +struct FileParamStruct { + DWORD wxid; + DWORD filepath; +}; + +struct WxFileStruct { + int type = 3; + wchar_t* buffer; + DWORD length; + DWORD maxLength; + char fill[0x34] = { 0 }; + + WxFileStruct(wchar_t* pStr) { + buffer = pStr; + length = wcslen(pStr); + maxLength = wcslen(pStr) * 2; + } +}; + +void SendFileRemote(LPVOID lpParamStruct) { + FileParamStruct* params = (FileParamStruct*)lpParamStruct; + SendFile((WCHAR*)params->wxid, (WCHAR*)params->filepath); +} + +void __stdcall SendFile(wchar_t* receiver, wchar_t* FilePath) { + WxBaseStruct pReceiver(receiver); + WxBaseStruct pFilePath(FilePath); + WxFileStruct esi_(FilePath); + + DWORD WeChatWinBase = GetWeChatWinBase(); + + DWORD WxSendFileCall1 = WeChatWinBase + SendFileCall1Offset; + DWORD WxSendFileCall2 = WeChatWinBase + SendFileCall2Offset; + DWORD WxSendFileCall3 = WeChatWinBase + SendFileCall3Offset; + DWORD WxSendFileCall4 = WeChatWinBase + SendFileCall4Offset; + DWORD WxSendFileParams = WeChatWinBase + SendFileParamsOffset; + DWORD DeleteSendFileCacheCall = WeChatWinBase + DeleteSendFileCacheCallOffset; + + char buffer[0x3B0] = { 0 }; + + DWORD edi_ = pReceiver.length; + DWORD ptrReceiver = (DWORD)pReceiver.buffer; + + DWORD tempecx = 0; + + __asm { + pushad; + pushfd; + lea esi, esi_; + push 0; + push 0; + push 0; + push 0; + push 0; + push 0x005A0000; + sub esp, 0x14; + mov edi, esp; + mov dword ptr ds : [edi] , 0x0; + mov dword ptr ds : [edi + 0x4] , 0x0; + mov dword ptr ds : [edi + 0x8] , 0x0; + mov dword ptr ds : [edi + 0xC] , 0x0; + mov dword ptr ds : [edi + 0x10] , 0x0; + + sub esp, 0x14; + lea eax, dword ptr ds : [esi + 0x4] ; + mov ecx, esp; + push eax; + call WxSendFileCall1; + + sub esp, 0x14; + mov ecx, esp; + mov dword ptr ds : [ecx] , 0x0; + mov dword ptr ds : [ecx + 0x4] , 0x0; + mov dword ptr ds : [ecx + 0x8] , 0x0; + mov dword ptr ds : [ecx + 0xC] , 0x0; + mov dword ptr ds : [ecx + 0x10] , 0x0; + + lea edx, pReceiver; + mov eax, [edx]; + + mov edi, edi_; + lea eax, dword ptr ds : [edi * 2 + 0x2] ; + mov tempecx, ecx; + push eax; + push dword ptr ds : [ecx] ; + call WxSendFileCall2; + mov ecx, [tempecx]; + mov edx, eax; + add esp, 0x8; + + mov eax, dword ptr ds : [ecx + 0x4] ; + mov dword ptr ds : [ecx] , edx; + mov dword ptr ds : [ecx + 0x8] , edi; + mov tempecx, ecx; + push edi; + push ptrReceiver; + push dword ptr ds : [ecx] ; + call WxSendFileCall3; + mov ecx, [tempecx]; + add esp, 0xC; + + mov edx, 0x0; + mov eax, dword ptr ds : [ecx] ; + mov word ptr ds : [eax + edi * 2] , 0x0; + mov dword ptr ds : [ecx + 0x4] , edi; + + mov ecx, WxSendFileParams; + lea eax, buffer; + push eax; + call WxSendFileCall4; + lea ecx, buffer; + call DeleteSendFileCacheCall; + popfd; + popad; + } +} \ No newline at end of file diff --git a/DWeChatRobot_3.6.0.18/SendFile.h b/DWeChatRobot_3.6.0.18/SendFile.h new file mode 100644 index 0000000000000000000000000000000000000000..c0b081648f7efb1b6a99253f3045dc966f86b17f --- /dev/null +++ b/DWeChatRobot_3.6.0.18/SendFile.h @@ -0,0 +1,5 @@ +#pragma once +#include + +void __stdcall SendFile(wchar_t* receiver, wchar_t* FilePath); +extern "C" __declspec(dllexport) void SendFileRemote(LPVOID lpParamStruct); \ No newline at end of file diff --git a/DWeChatRobot_3.6.0.18/SendImage.cpp b/DWeChatRobot_3.6.0.18/SendImage.cpp new file mode 100644 index 0000000000000000000000000000000000000000..e99bd055233e798ad3f77328cdac7deb4641282f --- /dev/null +++ b/DWeChatRobot_3.6.0.18/SendImage.cpp @@ -0,0 +1,51 @@ +#include "pch.h" + +#define SendImageCall1Offset (0x6740A1C0 - 0x67370000) +#define SendImageCall2Offset (0x67A71DC0 - 0x67370000) +#define SendImageCall3Offset (0x6782E160 - 0x67370000) +#define DeleteSendImageCacheCallOffset (0x67404200 - 0x67370000) + +struct ImageParamStruct { + DWORD wxid; + DWORD imagepath; +}; + +void SendImageRemote(LPVOID lpParamStruct) { + ImageParamStruct* params = (ImageParamStruct*)lpParamStruct; + SendImage((WCHAR*)params->wxid, (WCHAR*)params->imagepath); +} + +void __stdcall SendImage(wchar_t* receiver, wchar_t* ImagePath) { + DWORD WeChatWinBase = GetWeChatWinBase(); + DWORD SendImageCall1 = WeChatWinBase + SendImageCall1Offset; + DWORD SendImageCall2 = WeChatWinBase + SendImageCall2Offset; + DWORD SendImageCall3 = WeChatWinBase + SendImageCall3Offset; + DWORD DeleteSendImageCacheCall = WeChatWinBase + DeleteSendImageCacheCallOffset; + char nullbuffer[0x50] = { 0 }; + char buffer[0x3B0] = { 0 }; + WxBaseStruct pReceiver(receiver); + WxBaseStruct pImagePath(ImagePath); + WxString nullStruct = { 0 }; + + __asm { + pushad; + call SendImageCall1; + sub esp, 0x14; + mov ebx, eax; + lea eax, nullStruct; + mov ecx, esp; + lea edi, pImagePath; + push eax; + call SendImageCall2; + mov ecx, ebx; + lea eax, pReceiver; + push edi; + push eax; + lea eax, buffer; + push eax; + call SendImageCall3; + lea ecx, buffer; + call DeleteSendImageCacheCall; + popad; + } +} \ No newline at end of file diff --git a/DWeChatRobot_3.6.0.18/SendImage.h b/DWeChatRobot_3.6.0.18/SendImage.h new file mode 100644 index 0000000000000000000000000000000000000000..57cdd2e678abdadc4a3f15e73d82464f6aa0735a --- /dev/null +++ b/DWeChatRobot_3.6.0.18/SendImage.h @@ -0,0 +1,5 @@ +#pragma once +#include + +void __stdcall SendImage(wchar_t* receiver, wchar_t* ImagePath); +extern "C" __declspec(dllexport) void SendImageRemote(LPVOID lpParamStruct); \ No newline at end of file diff --git a/DWeChatRobot_3.6.0.18/SendText.cpp b/DWeChatRobot_3.6.0.18/SendText.cpp new file mode 100644 index 0000000000000000000000000000000000000000..c1842d9e5390376dad92028fbb0dbac977dbc374 --- /dev/null +++ b/DWeChatRobot_3.6.0.18/SendText.cpp @@ -0,0 +1,45 @@ +#include "pch.h" + +#define SendTextCallOffset 0x6782E7B0 - 0x67370000 +#define DeleteTextCacheCallOffset 0x67404200 - 0x67370000 + +struct SendTextStruct +{ + DWORD wxid; + DWORD wxmsg; +}; + +void SendTextRemote(LPVOID lpParameter) { + SendTextStruct* rp = (SendTextStruct*)lpParameter; + wchar_t* wsWxId = (WCHAR*)rp->wxid; + wchar_t* wsTextMsg = (WCHAR*)rp->wxmsg; + SendText(wsWxId, wsTextMsg); +} + +void __stdcall SendText(wchar_t* wsWxId, wchar_t* wsTextMsg) { + WxBaseStruct wxWxid(wsWxId); + WxBaseStruct wxTextMsg(wsTextMsg); + wchar_t** pWxmsg = &wxTextMsg.buffer; + char buffer[0x3B0] = { 0 }; + + WxString wxNull = { 0 }; + DWORD dllBaseAddress = GetWeChatWinBase(); + DWORD callAddress = dllBaseAddress + SendTextCallOffset; + DWORD DeleteTextCacheCall = dllBaseAddress + DeleteTextCacheCallOffset; + + __asm { + pushad; + lea eax, wxNull; + push 0x1; + push eax; + mov edi, pWxmsg; + push edi; + lea edx, wxWxid; + lea ecx, buffer; + call callAddress; + add esp, 0xC; + lea ecx, buffer; + call DeleteTextCacheCall; + popad; + } +} \ No newline at end of file diff --git a/DWeChatRobot_3.6.0.18/SendText.h b/DWeChatRobot_3.6.0.18/SendText.h new file mode 100644 index 0000000000000000000000000000000000000000..7a347e476e0f43ab610cb2744a2d323426704e63 --- /dev/null +++ b/DWeChatRobot_3.6.0.18/SendText.h @@ -0,0 +1,5 @@ +#pragma once +#include + +void __stdcall SendText(wchar_t* wsWxId, wchar_t* wsTextMsg); +extern "C" __declspec(dllexport) void SendTextRemote(LPVOID lpParameter); \ No newline at end of file diff --git a/DWeChatRobot_3.6.0.18/UserInfo.cpp b/DWeChatRobot_3.6.0.18/UserInfo.cpp new file mode 100644 index 0000000000000000000000000000000000000000..160a3c43166064896b164c0a4b909d954ad37847 --- /dev/null +++ b/DWeChatRobot_3.6.0.18/UserInfo.cpp @@ -0,0 +1,129 @@ +#include "pch.h" +#include +#include +#include + +#define GetUserInfoCall0Offset 0x6740A000 - 0x67370000 +#define GetUserInfoCall1Offset 0x679C9840 - 0x67370000 +#define GetUserInfoCall2Offset 0x67A71DC0 - 0x67370000 +#define GetUserInfoCall3Offset 0x677724A0 - 0x67370000 + +#define DeleteUserInfoCacheCall1Offset 0x67775990 - 0x67370000 +#define DeleteUserInfoCacheCall2Offset 0x679CA340 - 0x67370000 + +struct GetUserInfoStruct { + DWORD message; + DWORD length; +}; + +wstring wUserInfo = L""; +GetUserInfoStruct ret = { 0 }; + +VOID WxUserInfo(DWORD address) { + vector InfoType{ + address + 0x10, + address + 0x24, + address + 0x38, + address + 0x6C, + address + 0xFC, + address + 0x110, + address + 0x19C, + address + 0x1B0, + address + 0x1C4, + address + 0x1D8, + address + 0x27C + }; + vector InfoTypeName{ + (WCHAR*)L"\"wxId\"", + (WCHAR*)L"\"wxNumber\"", + (WCHAR*)L"\"wxV3\"", + (WCHAR*)L"\"wxNickName\"", + (WCHAR*)L"\"wxBigAvatar\"", + (WCHAR*)L"\"wxSmallAvatar\"", + (WCHAR*)L"\"wxSignature\"", + (WCHAR*)L"\"wxNation\"", + (WCHAR*)L"\"wxProvince\"", + (WCHAR*)L"\"wxCity\"", + (WCHAR*)L"\"wxBackground\"", + }; + wUserInfo += L"{"; + for (unsigned int i = 0; i < InfoType.size(); i++) { + wchar_t* wstemp = ((*((DWORD*)InfoType[i])) != 0) ? (WCHAR*)(*((LPVOID*)InfoType[i])) : (WCHAR*)L"null"; + wUserInfo = wUserInfo + InfoTypeName[i] + L":\"" + wstemp + L"\""; + if (i != InfoType.size() - 1) { + wUserInfo += L","; + } + } + wUserInfo += L"}"; +#ifdef _DEBUG + wcout.imbue(locale("chs")); + wcout << wUserInfo.c_str() << endl; +#endif +} + + +DWORD GetWxUserInfoRemote(LPVOID lparamter) { + wchar_t* userwxid = (wchar_t*)lparamter; + + if (!GetUserInfoByWxId(userwxid)) { + return 0; + } + ret.message = (DWORD)wUserInfo.c_str(); + ret.length = (DWORD)wUserInfo.length(); + return (DWORD)&ret; +} + +VOID DeleteUserInfoCacheRemote() { + if (ret.length) { + ZeroMemory((wchar_t*)ret.message, ret.length * 2 + 2); + ret.length = 0; + wUserInfo = L""; + } +} + +BOOL __stdcall GetUserInfoByWxId(wchar_t* wxid) { + DWORD WeChatWinBase = GetWeChatWinBase(); + DWORD WxGetUserInfoCall0 = WeChatWinBase + GetUserInfoCall0Offset; + DWORD WxGetUserInfoCall1 = WeChatWinBase + GetUserInfoCall1Offset; + DWORD WxGetUserInfoCall2 = WeChatWinBase + GetUserInfoCall2Offset; + DWORD WxGetUserInfoCall3 = WeChatWinBase + GetUserInfoCall3Offset; + DWORD DeleteUserInofCacheCall1 = WeChatWinBase + DeleteUserInfoCacheCall1Offset; + DWORD DeleteUserInofCacheCall2 = WeChatWinBase + DeleteUserInfoCacheCall2Offset; + char buffer[0x3FC] = { 0 }; + WxBaseStruct pWxid(wxid); + DWORD address = 0; + DWORD isSuccess = 0; + __asm + { + pushad; + call WxGetUserInfoCall0; + mov edi, eax; + lea ecx, buffer; + call WxGetUserInfoCall1; + lea eax, buffer; + mov address, eax; + push eax; + sub esp, 0x14; + mov ecx, esp; + lea esi, pWxid; + push esi; + call WxGetUserInfoCall2; + mov ecx, edi; + call WxGetUserInfoCall3; + mov isSuccess, eax; + popad; + } + if(isSuccess) + WxUserInfo(address); + __asm { + pushad; + lea eax, buffer; + push eax; + call DeleteUserInofCacheCall1; + lea ecx, buffer; + mov esi, eax; + call DeleteUserInofCacheCall2; + popad; + } + return isSuccess; +} \ No newline at end of file diff --git a/DWeChatRobot_3.6.0.18/UserInfo.h b/DWeChatRobot_3.6.0.18/UserInfo.h new file mode 100644 index 0000000000000000000000000000000000000000..465776e1db2f3b11204b917082d7cb2d2fc09622 --- /dev/null +++ b/DWeChatRobot_3.6.0.18/UserInfo.h @@ -0,0 +1,5 @@ +#pragma once +#include +BOOL __stdcall GetUserInfoByWxId(wchar_t* wxid); +extern "C" __declspec(dllexport) DWORD GetWxUserInfoRemote(LPVOID lparamter); +extern "C" __declspec(dllexport) VOID DeleteUserInfoCacheRemote(); \ No newline at end of file diff --git a/DWeChatRobot_3.6.0.18/dllmain.cpp b/DWeChatRobot_3.6.0.18/dllmain.cpp new file mode 100644 index 0000000000000000000000000000000000000000..8657c4cbd1a0570f4b932217d8e8cd72e6845f59 --- /dev/null +++ b/DWeChatRobot_3.6.0.18/dllmain.cpp @@ -0,0 +1,46 @@ +// dllmain.cpp : 定义 DLL 应用程序的入口点。 +#include "pch.h" + +#ifdef _DEBUG + int detach_count = 0; +#endif + +BOOL APIENTRY DllMain( HMODULE hModule, + DWORD ul_reason_for_call, + LPVOID lpReserved + ) +{ + switch (ul_reason_for_call) + { + case DLL_PROCESS_ATTACH: + { +#ifdef _DEBUG + CreateConsole(); + DWORD base = (DWORD)GetModuleHandleA("DWeChatRobot.dll"); + + printf("SendImage 0x%08X\n", (DWORD)SendImage); + printf("SendText 0x%08X\n", (DWORD)SendText); + printf("SendFile 0x%08X\n", (DWORD)SendFile); + printf("GetFriendList 0x%08X\n", (DWORD)GetFriendList); + printf("GetUserInfoByWxId 0x%08X\n", (DWORD)GetUserInfoByWxId); + printf("SendArticle 0x%08X\n", (DWORD)SendArticle); + printf("SendCard 0x%08X\n", (DWORD)SendCard); +#endif + break; + } + case DLL_THREAD_ATTACH: + case DLL_THREAD_DETACH: + case DLL_PROCESS_DETACH: { +#ifdef _DEBUG + detach_count++; + if (detach_count != 1) { + // FreeConsole(); + // UnHookAll(); + } +#endif + break; + } + } + return TRUE; +} + diff --git a/DWeChatRobot_3.6.0.18/framework.h b/DWeChatRobot_3.6.0.18/framework.h new file mode 100644 index 0000000000000000000000000000000000000000..3f0fc4ac20254c2a75028938d8faae302f52f73b --- /dev/null +++ b/DWeChatRobot_3.6.0.18/framework.h @@ -0,0 +1,5 @@ +#pragma once + +#define WIN32_LEAN_AND_MEAN // 从 Windows 头文件中排除极少使用的内容 +// Windows 头文件 +#include diff --git a/DWeChatRobot_3.6.0.18/pch.cpp b/DWeChatRobot_3.6.0.18/pch.cpp new file mode 100644 index 0000000000000000000000000000000000000000..0facc600694413d9a13e72b9ff8bfd0a4a291828 --- /dev/null +++ b/DWeChatRobot_3.6.0.18/pch.cpp @@ -0,0 +1,67 @@ +// pch.cpp: 与预编译标头对应的源文件 + +#include "pch.h" + +// 当使用预编译的头时,需要使用此源文件,编译才能成功。 +BOOL CreateConsole(void) { + if (AllocConsole()) { + AttachConsole(GetCurrentProcessId()); + FILE* retStream; + freopen_s(&retStream, "CONOUT$", "w", stdout); + if (!retStream) throw std::runtime_error("Stdout redirection failed."); + freopen_s(&retStream, "CONOUT$", "w", stderr); + if (!retStream) throw std::runtime_error("Stderr redirection failed."); + return 0; + } + return 1; +} + +DWORD GetWeChatWinBase() { + return (DWORD)GetModuleHandleA("WeChatWin.dll"); +} + +void Wchar_tToString(std::string& szDst, wchar_t* wchar) +{ + wchar_t* wText = wchar; + DWORD dwNum = WideCharToMultiByte(CP_OEMCP, NULL, wText, -1, NULL, 0, NULL, FALSE);// WideCharToMultiByte的运用 + char* psText; // psText为char*的临时数组,作为赋值给std::string的中间变量 + psText = new char[dwNum]; + WideCharToMultiByte(CP_OEMCP, NULL, wText, -1, psText, dwNum, NULL, FALSE);// WideCharToMultiByte的再次运用 + szDst = psText;// std::string赋值 + delete[]psText;// psText的清除 +} + +void HookAnyAddress(DWORD dwHookAddr, LPVOID dwJmpAddress,char* originalRecieveCode) +{ + //组装跳转数据 + BYTE jmpCode[5] = { 0 }; + jmpCode[0] = 0xE9; + + //计算偏移 + *(DWORD*)&jmpCode[1] = (DWORD)dwJmpAddress - dwHookAddr - 5; + + // 保存以前的属性用于还原 + DWORD OldProtext = 0; + + // 因为要往代码段写入数据,又因为代码段是不可写的,所以需要修改属性 + VirtualProtect((LPVOID)dwHookAddr, 5, PAGE_EXECUTE_READWRITE, &OldProtext); + ReadProcessMemory(GetCurrentProcess(), (LPVOID)dwHookAddr, originalRecieveCode, 5, 0); + + //写入自己的代码 + memcpy((void*)dwHookAddr, jmpCode, 5); + + // 执行完了操作之后需要进行还原 + VirtualProtect((LPVOID)dwHookAddr, 5, OldProtext, &OldProtext); +} + +void UnHookAnyAddress(DWORD dwHookAddr, char* originalRecieveCode) +{ + DWORD OldProtext = 0; + VirtualProtect((LPVOID)dwHookAddr, 5, PAGE_EXECUTE_READWRITE, &OldProtext); + WriteProcessMemory(GetCurrentProcess(), (LPVOID)dwHookAddr, originalRecieveCode, 5, 0); + VirtualProtect((LPVOID)dwHookAddr, 5, OldProtext, &OldProtext); +} + +void UnHookAll() { + return; +} \ No newline at end of file diff --git a/DWeChatRobot_3.6.0.18/pch.h b/DWeChatRobot_3.6.0.18/pch.h new file mode 100644 index 0000000000000000000000000000000000000000..048c94ca97dfbcfc7b603144f351e63c0650d8f8 --- /dev/null +++ b/DWeChatRobot_3.6.0.18/pch.h @@ -0,0 +1,59 @@ +// pch.h: 这是预编译标头文件。 +// 下方列出的文件仅编译一次,提高了将来生成的生成性能。 +// 这还将影响 IntelliSense 性能,包括代码完成和许多代码浏览功能。 +// 但是,如果此处列出的文件中的任何一个在生成之间有更新,它们全部都将被重新编译。 +// 请勿在此处添加要频繁更新的文件,这将使得性能优势无效。 +#pragma once +#ifndef PCH_H +#define PCH_H + +// 添加要在此处预编译的标头 +#include "framework.h" +#include +#include +#include "SendImage.h" +#include "SendText.h" +#include "SendFile.h" +#include "SendArticle.h" +#include "FriendList.h" +#include "UserInfo.h" +#include "SelfInfo.h" +#include "SendCard.h" +#endif //PCH_H + +using namespace std; +#define DLLEXPORT extern "C" __declspec(dllexport) + +struct WxBaseStruct +{ + wchar_t* buffer; + DWORD length; + DWORD maxLength; + DWORD fill1; + DWORD fill2; + + WxBaseStruct(wchar_t* pStr) { + buffer = pStr; + length = wcslen(pStr); + maxLength = wcslen(pStr) * 2; + fill1 = 0x0; + fill2 = 0x0; + } +}; + +struct WxString +{ + wchar_t* buffer; + DWORD length; + DWORD maxLength; + DWORD fill1 = 0; + DWORD fill2 = 0; +}; + + +BOOL CreateConsole(void); +DWORD GetWeChatWinBase(); +void Wchar_tToString(std::string& szDst, wchar_t* wchar); +void HookAnyAddress(DWORD dwHookAddr, LPVOID dwJmpAddress, char* originalRecieveCode); +void UnHookAnyAddress(DWORD dwHookAddr, char* originalRecieveCode); +DLLEXPORT void UnHookAll(); diff --git a/Release/DWeChatRobot.dll b/Release/DWeChatRobot.dll index 879ae5149992b6f41308884ef5933ba0f328ea33..1dc777308972322161b13e49bbb1cf9fe19c3ac3 100644 Binary files a/Release/DWeChatRobot.dll and b/Release/DWeChatRobot.dll differ diff --git a/wxRobot.py b/wxRobot.py index 879522253e9c31671967959e51d82e7f5d57f48b..47b0d0e2fb2b20b695fd2ede6d0ef1b2d88c2a7d 100644 --- a/wxRobot.py +++ b/wxRobot.py @@ -144,7 +144,7 @@ def test(): if os.path.exists(imgpath): session.SendImage(imgpath) if os.path.exists(filepath): session.SendFile(filepath) session.SendArticle("PC微信逆向--获取通讯录","确定不来看看么?","https://www.ljczero.top/article/2022/3/13/133.html") - shared = wx.GetFriendByWxNickName("小冰的宇宙") + shared = wx.GetFriendByWxNickName("码农翻身") if shared: session.SendCard(shared.get('wxid'),shared.get('wxNickName')) wx.StopService()