提交 b16656ea 编写于 作者: G Gogs

增加发送名片接口

上级 9d759b8b
#include "pch.h"
struct SendCardStruct {
DWORD receiver;
DWORD sharedwxid;
DWORD nickname;
};
BOOL SendCard(wchar_t* receiver, wchar_t* sharedwxid, wchar_t* nickname) {
if (!hProcess)
return 0;
DWORD WeChatRobotBase = GetWeChatRobotBase();
DWORD dwId = 0;
DWORD dwWriteSize = 0;
SendCardStruct params;
ZeroMemory(&params, sizeof(params));
DWORD SendCardProcAddr = WeChatRobotBase + SendCardOffset;
LPVOID receiveraddr = VirtualAllocEx(hProcess, NULL, 1, MEM_COMMIT, PAGE_READWRITE);
LPVOID sharedwxidaddr = VirtualAllocEx(hProcess, NULL, 1, MEM_COMMIT, PAGE_READWRITE);
LPVOID nicknameaddr = VirtualAllocEx(hProcess, NULL, 1, MEM_COMMIT, PAGE_READWRITE);
SendCardStruct* paramAndFunc = (SendCardStruct*)::VirtualAllocEx(hProcess, 0, sizeof(SendCardStruct), MEM_COMMIT, PAGE_READWRITE);
if (!receiveraddr || !sharedwxidaddr || !nicknameaddr ||
!paramAndFunc || !WeChatRobotBase)
{
return 0;
}
if (receiveraddr)
WriteProcessMemory(hProcess, receiveraddr, receiver, wcslen(receiver) * 2 + 2, &dwWriteSize);
if (sharedwxidaddr)
WriteProcessMemory(hProcess, sharedwxidaddr, sharedwxid, wcslen(sharedwxid) * 2 + 2, &dwWriteSize);
if (nicknameaddr)
WriteProcessMemory(hProcess, nicknameaddr, nickname, wcslen(nickname) * 2 + 2, &dwWriteSize);
params.receiver = (DWORD)receiveraddr;
params.sharedwxid = (DWORD)sharedwxidaddr;
params.nickname = (DWORD)nicknameaddr;
if (paramAndFunc)
WriteProcessMemory(hProcess, paramAndFunc, &params, sizeof(params), &dwId);
HANDLE hThread = ::CreateRemoteThread(hProcess, NULL, 0, (LPTHREAD_START_ROUTINE)SendCardProcAddr, (LPVOID)paramAndFunc, 0, &dwId);
if (hThread) {
WaitForSingleObject(hThread, INFINITE);
CloseHandle(hThread);
}
VirtualFreeEx(hProcess, receiveraddr, 0, MEM_RELEASE);
VirtualFreeEx(hProcess, sharedwxidaddr, 0, MEM_RELEASE);
VirtualFreeEx(hProcess, nicknameaddr, 0, MEM_RELEASE);
VirtualFreeEx(hProcess, paramAndFunc, 0, MEM_RELEASE);
return 1;
}
\ No newline at end of file
#pragma once
#include<windows.h>
BOOL SendCard(wchar_t* receiver, wchar_t* sharedwxid, wchar_t* nickname);
\ No newline at end of file
...@@ -64,6 +64,17 @@ STDMETHODIMP CWeChatRobot::CSendArticle(BSTR wxid, BSTR title,BSTR abstract,BSTR ...@@ -64,6 +64,17 @@ STDMETHODIMP CWeChatRobot::CSendArticle(BSTR wxid, BSTR title,BSTR abstract,BSTR
return S_OK; return S_OK;
} }
/*
* 参数1:接收人wxid
* 参数2:被分享人wxid
* 参数3:显示的名字
* 参数4:预返回的值,调用时无需提供
*/
STDMETHODIMP CWeChatRobot::CSendCard(BSTR receiver, BSTR sharedwxid, BSTR nickname, int* __result) {
*__result = SendCard(receiver, sharedwxid, nickname);
return S_OK;
}
/* /*
* 参数1:预返回的值,调用时无需提供 * 参数1:预返回的值,调用时无需提供
*/ */
......
...@@ -57,6 +57,7 @@ public: ...@@ -57,6 +57,7 @@ public:
STDMETHODIMP CSendText(BSTR wxid, BSTR wxmsg, int* __result); STDMETHODIMP CSendText(BSTR wxid, BSTR wxmsg, int* __result);
STDMETHODIMP CSendFile(BSTR wxid, BSTR filepath, int* __result); STDMETHODIMP CSendFile(BSTR wxid, BSTR filepath, int* __result);
STDMETHODIMP CSendArticle(BSTR wxid, BSTR title, BSTR abstract, BSTR url, int* __result); STDMETHODIMP CSendArticle(BSTR wxid, BSTR title, BSTR abstract, BSTR url, int* __result);
STDMETHODIMP CSendCard(BSTR receiver, BSTR sharedwxid, BSTR nickname, int* __result);
STDMETHODIMP CGetFriendList(BSTR* __result); STDMETHODIMP CGetFriendList(BSTR* __result);
STDMETHODIMP CGetWxUserInfo(BSTR wxid, BSTR* __result); STDMETHODIMP CGetWxUserInfo(BSTR wxid, BSTR* __result);
STDMETHODIMP CGetSelfInfo(BSTR* __result); STDMETHODIMP CGetSelfInfo(BSTR* __result);
......
...@@ -22,9 +22,10 @@ interface IWeChatRobot : IDispatch ...@@ -22,9 +22,10 @@ interface IWeChatRobot : IDispatch
[id(4)] HRESULT CSendImage([in] BSTR wxid, [in] BSTR imagepath, [out, retval] int* __result); [id(4)] HRESULT CSendImage([in] BSTR wxid, [in] BSTR imagepath, [out, retval] int* __result);
[id(5)] HRESULT CSendFile([in] BSTR wxid, [in] BSTR filepath, [out, retval] int* __result); [id(5)] HRESULT CSendFile([in] BSTR wxid, [in] BSTR filepath, [out, retval] int* __result);
[id(6)] HRESULT CSendArticle([in] BSTR wxid, [in] BSTR title, [in] BSTR abstract, [in] BSTR url, [out, retval] int* __result); [id(6)] HRESULT CSendArticle([in] BSTR wxid, [in] BSTR title, [in] BSTR abstract, [in] BSTR url, [out, retval] int* __result);
[id(7)] HRESULT CGetFriendList([out, retval] BSTR* __result); [id(7)] HRESULT CSendCard([in] BSTR receiver, [in] BSTR sharedwxid, [in] BSTR nickname, [out, retval] int* __result);
[id(8)] HRESULT CGetWxUserInfo([in] BSTR wxid, [out, retval] BSTR* __result); [id(8)] HRESULT CGetFriendList([out, retval] BSTR* __result);
[id(9)] HRESULT CGetSelfInfo([out, retval] BSTR* __result); [id(9)] HRESULT CGetWxUserInfo([in] BSTR wxid, [out, retval] BSTR* __result);
[id(10)] HRESULT CGetSelfInfo([out, retval] BSTR* __result);
}; };
[ [
uuid(721abb35-141a-4aa2-94f2-762e2833fa6c), uuid(721abb35-141a-4aa2-94f2-762e2833fa6c),
......
...@@ -219,6 +219,7 @@ ...@@ -219,6 +219,7 @@
<ClInclude Include="robotdata.h" /> <ClInclude Include="robotdata.h" />
<ClInclude Include="SelfInfo.h" /> <ClInclude Include="SelfInfo.h" />
<ClInclude Include="SendArticle.h" /> <ClInclude Include="SendArticle.h" />
<ClInclude Include="SendCard.h" />
<ClInclude Include="SendFile.h" /> <ClInclude Include="SendFile.h" />
<ClInclude Include="SendImage.h" /> <ClInclude Include="SendImage.h" />
<ClInclude Include="SendText.h" /> <ClInclude Include="SendText.h" />
...@@ -239,6 +240,7 @@ ...@@ -239,6 +240,7 @@
</ClCompile> </ClCompile>
<ClCompile Include="SelfInfo.cpp" /> <ClCompile Include="SelfInfo.cpp" />
<ClCompile Include="SendArticle.cpp" /> <ClCompile Include="SendArticle.cpp" />
<ClCompile Include="SendCard.cpp" />
<ClCompile Include="SendFile.cpp" /> <ClCompile Include="SendFile.cpp" />
<ClCompile Include="SendImage.cpp" /> <ClCompile Include="SendImage.cpp" />
<ClCompile Include="SendText.cpp" /> <ClCompile Include="SendText.cpp" />
......
...@@ -47,6 +47,9 @@ ...@@ -47,6 +47,9 @@
<Filter Include="发送消息\发送文章"> <Filter Include="发送消息\发送文章">
<UniqueIdentifier>{1986e9ed-7cd3-4ad3-b333-a1d74cc53c28}</UniqueIdentifier> <UniqueIdentifier>{1986e9ed-7cd3-4ad3-b333-a1d74cc53c28}</UniqueIdentifier>
</Filter> </Filter>
<Filter Include="发送消息\发送名片">
<UniqueIdentifier>{9d9c2a95-9243-4809-884b-70d6d87a7128}</UniqueIdentifier>
</Filter>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="framework.h"> <ClInclude Include="framework.h">
...@@ -97,6 +100,9 @@ ...@@ -97,6 +100,9 @@
<ClInclude Include="SendArticle.h"> <ClInclude Include="SendArticle.h">
<Filter>发送消息\发送文章</Filter> <Filter>发送消息\发送文章</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="SendCard.h">
<Filter>发送消息\发送名片</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="WeChatRobotCOM.cpp"> <ClCompile Include="WeChatRobotCOM.cpp">
...@@ -138,6 +144,9 @@ ...@@ -138,6 +144,9 @@
<ClCompile Include="SendArticle.cpp"> <ClCompile Include="SendArticle.cpp">
<Filter>发送消息\发送文章</Filter> <Filter>发送消息\发送文章</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="SendCard.cpp">
<Filter>发送消息\发送名片</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ResourceCompile Include="WeChatRobotCOM.rc"> <ResourceCompile Include="WeChatRobotCOM.rc">
......
...@@ -117,6 +117,12 @@ EXTERN_C const IID IID_IWeChatRobot; ...@@ -117,6 +117,12 @@ EXTERN_C const IID IID_IWeChatRobot;
/* [in] */ BSTR url, /* [in] */ BSTR url,
/* [retval][out] */ int *__result) = 0; /* [retval][out] */ int *__result) = 0;
virtual /* [id] */ HRESULT STDMETHODCALLTYPE CSendCard(
/* [in] */ BSTR receiver,
/* [in] */ BSTR sharedwxid,
/* [in] */ BSTR nickname,
/* [retval][out] */ int *__result) = 0;
virtual /* [id] */ HRESULT STDMETHODCALLTYPE CGetFriendList( virtual /* [id] */ HRESULT STDMETHODCALLTYPE CGetFriendList(
/* [retval][out] */ BSTR *__result) = 0; /* [retval][out] */ BSTR *__result) = 0;
...@@ -220,6 +226,13 @@ EXTERN_C const IID IID_IWeChatRobot; ...@@ -220,6 +226,13 @@ EXTERN_C const IID IID_IWeChatRobot;
/* [in] */ BSTR url, /* [in] */ BSTR url,
/* [retval][out] */ int *__result); /* [retval][out] */ int *__result);
/* [id] */ HRESULT ( STDMETHODCALLTYPE *CSendCard )(
IWeChatRobot * This,
/* [in] */ BSTR receiver,
/* [in] */ BSTR sharedwxid,
/* [in] */ BSTR nickname,
/* [retval][out] */ int *__result);
/* [id] */ HRESULT ( STDMETHODCALLTYPE *CGetFriendList )( /* [id] */ HRESULT ( STDMETHODCALLTYPE *CGetFriendList )(
IWeChatRobot * This, IWeChatRobot * This,
/* [retval][out] */ BSTR *__result); /* [retval][out] */ BSTR *__result);
...@@ -287,6 +300,9 @@ EXTERN_C const IID IID_IWeChatRobot; ...@@ -287,6 +300,9 @@ EXTERN_C const IID IID_IWeChatRobot;
#define IWeChatRobot_CSendArticle(This,wxid,title,abstract,url,__result) \ #define IWeChatRobot_CSendArticle(This,wxid,title,abstract,url,__result) \
( (This)->lpVtbl -> CSendArticle(This,wxid,title,abstract,url,__result) ) ( (This)->lpVtbl -> CSendArticle(This,wxid,title,abstract,url,__result) )
#define IWeChatRobot_CSendCard(This,receiver,sharedwxid,nickname,__result) \
( (This)->lpVtbl -> CSendCard(This,receiver,sharedwxid,nickname,__result) )
#define IWeChatRobot_CGetFriendList(This,__result) \ #define IWeChatRobot_CGetFriendList(This,__result) \
( (This)->lpVtbl -> CGetFriendList(This,__result) ) ( (This)->lpVtbl -> CGetFriendList(This,__result) )
......
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
#include "WeChatRobotCOM_i.h" #include "WeChatRobotCOM_i.h"
#define TYPE_FORMAT_STRING_SIZE 71 #define TYPE_FORMAT_STRING_SIZE 71
#define PROC_FORMAT_STRING_SIZE 397 #define PROC_FORMAT_STRING_SIZE 451
#define EXPR_FORMAT_STRING_SIZE 1 #define EXPR_FORMAT_STRING_SIZE 1
#define TRANSMIT_AS_TABLE_SIZE 0 #define TRANSMIT_AS_TABLE_SIZE 0
#define WIRE_MARSHAL_TABLE_SIZE 1 #define WIRE_MARSHAL_TABLE_SIZE 1
...@@ -359,100 +359,149 @@ static const WeChatRobotCOM_MIDL_PROC_FORMAT_STRING WeChatRobotCOM__MIDL_ProcFor ...@@ -359,100 +359,149 @@ static const WeChatRobotCOM_MIDL_PROC_FORMAT_STRING WeChatRobotCOM__MIDL_ProcFor
/* 280 */ 0x8, /* FC_LONG */ /* 280 */ 0x8, /* FC_LONG */
0x0, /* 0 */ 0x0, /* 0 */
/* Procedure CGetFriendList */ /* Procedure CSendCard */
/* 282 */ 0x33, /* FC_AUTO_HANDLE */ /* 282 */ 0x33, /* FC_AUTO_HANDLE */
0x6c, /* Old Flags: object, Oi2 */ 0x6c, /* Old Flags: object, Oi2 */
/* 284 */ NdrFcLong( 0x0 ), /* 0 */ /* 284 */ NdrFcLong( 0x0 ), /* 0 */
/* 288 */ NdrFcShort( 0xd ), /* 13 */ /* 288 */ NdrFcShort( 0xd ), /* 13 */
/* 290 */ NdrFcShort( 0xc ), /* x86 Stack size/offset = 12 */ /* 290 */ NdrFcShort( 0x18 ), /* x86 Stack size/offset = 24 */
/* 292 */ NdrFcShort( 0x0 ), /* 0 */ /* 292 */ NdrFcShort( 0x0 ), /* 0 */
/* 294 */ NdrFcShort( 0x8 ), /* 8 */ /* 294 */ NdrFcShort( 0x24 ), /* 36 */
/* 296 */ 0x45, /* Oi2 Flags: srv must size, has return, has ext, */ /* 296 */ 0x46, /* Oi2 Flags: clt must size, has return, has ext, */
0x2, /* 2 */ 0x5, /* 5 */
/* 298 */ 0x8, /* 8 */ /* 298 */ 0x8, /* 8 */
0x43, /* Ext Flags: new corr desc, clt corr check, has range on conformance */ 0x45, /* Ext Flags: new corr desc, srv corr check, has range on conformance */
/* 300 */ NdrFcShort( 0x1 ), /* 1 */ /* 300 */ NdrFcShort( 0x0 ), /* 0 */
/* 302 */ NdrFcShort( 0x0 ), /* 0 */ /* 302 */ NdrFcShort( 0x1 ), /* 1 */
/* 304 */ NdrFcShort( 0x0 ), /* 0 */ /* 304 */ NdrFcShort( 0x0 ), /* 0 */
/* Parameter __result */ /* Parameter receiver */
/* 306 */ NdrFcShort( 0x2113 ), /* Flags: must size, must free, out, simple ref, srv alloc size=8 */ /* 306 */ NdrFcShort( 0x8b ), /* Flags: must size, must free, in, by val, */
/* 308 */ NdrFcShort( 0x4 ), /* x86 Stack size/offset = 4 */ /* 308 */ NdrFcShort( 0x4 ), /* x86 Stack size/offset = 4 */
/* 310 */ NdrFcShort( 0x3c ), /* Type Offset=60 */ /* 310 */ NdrFcShort( 0x26 ), /* Type Offset=38 */
/* Return value */ /* Parameter sharedwxid */
/* 312 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ /* 312 */ NdrFcShort( 0x8b ), /* Flags: must size, must free, in, by val, */
/* 314 */ NdrFcShort( 0x8 ), /* x86 Stack size/offset = 8 */ /* 314 */ NdrFcShort( 0x8 ), /* x86 Stack size/offset = 8 */
/* 316 */ 0x8, /* FC_LONG */ /* 316 */ NdrFcShort( 0x26 ), /* Type Offset=38 */
/* Parameter nickname */
/* 318 */ NdrFcShort( 0x8b ), /* Flags: must size, must free, in, by val, */
/* 320 */ NdrFcShort( 0xc ), /* x86 Stack size/offset = 12 */
/* 322 */ NdrFcShort( 0x26 ), /* Type Offset=38 */
/* Parameter __result */
/* 324 */ NdrFcShort( 0x2150 ), /* Flags: out, base type, simple ref, srv alloc size=8 */
/* 326 */ NdrFcShort( 0x10 ), /* x86 Stack size/offset = 16 */
/* 328 */ 0x8, /* FC_LONG */
0x0, /* 0 */
/* Return value */
/* 330 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */
/* 332 */ NdrFcShort( 0x14 ), /* x86 Stack size/offset = 20 */
/* 334 */ 0x8, /* FC_LONG */
0x0, /* 0 */
/* Procedure CGetFriendList */
/* 336 */ 0x33, /* FC_AUTO_HANDLE */
0x6c, /* Old Flags: object, Oi2 */
/* 338 */ NdrFcLong( 0x0 ), /* 0 */
/* 342 */ NdrFcShort( 0xe ), /* 14 */
/* 344 */ NdrFcShort( 0xc ), /* x86 Stack size/offset = 12 */
/* 346 */ NdrFcShort( 0x0 ), /* 0 */
/* 348 */ NdrFcShort( 0x8 ), /* 8 */
/* 350 */ 0x45, /* Oi2 Flags: srv must size, has return, has ext, */
0x2, /* 2 */
/* 352 */ 0x8, /* 8 */
0x43, /* Ext Flags: new corr desc, clt corr check, has range on conformance */
/* 354 */ NdrFcShort( 0x1 ), /* 1 */
/* 356 */ NdrFcShort( 0x0 ), /* 0 */
/* 358 */ NdrFcShort( 0x0 ), /* 0 */
/* Parameter __result */
/* 360 */ NdrFcShort( 0x2113 ), /* Flags: must size, must free, out, simple ref, srv alloc size=8 */
/* 362 */ NdrFcShort( 0x4 ), /* x86 Stack size/offset = 4 */
/* 364 */ NdrFcShort( 0x3c ), /* Type Offset=60 */
/* Return value */
/* 366 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */
/* 368 */ NdrFcShort( 0x8 ), /* x86 Stack size/offset = 8 */
/* 370 */ 0x8, /* FC_LONG */
0x0, /* 0 */ 0x0, /* 0 */
/* Procedure CGetWxUserInfo */ /* Procedure CGetWxUserInfo */
/* 318 */ 0x33, /* FC_AUTO_HANDLE */ /* 372 */ 0x33, /* FC_AUTO_HANDLE */
0x6c, /* Old Flags: object, Oi2 */ 0x6c, /* Old Flags: object, Oi2 */
/* 320 */ NdrFcLong( 0x0 ), /* 0 */ /* 374 */ NdrFcLong( 0x0 ), /* 0 */
/* 324 */ NdrFcShort( 0xe ), /* 14 */ /* 378 */ NdrFcShort( 0xf ), /* 15 */
/* 326 */ NdrFcShort( 0x10 ), /* x86 Stack size/offset = 16 */ /* 380 */ NdrFcShort( 0x10 ), /* x86 Stack size/offset = 16 */
/* 328 */ NdrFcShort( 0x0 ), /* 0 */ /* 382 */ NdrFcShort( 0x0 ), /* 0 */
/* 330 */ NdrFcShort( 0x8 ), /* 8 */ /* 384 */ NdrFcShort( 0x8 ), /* 8 */
/* 332 */ 0x47, /* Oi2 Flags: srv must size, clt must size, has return, has ext, */ /* 386 */ 0x47, /* Oi2 Flags: srv must size, clt must size, has return, has ext, */
0x3, /* 3 */ 0x3, /* 3 */
/* 334 */ 0x8, /* 8 */ /* 388 */ 0x8, /* 8 */
0x47, /* Ext Flags: new corr desc, clt corr check, srv corr check, has range on conformance */ 0x47, /* Ext Flags: new corr desc, clt corr check, srv corr check, has range on conformance */
/* 336 */ NdrFcShort( 0x1 ), /* 1 */ /* 390 */ NdrFcShort( 0x1 ), /* 1 */
/* 338 */ NdrFcShort( 0x1 ), /* 1 */ /* 392 */ NdrFcShort( 0x1 ), /* 1 */
/* 340 */ NdrFcShort( 0x0 ), /* 0 */ /* 394 */ NdrFcShort( 0x0 ), /* 0 */
/* Parameter wxid */ /* Parameter wxid */
/* 342 */ NdrFcShort( 0x8b ), /* Flags: must size, must free, in, by val, */ /* 396 */ NdrFcShort( 0x8b ), /* Flags: must size, must free, in, by val, */
/* 344 */ NdrFcShort( 0x4 ), /* x86 Stack size/offset = 4 */ /* 398 */ NdrFcShort( 0x4 ), /* x86 Stack size/offset = 4 */
/* 346 */ NdrFcShort( 0x26 ), /* Type Offset=38 */ /* 400 */ NdrFcShort( 0x26 ), /* Type Offset=38 */
/* Parameter __result */ /* Parameter __result */
/* 348 */ NdrFcShort( 0x2113 ), /* Flags: must size, must free, out, simple ref, srv alloc size=8 */ /* 402 */ NdrFcShort( 0x2113 ), /* Flags: must size, must free, out, simple ref, srv alloc size=8 */
/* 350 */ NdrFcShort( 0x8 ), /* x86 Stack size/offset = 8 */ /* 404 */ NdrFcShort( 0x8 ), /* x86 Stack size/offset = 8 */
/* 352 */ NdrFcShort( 0x3c ), /* Type Offset=60 */ /* 406 */ NdrFcShort( 0x3c ), /* Type Offset=60 */
/* Return value */ /* Return value */
/* 354 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ /* 408 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */
/* 356 */ NdrFcShort( 0xc ), /* x86 Stack size/offset = 12 */ /* 410 */ NdrFcShort( 0xc ), /* x86 Stack size/offset = 12 */
/* 358 */ 0x8, /* FC_LONG */ /* 412 */ 0x8, /* FC_LONG */
0x0, /* 0 */ 0x0, /* 0 */
/* Procedure CGetSelfInfo */ /* Procedure CGetSelfInfo */
/* 360 */ 0x33, /* FC_AUTO_HANDLE */ /* 414 */ 0x33, /* FC_AUTO_HANDLE */
0x6c, /* Old Flags: object, Oi2 */ 0x6c, /* Old Flags: object, Oi2 */
/* 362 */ NdrFcLong( 0x0 ), /* 0 */ /* 416 */ NdrFcLong( 0x0 ), /* 0 */
/* 366 */ NdrFcShort( 0xf ), /* 15 */ /* 420 */ NdrFcShort( 0x10 ), /* 16 */
/* 368 */ NdrFcShort( 0xc ), /* x86 Stack size/offset = 12 */ /* 422 */ NdrFcShort( 0xc ), /* x86 Stack size/offset = 12 */
/* 370 */ NdrFcShort( 0x0 ), /* 0 */ /* 424 */ NdrFcShort( 0x0 ), /* 0 */
/* 372 */ NdrFcShort( 0x8 ), /* 8 */ /* 426 */ NdrFcShort( 0x8 ), /* 8 */
/* 374 */ 0x45, /* Oi2 Flags: srv must size, has return, has ext, */ /* 428 */ 0x45, /* Oi2 Flags: srv must size, has return, has ext, */
0x2, /* 2 */ 0x2, /* 2 */
/* 376 */ 0x8, /* 8 */ /* 430 */ 0x8, /* 8 */
0x43, /* Ext Flags: new corr desc, clt corr check, has range on conformance */ 0x43, /* Ext Flags: new corr desc, clt corr check, has range on conformance */
/* 378 */ NdrFcShort( 0x1 ), /* 1 */ /* 432 */ NdrFcShort( 0x1 ), /* 1 */
/* 380 */ NdrFcShort( 0x0 ), /* 0 */ /* 434 */ NdrFcShort( 0x0 ), /* 0 */
/* 382 */ NdrFcShort( 0x0 ), /* 0 */ /* 436 */ NdrFcShort( 0x0 ), /* 0 */
/* Parameter __result */ /* Parameter __result */
/* 384 */ NdrFcShort( 0x2113 ), /* Flags: must size, must free, out, simple ref, srv alloc size=8 */ /* 438 */ NdrFcShort( 0x2113 ), /* Flags: must size, must free, out, simple ref, srv alloc size=8 */
/* 386 */ NdrFcShort( 0x4 ), /* x86 Stack size/offset = 4 */ /* 440 */ NdrFcShort( 0x4 ), /* x86 Stack size/offset = 4 */
/* 388 */ NdrFcShort( 0x3c ), /* Type Offset=60 */ /* 442 */ NdrFcShort( 0x3c ), /* Type Offset=60 */
/* Return value */ /* Return value */
/* 390 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */ /* 444 */ NdrFcShort( 0x70 ), /* Flags: out, return, base type, */
/* 392 */ NdrFcShort( 0x8 ), /* x86 Stack size/offset = 8 */ /* 446 */ NdrFcShort( 0x8 ), /* x86 Stack size/offset = 8 */
/* 394 */ 0x8, /* FC_LONG */ /* 448 */ 0x8, /* FC_LONG */
0x0, /* 0 */ 0x0, /* 0 */
0x0 0x0
...@@ -556,8 +605,9 @@ static const unsigned short IWeChatRobot_FormatStringOffsetTable[] = ...@@ -556,8 +605,9 @@ static const unsigned short IWeChatRobot_FormatStringOffsetTable[] =
174, 174,
222, 222,
282, 282,
318, 336,
360 372,
414
}; };
static const MIDL_STUBLESS_PROXY_INFO IWeChatRobot_ProxyInfo = static const MIDL_STUBLESS_PROXY_INFO IWeChatRobot_ProxyInfo =
...@@ -581,7 +631,7 @@ static const MIDL_SERVER_INFO IWeChatRobot_ServerInfo = ...@@ -581,7 +631,7 @@ static const MIDL_SERVER_INFO IWeChatRobot_ServerInfo =
0, 0,
0, 0,
0}; 0};
CINTERFACE_PROXY_VTABLE(16) _IWeChatRobotProxyVtbl = CINTERFACE_PROXY_VTABLE(17) _IWeChatRobotProxyVtbl =
{ {
&IWeChatRobot_ProxyInfo, &IWeChatRobot_ProxyInfo,
&IID_IWeChatRobot, &IID_IWeChatRobot,
...@@ -598,6 +648,7 @@ CINTERFACE_PROXY_VTABLE(16) _IWeChatRobotProxyVtbl = ...@@ -598,6 +648,7 @@ CINTERFACE_PROXY_VTABLE(16) _IWeChatRobotProxyVtbl =
(void *) (INT_PTR) -1 /* IWeChatRobot::CSendImage */ , (void *) (INT_PTR) -1 /* IWeChatRobot::CSendImage */ ,
(void *) (INT_PTR) -1 /* IWeChatRobot::CSendFile */ , (void *) (INT_PTR) -1 /* IWeChatRobot::CSendFile */ ,
(void *) (INT_PTR) -1 /* IWeChatRobot::CSendArticle */ , (void *) (INT_PTR) -1 /* IWeChatRobot::CSendArticle */ ,
(void *) (INT_PTR) -1 /* IWeChatRobot::CSendCard */ ,
(void *) (INT_PTR) -1 /* IWeChatRobot::CGetFriendList */ , (void *) (INT_PTR) -1 /* IWeChatRobot::CGetFriendList */ ,
(void *) (INT_PTR) -1 /* IWeChatRobot::CGetWxUserInfo */ , (void *) (INT_PTR) -1 /* IWeChatRobot::CGetWxUserInfo */ ,
(void *) (INT_PTR) -1 /* IWeChatRobot::CGetSelfInfo */ (void *) (INT_PTR) -1 /* IWeChatRobot::CGetSelfInfo */
...@@ -618,6 +669,7 @@ static const PRPC_STUB_FUNCTION IWeChatRobot_table[] = ...@@ -618,6 +669,7 @@ static const PRPC_STUB_FUNCTION IWeChatRobot_table[] =
NdrStubCall2, NdrStubCall2,
NdrStubCall2, NdrStubCall2,
NdrStubCall2, NdrStubCall2,
NdrStubCall2,
NdrStubCall2 NdrStubCall2
}; };
...@@ -625,7 +677,7 @@ CInterfaceStubVtbl _IWeChatRobotStubVtbl = ...@@ -625,7 +677,7 @@ CInterfaceStubVtbl _IWeChatRobotStubVtbl =
{ {
&IID_IWeChatRobot, &IID_IWeChatRobot,
&IWeChatRobot_ServerInfo, &IWeChatRobot_ServerInfo,
16, 17,
&IWeChatRobot_table[-3], &IWeChatRobot_table[-3],
CStdStubBuffer_DELEGATING_METHODS CStdStubBuffer_DELEGATING_METHODS
}; };
......
...@@ -7,6 +7,7 @@ DWORD SendImageOffset = 0x0; ...@@ -7,6 +7,7 @@ DWORD SendImageOffset = 0x0;
DWORD SendTextOffset = 0x0; DWORD SendTextOffset = 0x0;
DWORD SendFileOffset = 0x0; DWORD SendFileOffset = 0x0;
DWORD SendArticleOffset = 0x0; DWORD SendArticleOffset = 0x0;
DWORD SendCardOffset = 0x0;
DWORD GetFriendListInitOffset = 0x0; DWORD GetFriendListInitOffset = 0x0;
DWORD GetFriendListRemoteOffset = 0x0; DWORD GetFriendListRemoteOffset = 0x0;
...@@ -84,6 +85,8 @@ void GetProcOffset(wchar_t* workPath) { ...@@ -84,6 +85,8 @@ void GetProcOffset(wchar_t* workPath) {
SendFileOffset = SendFileProcAddr - WeChatBase; SendFileOffset = SendFileProcAddr - WeChatBase;
DWORD SendArticleProcAddr = (DWORD)GetProcAddress(hd, SendArticleRemote); DWORD SendArticleProcAddr = (DWORD)GetProcAddress(hd, SendArticleRemote);
SendArticleOffset = SendArticleProcAddr - WeChatBase; SendArticleOffset = SendArticleProcAddr - WeChatBase;
DWORD SendCardProcAddr = (DWORD)GetProcAddress(hd, SendCardRemote);
SendCardOffset = SendCardProcAddr - WeChatBase;
DWORD GetFriendListInitProcAddr = (DWORD)GetProcAddress(hd, GetFriendListInit); DWORD GetFriendListInitProcAddr = (DWORD)GetProcAddress(hd, GetFriendListInit);
GetFriendListInitOffset = GetFriendListInitProcAddr - WeChatBase; GetFriendListInitOffset = GetFriendListInitProcAddr - WeChatBase;
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#include "SendText.h" #include "SendText.h"
#include "SendFile.h" #include "SendFile.h"
#include "SendArticle.h" #include "SendArticle.h"
#include "SendCard.h"
#include "FriendList.h" #include "FriendList.h"
#include "UserInfo.h" #include "UserInfo.h"
#include "SelfInfo.h" #include "SelfInfo.h"
...@@ -13,6 +14,7 @@ extern DWORD SendImageOffset; ...@@ -13,6 +14,7 @@ extern DWORD SendImageOffset;
extern DWORD SendTextOffset; extern DWORD SendTextOffset;
extern DWORD SendFileOffset; extern DWORD SendFileOffset;
extern DWORD SendArticleOffset; extern DWORD SendArticleOffset;
extern DWORD SendCardOffset;
extern DWORD GetFriendListInitOffset; extern DWORD GetFriendListInitOffset;
extern DWORD GetFriendListRemoteOffset; extern DWORD GetFriendListRemoteOffset;
...@@ -31,6 +33,7 @@ extern wstring SelfInfoString; ...@@ -31,6 +33,7 @@ extern wstring SelfInfoString;
#define SendImageRemote "SendImageRemote" #define SendImageRemote "SendImageRemote"
#define SendFileRemote "SendFileRemote" #define SendFileRemote "SendFileRemote"
#define SendArticleRemote "SendArticleRemote" #define SendArticleRemote "SendArticleRemote"
#define SendCardRemote "SendCardRemote"
#define GetFriendListInit "GetFriendListInit" #define GetFriendListInit "GetFriendListInit"
#define GetFriendListRemote "GetFriendListRemote" #define GetFriendListRemote "GetFriendListRemote"
......
...@@ -158,6 +158,7 @@ ...@@ -158,6 +158,7 @@
<ClInclude Include="SaveGif.h" /> <ClInclude Include="SaveGif.h" />
<ClInclude Include="SelfInfo.h" /> <ClInclude Include="SelfInfo.h" />
<ClInclude Include="SendArticle.h" /> <ClInclude Include="SendArticle.h" />
<ClInclude Include="SendCard.h" />
<ClInclude Include="SendFile.h" /> <ClInclude Include="SendFile.h" />
<ClInclude Include="SendImage.h" /> <ClInclude Include="SendImage.h" />
<ClInclude Include="SendText.h" /> <ClInclude Include="SendText.h" />
...@@ -175,10 +176,10 @@ ...@@ -175,10 +176,10 @@
<ClCompile Include="SaveGif.cpp" /> <ClCompile Include="SaveGif.cpp" />
<ClCompile Include="SelfInfo.cpp" /> <ClCompile Include="SelfInfo.cpp" />
<ClCompile Include="SendArticle.cpp" /> <ClCompile Include="SendArticle.cpp" />
<ClCompile Include="SendCard.cpp" />
<ClCompile Include="SendFile.cpp" /> <ClCompile Include="SendFile.cpp" />
<ClCompile Include="SendImage.cpp" /> <ClCompile Include="SendImage.cpp" />
<ClCompile Include="SendText.cpp" /> <ClCompile Include="SendText.cpp" />
<ClCompile Include="showFriendList.cpp" />
<ClCompile Include="UserInfo.cpp" /> <ClCompile Include="UserInfo.cpp" />
</ItemGroup> </ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
......
...@@ -46,6 +46,9 @@ ...@@ -46,6 +46,9 @@
<Filter Include="发送消息\发送文章"> <Filter Include="发送消息\发送文章">
<UniqueIdentifier>{edd6e39f-235b-4db5-aea1-ec2c8d0072c5}</UniqueIdentifier> <UniqueIdentifier>{edd6e39f-235b-4db5-aea1-ec2c8d0072c5}</UniqueIdentifier>
</Filter> </Filter>
<Filter Include="发送消息\发送名片">
<UniqueIdentifier>{fc747a68-6314-4f23-92de-a1e55275a01e}</UniqueIdentifier>
</Filter>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClInclude Include="framework.h"> <ClInclude Include="framework.h">
...@@ -78,6 +81,9 @@ ...@@ -78,6 +81,9 @@
<ClInclude Include="SendArticle.h"> <ClInclude Include="SendArticle.h">
<Filter>发送消息\发送文章</Filter> <Filter>发送消息\发送文章</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="SendCard.h">
<Filter>发送消息\发送名片</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ClCompile Include="dllmain.cpp"> <ClCompile Include="dllmain.cpp">
...@@ -101,9 +107,6 @@ ...@@ -101,9 +107,6 @@
<ClCompile Include="SaveGif.cpp"> <ClCompile Include="SaveGif.cpp">
<Filter>自动功能\聊天表情</Filter> <Filter>自动功能\聊天表情</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="showFriendList.cpp">
<Filter>好友相关\好友列表</Filter>
</ClCompile>
<ClCompile Include="UserInfo.cpp"> <ClCompile Include="UserInfo.cpp">
<Filter>好友相关\好友信息</Filter> <Filter>好友相关\好友信息</Filter>
</ClCompile> </ClCompile>
...@@ -113,5 +116,8 @@ ...@@ -113,5 +116,8 @@
<ClCompile Include="SendArticle.cpp"> <ClCompile Include="SendArticle.cpp">
<Filter>发送消息\发送文章</Filter> <Filter>发送消息\发送文章</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="SendCard.cpp">
<Filter>发送消息\发送名片</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
</Project> </Project>
\ No newline at end of file
...@@ -11,7 +11,7 @@ struct SelfInfoStruct { ...@@ -11,7 +11,7 @@ struct SelfInfoStruct {
// дBUG // дBUG
DWORD GetSelfInfoRemote() { DWORD GetSelfInfoRemote() {
DWORD WeChatWinBase = GetWeChatWinBase(); DWORD WeChatWinBase = GetWeChatWinBase();
vector<DWORD> SelfInfoAddr = { /*vector<DWORD> SelfInfoAddr = {
*(DWORD*)(WeChatWinBase + 0x21DC9C4), *(DWORD*)(WeChatWinBase + 0x21DC9C4),
WeChatWinBase + 0x21DCBB8, WeChatWinBase + 0x21DCBB8,
*(DWORD*)(WeChatWinBase + 0x21DCA3C), *(DWORD*)(WeChatWinBase + 0x21DCA3C),
...@@ -22,6 +22,18 @@ DWORD GetSelfInfoRemote() { ...@@ -22,6 +22,18 @@ DWORD GetSelfInfoRemote() {
WeChatWinBase + 0x21DCB44, WeChatWinBase + 0x21DCB44,
WeChatWinBase + 0x21DCB5C, WeChatWinBase + 0x21DCB5C,
WeChatWinBase + 0x21DCA70 WeChatWinBase + 0x21DCA70
};*/
vector<DWORD> SelfInfoAddr = {
*(DWORD*)(WeChatWinBase + 0x21DC9C4),
WeChatWinBase + 0x21DCBB8,
WeChatWinBase + 0x21DCA3C,
*(DWORD*)(WeChatWinBase + 0x21DCB74),
*(DWORD*)(WeChatWinBase + 0x21DCD34),
*(DWORD*)(WeChatWinBase + 0x21DCD1C),
WeChatWinBase + 0x21DCC30,
WeChatWinBase + 0x21DCB44,
WeChatWinBase + 0x21DCB5C,
WeChatWinBase + 0x21DCA70
}; };
vector<wstring> SelfInfoKey = { vector<wstring> SelfInfoKey = {
...@@ -43,17 +55,23 @@ DWORD GetSelfInfoRemote() { ...@@ -43,17 +55,23 @@ DWORD GetSelfInfoRemote() {
for (unsigned int i = 0; i < SelfInfoAddr.size(); i++) { for (unsigned int i = 0; i < SelfInfoAddr.size(); i++) {
selfinfo = selfinfo + SelfInfoKey[i] + L":"; selfinfo = selfinfo + SelfInfoKey[i] + L":";
selfinfo = selfinfo + L"\""; selfinfo = selfinfo + L"\"";
char* temp = (*((DWORD*)SelfInfoAddr[i]) != 0) ? (char*)SelfInfoAddr[i] : (char*)"null"; char* temp = NULL;
#ifdef _DEBUG if (!SelfInfoKey[i].compare(L"\"wxNickName\"")) {
cout << temp << endl; if (*(DWORD*)(SelfInfoAddr[i] + 0x14) == 0xF) {
#endif temp = (*((DWORD*)SelfInfoAddr[i]) != 0) ? (char*)SelfInfoAddr[i] : (char*)"null";
continue; }
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]; wchar_t* wtemp = new wchar_t[strlen(temp) + 1];
ZeroMemory(wtemp, (strlen(temp) + 1) * 2); ZeroMemory(wtemp, (strlen(temp) + 1) * 2);
MultiByteToWideChar(CP_UTF8, MB_COMPOSITE, temp, -1, wtemp, strlen(temp) + 1); MultiByteToWideChar(CP_UTF8, MB_COMPOSITE, temp, -1, wtemp, strlen(temp) + 1);
#ifdef _DEBUG
wcout << wtemp << endl;
#endif
selfinfo = selfinfo + wtemp; selfinfo = selfinfo + wtemp;
selfinfo = selfinfo + L"\""; selfinfo = selfinfo + L"\"";
if(i!= SelfInfoAddr.size() - 1) if(i!= SelfInfoAddr.size() - 1)
......
#include "pch.h" #include "pch.h"
#define SendArticleCall1Offset 0x5BC68E80 - 0x5BBE0000
#define SendArticleCall2Offset 0x03297840 - 0x02F20000
#define SendArticleCall3Offset 0x5BC9C570 - 0x5BBE0000
#define SendArticleCall4Offset 0x5BF57A10 - 0x5BBE0000
#define SendArticleParamOffset 0x5DDCCD1C - 0x5BBE0000
#define SendArticleClearCacheCall1Offset 0x5C1F40D0 - 0x5BBE0000
#define SendArticleClearCacheCall2Offset 0x59637BA0 - 0x595B0000
struct SendArticleStruct { struct SendArticleStruct {
DWORD wxid; DWORD wxid;
DWORD title; DWORD title;
...@@ -18,15 +27,15 @@ VOID SendArticleRemote(LPVOID lparameter) { ...@@ -18,15 +27,15 @@ VOID SendArticleRemote(LPVOID lparameter) {
BOOL __stdcall SendArticle(wchar_t* wxid,wchar_t* title, wchar_t* abstract, wchar_t* url) { BOOL __stdcall SendArticle(wchar_t* wxid,wchar_t* title, wchar_t* abstract, wchar_t* url) {
DWORD WeChatWinBase = GetWeChatWinBase(); DWORD WeChatWinBase = GetWeChatWinBase();
DWORD SendArticleCall1 = WeChatWinBase + 0x5BC68E80 - 0x5BBE0000; DWORD SendArticleCall1 = WeChatWinBase + SendArticleCall1Offset;
DWORD SendArticleCall2 = WeChatWinBase + 0x03297840 - 0x02F20000; DWORD SendArticleCall2 = WeChatWinBase + SendArticleCall2Offset;
DWORD SendArticleCall3 = WeChatWinBase + 0x5BC9C570 - 0x5BBE0000; DWORD SendArticleCall3 = WeChatWinBase + SendArticleCall3Offset;
DWORD SendArticleCall4 = WeChatWinBase + 0x5BF57A10 - 0x5BBE0000; DWORD SendArticleCall4 = WeChatWinBase + SendArticleCall4Offset;
DWORD SendArticleParam = WeChatWinBase + 0x5DDCCD1C - 0x5BBE0000; DWORD SendArticleParam = WeChatWinBase + SendArticleParamOffset;
DWORD SendArticleClearCacheCall1 = WeChatWinBase + 0x5C1F40D0 - 0x5BBE0000; DWORD SendArticleClearCacheCall1 = WeChatWinBase + SendArticleClearCacheCall1Offset;
DWORD SendArticleClearCacheCall2 = WeChatWinBase + 0x59637BA0 - 0x595B0000; DWORD SendArticleClearCacheCall2 = WeChatWinBase + SendArticleClearCacheCall2Offset;
// 自己的wxid,发送者 // 自己的wxid,发送者
char* sselfwxid = (char*)(*(DWORD*)(WeChatWinBase + 0x21DC9C4)); char* sselfwxid = (char*)(*(DWORD*)(WeChatWinBase + 0x21DC9C4));
wchar_t* wselfwxid = new wchar_t[strlen(sselfwxid) + 1]; wchar_t* wselfwxid = new wchar_t[strlen(sselfwxid) + 1];
......
#include "pch.h"
#define SendCardCallOffset 0x5BDCBC80 - 0x05B930000
#define DeleteCardCacheCallOffset 0x5B9B7BA0 - 0x05B930000
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"<?xml version=\"1.0\"?><msg bigheadimgurl=\"\" smallheadimgurl=\"\" username=\"%ws\" nickname=\"%ws\" fullpy=\"?\" shortpy=\"\" alias=\"%ws\" imagestatus=\"3\" scene=\"17\" province=\"\" city=\"й\" sign=\"\" sex=\"2\" certflag=\"0\" certinfo=\"\" brandIconUrl=\"\" brandHomeUrl=\"\" brandSubscriptConfigUrl= \"\" brandFlags=\"0\" regionCode=\"CN_BeiJing_BeiJing\" />",
sharedwxid, nickname, sharedwxid);
WxBaseStruct pReceiver(receiver);
WxBaseStruct pXml(xml);
char buffer[0x2C0] = { 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
#pragma once
#include<windows.h>
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
...@@ -25,8 +25,7 @@ BOOL APIENTRY DllMain( HMODULE hModule, ...@@ -25,8 +25,7 @@ BOOL APIENTRY DllMain( HMODULE hModule,
printf("HookExtractExpression 0x%08X\n", (DWORD)HookExtractExpression); printf("HookExtractExpression 0x%08X\n", (DWORD)HookExtractExpression);
printf("GetUserInfoByWxId 0x%08X\n", (DWORD)GetUserInfoByWxId); printf("GetUserInfoByWxId 0x%08X\n", (DWORD)GetUserInfoByWxId);
printf("SendArticle 0x%08X\n", (DWORD)SendArticle); printf("SendArticle 0x%08X\n", (DWORD)SendArticle);
printf("SendCard 0x%08X\n", (DWORD)SendCard);
// GetSelfInfoRemote();
#endif #endif
break; break;
} }
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include "SaveGif.h" #include "SaveGif.h"
#include "UserInfo.h" #include "UserInfo.h"
#include "SelfInfo.h" #include "SelfInfo.h"
#include "SendCard.h"
#endif //PCH_H #endif //PCH_H
using namespace std; using namespace std;
......
#include "pch.h"
#include <vector>
using namespace std;
#define LeftTreeOffsetA 0x21DD240
struct WxFriendStructA {
int index;
string wxid;
string wxNumber;
string wxNickName;
string wxRemark;
WxFriendStructA(int index_, DWORD wxIdAddr, DWORD wxNumberAddr, DWORD wxNickNameAddr, DWORD wxRemarkAddr) {
index = index_;
Wchar_tToString(wxid, (wchar_t*)((LPVOID*)wxIdAddr));
if (wxNumberAddr)
Wchar_tToString(wxNumber, (wchar_t*)((LPVOID*)wxNumberAddr));
else
wxNumber = "null";
if (wxNickNameAddr)
Wchar_tToString(wxNickName, (wchar_t*)((LPVOID*)wxNickNameAddr));
else
wxNickName = "null";
if (wxRemarkAddr)
Wchar_tToString(wxRemark, (wchar_t*)((LPVOID*)wxRemarkAddr));
else
wxRemark = "null";
}
};
void __stdcall GetFriendListS() {
DWORD WeChatWinBase = GetWeChatWinBase();
DWORD LeftTreeAddr = 0;
DWORD RightTreeAddr = 0;
DWORD baseAddr = WeChatWinBase + LeftTreeOffsetA;
vector<WxFriendStructA> WxFriendList;
__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 ecx, dword ptr[eax + 0x4];
mov RightTreeAddr, ecx;
popad;
}
int index = 0;
// wcout.imbue(locale("chs"));
while (1) {
++index;
DWORD wxIdAddr = 0;
DWORD wxNumberAddr = 0;
DWORD wxNickNameAddr = 0;
DWORD wxRemarkAddr = 0;
__asm {
pushad;
mov eax, dword ptr[LeftTreeAddr];
mov ecx, dword ptr[eax + 0x30];
mov wxIdAddr, ecx;
mov ecx, dword ptr[eax + 0x44];
mov wxNumberAddr, ecx;
mov ecx, dword ptr[eax + 0x8C];
mov wxNickNameAddr, ecx;
mov ecx, dword ptr[eax + 0x78];
mov wxRemarkAddr, ecx;
mov ecx, dword ptr[eax];
mov LeftTreeAddr, ecx;
popad;
}
if (wxIdAddr == 0xBAADF00D || wxIdAddr == 0x0 || wxIdAddr == -1 || IsBadWritePtr((LPVOID*)wxIdAddr, 10)) {
break;
}
else {
WxFriendStructA p(index, wxIdAddr, wxNumberAddr, wxNickNameAddr, wxRemarkAddr);
WxFriendList.push_back(p);
}
}
for (unsigned int i = 0; i < WxFriendList.size(); i++) {
cout << WxFriendList[i].index << " ";
cout << WxFriendList[i].wxid << " ";
cout << WxFriendList[i].wxNumber << " ";
cout << WxFriendList[i].wxNickName << " ";
cout << WxFriendList[i].wxRemark << " ";
cout << endl;
}
WxFriendList.clear();
}
\ No newline at end of file
文件已添加
...@@ -29,6 +29,9 @@ class ChatSession(): ...@@ -29,6 +29,9 @@ class ChatSession():
def SendArticle(self,title,abstract,url): def SendArticle(self,title,abstract,url):
return self.robot.CSendArticle(self.chatwith,title,abstract,url) return self.robot.CSendArticle(self.chatwith,title,abstract,url)
def SendCard(self,sharedwxid,nickname):
return self.robot.CSendCard(self.chatwith,sharedwxid,nickname)
class WeChatRobot(): class WeChatRobot():
...@@ -41,22 +44,21 @@ class WeChatRobot(): ...@@ -41,22 +44,21 @@ class WeChatRobot():
def StartService(self): def StartService(self):
status = self.robot.CStartRobotService(self.dllpath) status = self.robot.CStartRobotService(self.dllpath)
if status == 0:
pass
return status return status
# 有bug待修复,需要判断某项信息是否是指针 # 有bug待修复,需要判断某项信息是否是指针,修复前不要使用
def GetSelfInfo(self): def GetSelfInfo(self):
myinfo = self.robot.CGetSelfInfo().replace('\n','\\n') myinfo = self.robot.CGetSelfInfo().replace('\n','\\n')
myinfo = ast.literal_eval(myinfo) myinfo = ast.literal_eval(myinfo)
myinfo['wxBigAvatar'] = myinfo['wxBigAvatar'].replace("/132","/0") myinfo['wxBigAvatar'] = myinfo['wxBigAvatar'].replace("/132","/0")
return myinfo self.myinfo = myinfo
return self.myinfo
def StopService(self): def StopService(self):
return self.robot.CStopRobotService() return self.robot.CStopRobotService()
def GetAddressBook(self): def GetAddressBook(self):
AddressBookString = wx.robot.CGetFriendList() AddressBookString = self.robot.CGetFriendList()
AddressBookString = AddressBookString.replace("\n","\\n") AddressBookString = AddressBookString.replace("\n","\\n")
self.AddressBook = ast.literal_eval(AddressBookString) self.AddressBook = ast.literal_eval(AddressBookString)
return self.AddressBook return self.AddressBook
...@@ -120,29 +122,30 @@ class WeChatRobot(): ...@@ -120,29 +122,30 @@ class WeChatRobot():
return ast.literal_eval(userinfo) return ast.literal_eval(userinfo)
def test(): def test():
import os,sys
# DWeChatRobot.dll path
dllpath = os.path.join(sys.path[0],'Release')
# image full path # image full path
imgpath = r"C:\Users\Administrator\Desktop\快捷\wechat\测试图片.jpg" imgpath = os.path.join(sys.path[0],'test\\测试图片.png')
# file full path # file full path
filepath = r"C:\Users\Administrator\Desktop\快捷\wechat\MyWeChatRobot.zip" filepath = os.path.join(sys.path[0],'test\\测试文件')
# mp4 full path
mp4path = r"C:\Users\Administrator\Desktop\快捷\wechat\wxsend.mp4"
me = wx.GetFriendByWxNickName("文件传送助手")
session = wx.GetChatSession(me.get('wxid'))
print(wx.GetWxUserInfo(me.get('wxid')))
session.SendText('来自python的消息')
session.SendImage(imgpath)
session.SendFile(filepath)
session.SendMp4(mp4path)
if __name__ == '__main__':
# DWeChatRobot.dll path
dllpath = r'D:\VS2019C++\MyWeChatRobot\Release'
wx = WeChatRobot(dllpath) wx = WeChatRobot(dllpath)
wx.StartService() wx.StartService()
wxid = wx.GetFriendByWxNickName("文件传输助手").get('wxid') myinfo = wx.GetSelfInfo()
session = wx.GetChatSession(wxid) chatwith = wx.GetFriendByWxNickName("文件传输助手")
session = wx.GetChatSession(chatwith.get('wxid'))
filehelper = wx.GetWxUserInfo(chatwith.get('wxid'))
session.SendText('个人信息:{}'.format(str(myinfo.get('wxNickName'))))
session.SendText('好友信息:{}'.format(str(filehelper.get('wxNickName'))))
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") session.SendArticle("PC微信逆向--获取通讯录","确定不来看看么?","https://www.ljczero.top/article/2022/3/13/133.html")
shared = wx.GetFriendByWxNickName("小冰的宇宙")
wx.StopService() if shared:
\ No newline at end of file session.SendCard(shared.get('wxid'),shared.get('wxNickName'))
wx.StopService()
if __name__ == '__main__':
test()
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册