Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
888H355
ComWeChatRobot
提交
4abf77fe
C
ComWeChatRobot
项目概览
888H355
/
ComWeChatRobot
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
ComWeChatRobot
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
4abf77fe
编写于
6月 08, 2022
作者:
L
ljc545w
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
新增网络查询用户信息接口
上级
5d26bfdd
变更
19
隐藏空白更改
内联
并排
Showing
19 changed file
with
508 addition
and
18 deletion
+508
-18
CWeChatRobot/SearchContact.h
CWeChatRobot/SearchContact.h
+6
-0
CWeChatRobot/SearchContactByCache.cpp
CWeChatRobot/SearchContactByCache.cpp
+0
-0
CWeChatRobot/SearchContactByNet.cpp
CWeChatRobot/SearchContactByNet.cpp
+164
-0
CWeChatRobot/WeChatRobot.cpp
CWeChatRobot/WeChatRobot.cpp
+12
-1
CWeChatRobot/WeChatRobot.h
CWeChatRobot/WeChatRobot.h
+1
-0
CWeChatRobot/WeChatRobotCOM.idl
CWeChatRobot/WeChatRobotCOM.idl
+1
-0
CWeChatRobot/WeChatRobotCOM.vcxproj
CWeChatRobot/WeChatRobotCOM.vcxproj
+3
-2
CWeChatRobot/WeChatRobotCOM.vcxproj.filters
CWeChatRobot/WeChatRobotCOM.vcxproj.filters
+10
-7
CWeChatRobot/WeChatRobotCOM_i.h
CWeChatRobot/WeChatRobotCOM_i.h
+12
-0
CWeChatRobot/WeChatRobotCOM_p.c
CWeChatRobot/WeChatRobotCOM_p.c
+44
-5
CWeChatRobot/pch.cpp
CWeChatRobot/pch.cpp
+3
-0
CWeChatRobot/robotdata.h
CWeChatRobot/robotdata.h
+3
-1
DWeChatRobot/SearchContact.h
DWeChatRobot/SearchContact.h
+4
-1
DWeChatRobot/SearchContactByNet.cpp
DWeChatRobot/SearchContactByNet.cpp
+234
-0
DWeChatRobot/dllmain.cpp
DWeChatRobot/dllmain.cpp
+1
-0
DWeChatRobot/pch.cpp
DWeChatRobot/pch.cpp
+3
-0
Python/wxRobot.py
Python/wxRobot.py
+7
-1
Release/CWeChatRobot.exe
Release/CWeChatRobot.exe
+0
-0
Release/DWeChatRobot.dll
Release/DWeChatRobot.dll
+0
-0
未找到文件。
CWeChatRobot/
UserInfo
.h
→
CWeChatRobot/
SearchContact
.h
浏览文件 @
4abf77fe
...
...
@@ -2,4 +2,5 @@
#include <windows.h>
#include <iostream>
using
namespace
std
;
std
::
wstring
GetWxUserInfo
(
wchar_t
*
wxid
);
\ No newline at end of file
std
::
wstring
GetWxUserInfo
(
wchar_t
*
wxid
);
SAFEARRAY
*
SearchContactByNet
(
wchar_t
*
keyword
);
\ No newline at end of file
CWeChatRobot/
UserInfo
.cpp
→
CWeChatRobot/
SearchContactByCache
.cpp
浏览文件 @
4abf77fe
文件已移动
CWeChatRobot/SearchContactByNet.cpp
0 → 100644
浏览文件 @
4abf77fe
#include "pch.h"
static
struct
UserInfoAddr
{
DWORD
errcode
;
DWORD
keyword
;
int
l_keyword
;
DWORD
v3
;
int
l_v3
;
DWORD
NickName
;
int
l_NickName
;
DWORD
Signature
;
int
l_Signature
;
DWORD
v2
;
int
l_v2
;
DWORD
Nation
;
int
l_Nation
;
DWORD
Province
;
int
l_Province
;
DWORD
City
;
int
l_City
;
DWORD
BigAvatar
;
int
l_BigAvatar
;
DWORD
SmallAvatar
;
int
l_SmallAvatar
;
DWORD
sex
;
BOOL
over
;
}
userinfoaddr
;
static
struct
UserInfo
{
wchar_t
*
keyword
;
wchar_t
*
v3
;
wchar_t
*
NickName
;
wchar_t
*
Signature
;
wchar_t
*
v2
;
wchar_t
*
Nation
;
wchar_t
*
Province
;
wchar_t
*
City
;
wchar_t
*
BigAvatar
;
wchar_t
*
SmallAvatar
;
DWORD
sex
;
}
userinfo
;
static
vector
<
wstring
>
UserInfoKey
=
{
L"keyword"
,
L"v3"
,
L"NickName"
,
L"Signature"
,
L"v2"
,
L"Nation"
,
L"Province"
,
L"City"
,
L"BigAvatar"
,
L"SmallAvatar"
,
L"Sex"
};
static
void
ClearUserInfoCache
()
{
ZeroMemory
(
&
userinfoaddr
,
sizeof
(
UserInfoAddr
));
if
(
userinfo
.
keyword
)
{
delete
userinfo
.
keyword
;
}
if
(
userinfo
.
v2
)
{
delete
userinfo
.
v2
;
}
if
(
userinfo
.
v3
)
{
delete
userinfo
.
v3
;
}
if
(
userinfo
.
NickName
)
{
delete
userinfo
.
NickName
;
}
if
(
userinfo
.
Nation
)
{
delete
userinfo
.
Nation
;
}
if
(
userinfo
.
Province
)
{
delete
userinfo
.
Province
;
}
if
(
userinfo
.
City
)
{
delete
userinfo
.
City
;
}
if
(
userinfo
.
Signature
)
{
delete
userinfo
.
Signature
;
}
if
(
userinfo
.
SmallAvatar
)
{
delete
userinfo
.
SmallAvatar
;
}
if
(
userinfo
.
BigAvatar
)
{
delete
userinfo
.
BigAvatar
;
}
ZeroMemory
(
&
userinfo
,
sizeof
(
UserInfo
));
}
static
SAFEARRAY
*
CreateUserInfoArray
()
{
HRESULT
hr
=
S_OK
;
SAFEARRAY
*
psaValue
;
SAFEARRAYBOUND
rgsaBound
[
2
]
=
{
{
UserInfoKey
.
size
(),
0
},{
2
,
0
}
};
psaValue
=
SafeArrayCreate
(
VT_VARIANT
,
2
,
rgsaBound
);
wchar_t
**
userinfoArray
=
(
wchar_t
**
)
&
userinfo
;
for
(
unsigned
long
i
=
0
;
i
<
UserInfoKey
.
size
();
i
++
)
{
long
keyIndex
[
2
]
=
{
(
long
)
i
,
0
};
hr
=
SafeArrayPutElement
(
psaValue
,
keyIndex
,
&
(
_variant_t
)
UserInfoKey
[
i
].
c_str
());
long
valueIndex
[
2
]
=
{
(
long
)
i
,
1
};
if
(
i
!=
UserInfoKey
.
size
()
-
1
)
hr
=
SafeArrayPutElement
(
psaValue
,
valueIndex
,
&
(
_variant_t
)
userinfoArray
[(
int
)
i
]);
else
hr
=
SafeArrayPutElement
(
psaValue
,
valueIndex
,
&
(
_variant_t
)
userinfo
.
sex
);
}
ClearUserInfoCache
();
return
psaValue
;
}
static
void
ReadUserInfoFromMemory
()
{
userinfo
.
keyword
=
new
wchar_t
[
userinfoaddr
.
l_keyword
+
1
];
ReadProcessMemory
(
hProcess
,
(
LPCVOID
)
userinfoaddr
.
keyword
,
userinfo
.
keyword
,
(
userinfoaddr
.
l_keyword
+
1
)
*
sizeof
(
wchar_t
),
0
);
userinfo
.
v3
=
new
wchar_t
[
userinfoaddr
.
l_v3
+
1
];
ReadProcessMemory
(
hProcess
,
(
LPCVOID
)
userinfoaddr
.
v3
,
userinfo
.
v3
,
(
userinfoaddr
.
l_v3
+
1
)
*
sizeof
(
wchar_t
),
0
);
userinfo
.
NickName
=
new
wchar_t
[
userinfoaddr
.
l_NickName
+
1
];
ReadProcessMemory
(
hProcess
,
(
LPCVOID
)
userinfoaddr
.
NickName
,
userinfo
.
NickName
,
(
userinfoaddr
.
l_NickName
+
1
)
*
sizeof
(
wchar_t
),
0
);
userinfo
.
Signature
=
new
wchar_t
[
userinfoaddr
.
l_Signature
+
1
];
ReadProcessMemory
(
hProcess
,
(
LPCVOID
)
userinfoaddr
.
Signature
,
userinfo
.
Signature
,
(
userinfoaddr
.
l_Signature
+
1
)
*
sizeof
(
wchar_t
),
0
);
userinfo
.
v2
=
new
wchar_t
[
userinfoaddr
.
l_v2
+
1
];
ReadProcessMemory
(
hProcess
,
(
LPCVOID
)
userinfoaddr
.
v2
,
userinfo
.
v2
,
(
userinfoaddr
.
l_v2
+
1
)
*
sizeof
(
wchar_t
),
0
);
userinfo
.
Nation
=
new
wchar_t
[
userinfoaddr
.
l_Nation
+
1
];
ReadProcessMemory
(
hProcess
,
(
LPCVOID
)
userinfoaddr
.
Nation
,
userinfo
.
Nation
,
(
userinfoaddr
.
l_Nation
+
1
)
*
sizeof
(
wchar_t
),
0
);
userinfo
.
Province
=
new
wchar_t
[
userinfoaddr
.
l_Province
+
1
];
ReadProcessMemory
(
hProcess
,
(
LPCVOID
)
userinfoaddr
.
Province
,
userinfo
.
Province
,
(
userinfoaddr
.
l_Province
+
1
)
*
sizeof
(
wchar_t
),
0
);
userinfo
.
City
=
new
wchar_t
[
userinfoaddr
.
l_City
+
1
];
ReadProcessMemory
(
hProcess
,
(
LPCVOID
)
userinfoaddr
.
City
,
userinfo
.
City
,
(
userinfoaddr
.
l_City
+
1
)
*
sizeof
(
wchar_t
),
0
);
userinfo
.
BigAvatar
=
new
wchar_t
[
userinfoaddr
.
l_BigAvatar
+
1
];
ReadProcessMemory
(
hProcess
,
(
LPCVOID
)
userinfoaddr
.
BigAvatar
,
userinfo
.
BigAvatar
,
(
userinfoaddr
.
l_BigAvatar
+
1
)
*
sizeof
(
wchar_t
),
0
);
userinfo
.
SmallAvatar
=
new
wchar_t
[
userinfoaddr
.
l_SmallAvatar
+
1
];
ReadProcessMemory
(
hProcess
,
(
LPCVOID
)
userinfoaddr
.
SmallAvatar
,
userinfo
.
SmallAvatar
,
(
userinfoaddr
.
l_SmallAvatar
+
1
)
*
sizeof
(
wchar_t
),
0
);
userinfo
.
sex
=
userinfoaddr
.
sex
;
}
SAFEARRAY
*
SearchContactByNet
(
wchar_t
*
keyword
)
{
if
(
!
hProcess
)
return
NULL
;
ClearUserInfoCache
();
DWORD
SearchContactByNetRemoteAddr
=
GetWeChatRobotBase
()
+
SearchContactByNetRemoteOffset
;
LPVOID
keywordaddr
=
VirtualAllocEx
(
hProcess
,
NULL
,
1
,
MEM_COMMIT
,
PAGE_READWRITE
);
DWORD
dwWriteSize
=
0
;
DWORD
dwId
=
0
;
DWORD
dwHandle
=
0
;
if
(
!
keywordaddr
)
return
NULL
;
WriteProcessMemory
(
hProcess
,
keywordaddr
,
keyword
,
wcslen
(
keyword
)
*
2
+
2
,
&
dwWriteSize
);
HANDLE
hThread
=
::
CreateRemoteThread
(
hProcess
,
NULL
,
0
,
(
LPTHREAD_START_ROUTINE
)
SearchContactByNetRemoteAddr
,
keywordaddr
,
0
,
&
dwId
);
if
(
hThread
)
{
WaitForSingleObject
(
hThread
,
INFINITE
);
GetExitCodeThread
(
hThread
,
&
dwHandle
);
CloseHandle
(
hThread
);
}
VirtualFreeEx
(
hProcess
,
keywordaddr
,
0
,
MEM_RELEASE
);
if
(
!
dwHandle
)
return
NULL
;
ReadProcessMemory
(
hProcess
,
(
LPCVOID
)
dwHandle
,
&
userinfoaddr
,
sizeof
(
UserInfoAddr
),
&
dwWriteSize
);
if
(
userinfoaddr
.
errcode
==
0
)
{
ReadUserInfoFromMemory
();
SAFEARRAY
*
psa
=
CreateUserInfoArray
();
return
psa
;
}
return
NULL
;
}
\ No newline at end of file
CWeChatRobot/WeChatRobot.cpp
浏览文件 @
4abf77fe
...
...
@@ -226,7 +226,6 @@ STDMETHODIMP CWeChatRobot::CGetDbHandles(VARIANT* __result) {
STDMETHODIMP
CWeChatRobot
::
CExecuteSQL
(
DWORD
DbHandle
,
BSTR
sql
,
VARIANT
*
__result
)
{
VARIANT
vsaValue
;
vsaValue
.
vt
=
VT_ARRAY
|
VT_VARIANT
;
vsaValue
.
intVal
=
0
;
V_ARRAY
(
&
vsaValue
)
=
ExecuteSQL
(
DbHandle
,
sql
);
*
__result
=
vsaValue
;
return
S_OK
;
...
...
@@ -289,4 +288,16 @@ STDMETHODIMP CWeChatRobot::CStartWeChat(int* __result) {
StartWeChat
();
*
__result
=
0
;
return
S_OK
;
}
/*
* 参数1:搜索关键字
* 参数2:预返回的值,调用时无需提供
*/
STDMETHODIMP
CWeChatRobot
::
CSearchContactByNet
(
BSTR
keyword
,
VARIANT
*
__result
)
{
VARIANT
vsaValue
;
vsaValue
.
vt
=
VT_ARRAY
|
VT_VARIANT
;
V_ARRAY
(
&
vsaValue
)
=
SearchContactByNet
(
keyword
);
*
__result
=
vsaValue
;
return
S_OK
;
}
\ No newline at end of file
CWeChatRobot/WeChatRobot.h
浏览文件 @
4abf77fe
...
...
@@ -79,6 +79,7 @@ public:
STDMETHODIMP
CAddFriendByV3
(
BSTR
v3
,
BSTR
message
,
int
AddType
,
int
*
__result
);
STDMETHODIMP
CGetWeChatVer
(
BSTR
*
__result
);
STDMETHODIMP
CStartWeChat
(
int
*
__result
);
STDMETHODIMP
CSearchContactByNet
(
BSTR
keyword
,
VARIANT
*
__result
);
};
OBJECT_ENTRY_AUTO
(
__uuidof
(
WeChatRobot
),
CWeChatRobot
)
CWeChatRobot/WeChatRobotCOM.idl
浏览文件 @
4abf77fe
...
...
@@ -44,6 +44,7 @@ interface IWeChatRobot : IDispatch
[
id
(
26
)
]
HRESULT
CAddFriendByV3
(
[
in
]
BSTR
v3
,
[
in
]
BSTR
message
,
[
in
]
int
AddType
,
[
out
,
retval
]
int
*
__result
)
;
[
id
(
27
)
]
HRESULT
CGetWeChatVer
(
[
out
,
retval
]
BSTR
*
__result
)
;
[
id
(
28
)
]
HRESULT
CStartWeChat
(
[
out
,
retval
]
int
*
__result
)
;
[
id
(
29
)
]
HRESULT
CSearchContactByNet
(
[
in
]
BSTR
keyword
,
[
out
,
retval
]
VARIANT
*
__result
)
;
}
;
[
uuid
(
721
abb35
-
141
a
-
4
aa2
-
94
f2
-
762
e2833fa6c
),
...
...
CWeChatRobot/WeChatRobotCOM.vcxproj
浏览文件 @
4abf77fe
...
...
@@ -232,7 +232,7 @@
<ClInclude
Include=
"SendImage.h"
/>
<ClInclude
Include=
"SendText.h"
/>
<ClInclude
Include=
"targetver.h"
/>
<ClInclude
Include=
"
UserInfo
.h"
/>
<ClInclude
Include=
"
SearchContact
.h"
/>
<ClInclude
Include=
"VerifyFriendApply.h"
/>
<ClInclude
Include=
"WeChatRobot.h"
/>
<ClInclude
Include=
"WeChatRobotCOM_i.h"
/>
...
...
@@ -255,6 +255,7 @@
<PrecompiledHeader
Condition=
"'$(Configuration)|$(Platform)'=='Release|x64'"
>
Create
</PrecompiledHeader>
</ClCompile>
<ClCompile
Include=
"ReceiveMessage.cpp"
/>
<ClCompile
Include=
"SearchContactByNet.cpp"
/>
<ClCompile
Include=
"SelfInfo.cpp"
/>
<ClCompile
Include=
"SendArticle.cpp"
/>
<ClCompile
Include=
"SendAtText.cpp"
/>
...
...
@@ -262,7 +263,7 @@
<ClCompile
Include=
"SendFile.cpp"
/>
<ClCompile
Include=
"SendImage.cpp"
/>
<ClCompile
Include=
"SendText.cpp"
/>
<ClCompile
Include=
"
UserInfo
.cpp"
/>
<ClCompile
Include=
"
SearchContactByCache
.cpp"
/>
<ClCompile
Include=
"VerifyFriendApply.cpp"
/>
<ClCompile
Include=
"WeChatRobot.cpp"
/>
<ClCompile
Include=
"WeChatRobotCOM.cpp"
/>
...
...
CWeChatRobot/WeChatRobotCOM.vcxproj.filters
浏览文件 @
4abf77fe
...
...
@@ -38,9 +38,6 @@
<Filter
Include=
"好友相关\好友列表"
>
<UniqueIdentifier>
{be3e55a9-dd57-4e92-a340-cb558f3cd4f7}
</UniqueIdentifier>
</Filter>
<Filter
Include=
"好友相关\好友信息"
>
<UniqueIdentifier>
{cdd9e8b4-4576-499c-b20e-60e05911f6d6}
</UniqueIdentifier>
</Filter>
<Filter
Include=
"个人信息"
>
<UniqueIdentifier>
{82fef7e4-e819-4cb2-9087-40ae1f426e73}
</UniqueIdentifier>
</Filter>
...
...
@@ -83,6 +80,9 @@
<Filter
Include=
"好友相关\添加好友"
>
<UniqueIdentifier>
{14bcc8af-c28c-4911-8be2-53280ec154ec}
</UniqueIdentifier>
</Filter>
<Filter
Include=
"好友相关\搜索好友"
>
<UniqueIdentifier>
{cdd9e8b4-4576-499c-b20e-60e05911f6d6}
</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude
Include=
"framework.h"
>
...
...
@@ -124,8 +124,8 @@
<ClInclude
Include=
"robotdata.h"
>
<Filter>
头文件
</Filter>
</ClInclude>
<ClInclude
Include=
"
UserInfo
.h"
>
<Filter>
好友相关\
好友信息
</Filter>
<ClInclude
Include=
"
SearchContact
.h"
>
<Filter>
好友相关\
搜索好友
</Filter>
</ClInclude>
<ClInclude
Include=
"SelfInfo.h"
>
<Filter>
个人信息
</Filter>
...
...
@@ -195,8 +195,8 @@
<ClCompile
Include=
"SendFile.cpp"
>
<Filter>
发送消息\发送文件
</Filter>
</ClCompile>
<ClCompile
Include=
"
UserInfo
.cpp"
>
<Filter>
好友相关\
好友信息
</Filter>
<ClCompile
Include=
"
SearchContactByCache
.cpp"
>
<Filter>
好友相关\
搜索好友
</Filter>
</ClCompile>
<ClCompile
Include=
"SelfInfo.cpp"
>
<Filter>
个人信息
</Filter>
...
...
@@ -237,6 +237,9 @@
<ClCompile
Include=
"AddFriendByV3.cpp"
>
<Filter>
好友相关\添加好友
</Filter>
</ClCompile>
<ClCompile
Include=
"SearchContactByNet.cpp"
>
<Filter>
好友相关\搜索好友
</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile
Include=
"WeChatRobotCOM.rc"
>
...
...
CWeChatRobot/WeChatRobotCOM_i.h
浏览文件 @
4abf77fe
...
...
@@ -202,6 +202,10 @@ EXTERN_C const IID IID_IWeChatRobot;
virtual
/* [id] */
HRESULT
STDMETHODCALLTYPE
CStartWeChat
(
/* [retval][out] */
int
*
__result
)
=
0
;
virtual
/* [id] */
HRESULT
STDMETHODCALLTYPE
CSearchContactByNet
(
/* [in] */
BSTR
keyword
,
/* [retval][out] */
VARIANT
*
__result
)
=
0
;
};
...
...
@@ -402,6 +406,11 @@ EXTERN_C const IID IID_IWeChatRobot;
IWeChatRobot
*
This
,
/* [retval][out] */
int
*
__result
);
/* [id] */
HRESULT
(
STDMETHODCALLTYPE
*
CSearchContactByNet
)(
IWeChatRobot
*
This
,
/* [in] */
BSTR
keyword
,
/* [retval][out] */
VARIANT
*
__result
);
END_INTERFACE
}
IWeChatRobotVtbl
;
...
...
@@ -522,6 +531,9 @@ EXTERN_C const IID IID_IWeChatRobot;
#define IWeChatRobot_CStartWeChat(This,__result) \
(
(
This
)
->
lpVtbl
->
CStartWeChat
(
This
,
__result
)
)
#define IWeChatRobot_CSearchContactByNet(This,keyword,__result) \
(
(
This
)
->
lpVtbl
->
CSearchContactByNet
(
This
,
keyword
,
__result
)
)
#endif
/* COBJMACROS */
...
...
CWeChatRobot/WeChatRobotCOM_p.c
浏览文件 @
4abf77fe
...
...
@@ -49,7 +49,7 @@
#include "WeChatRobotCOM_i.h"
#define TYPE_FORMAT_STRING_SIZE 1239
#define PROC_FORMAT_STRING_SIZE 1
189
#define PROC_FORMAT_STRING_SIZE 1
231
#define EXPR_FORMAT_STRING_SIZE 1
#define TRANSMIT_AS_TABLE_SIZE 0
#define WIRE_MARSHAL_TABLE_SIZE 2
...
...
@@ -1148,6 +1148,42 @@ static const WeChatRobotCOM_MIDL_PROC_FORMAT_STRING WeChatRobotCOM__MIDL_ProcFor
/* 1186 */
0x8
,
/* FC_LONG */
0x0
,
/* 0 */
/* Procedure CSearchContactByNet */
/* 1188 */
0x33
,
/* FC_AUTO_HANDLE */
0x6c
,
/* Old Flags: object, Oi2 */
/* 1190 */
NdrFcLong
(
0x0
),
/* 0 */
/* 1194 */
NdrFcShort
(
0x23
),
/* 35 */
/* 1196 */
NdrFcShort
(
0x10
),
/* x86 Stack size/offset = 16 */
/* 1198 */
NdrFcShort
(
0x0
),
/* 0 */
/* 1200 */
NdrFcShort
(
0x8
),
/* 8 */
/* 1202 */
0x47
,
/* Oi2 Flags: srv must size, clt must size, has return, has ext, */
0x3
,
/* 3 */
/* 1204 */
0x8
,
/* 8 */
0x47
,
/* Ext Flags: new corr desc, clt corr check, srv corr check, has range on conformance */
/* 1206 */
NdrFcShort
(
0x1
),
/* 1 */
/* 1208 */
NdrFcShort
(
0x1
),
/* 1 */
/* 1210 */
NdrFcShort
(
0x0
),
/* 0 */
/* Parameter keyword */
/* 1212 */
NdrFcShort
(
0x8b
),
/* Flags: must size, must free, in, by val, */
/* 1214 */
NdrFcShort
(
0x4
),
/* x86 Stack size/offset = 4 */
/* 1216 */
NdrFcShort
(
0x2a
),
/* Type Offset=42 */
/* Parameter __result */
/* 1218 */
NdrFcShort
(
0x4113
),
/* Flags: must size, must free, out, simple ref, srv alloc size=16 */
/* 1220 */
NdrFcShort
(
0x8
),
/* x86 Stack size/offset = 8 */
/* 1222 */
NdrFcShort
(
0x4ac
),
/* Type Offset=1196 */
/* Return value */
/* 1224 */
NdrFcShort
(
0x70
),
/* Flags: out, return, base type, */
/* 1226 */
NdrFcShort
(
0xc
),
/* x86 Stack size/offset = 12 */
/* 1228 */
0x8
,
/* FC_LONG */
0x0
,
/* 0 */
0x0
}
};
...
...
@@ -2020,7 +2056,8 @@ static const unsigned short IWeChatRobot_FormatStringOffsetTable[] =
1014
,
1062
,
1116
,
1152
1152
,
1188
};
static
const
MIDL_STUBLESS_PROXY_INFO
IWeChatRobot_ProxyInfo
=
...
...
@@ -2044,7 +2081,7 @@ static const MIDL_SERVER_INFO IWeChatRobot_ServerInfo =
0
,
0
,
0
};
CINTERFACE_PROXY_VTABLE
(
3
5
)
_IWeChatRobotProxyVtbl
=
CINTERFACE_PROXY_VTABLE
(
3
6
)
_IWeChatRobotProxyVtbl
=
{
&
IWeChatRobot_ProxyInfo
,
&
IID_IWeChatRobot
,
...
...
@@ -2082,7 +2119,8 @@ CINTERFACE_PROXY_VTABLE(35) _IWeChatRobotProxyVtbl =
(
void
*
)
(
INT_PTR
)
-
1
/* IWeChatRobot::CAddFriendByWxid */
,
(
void
*
)
(
INT_PTR
)
-
1
/* IWeChatRobot::CAddFriendByV3 */
,
(
void
*
)
(
INT_PTR
)
-
1
/* IWeChatRobot::CGetWeChatVer */
,
(
void
*
)
(
INT_PTR
)
-
1
/* IWeChatRobot::CStartWeChat */
(
void
*
)
(
INT_PTR
)
-
1
/* IWeChatRobot::CStartWeChat */
,
(
void
*
)
(
INT_PTR
)
-
1
/* IWeChatRobot::CSearchContactByNet */
};
...
...
@@ -2119,6 +2157,7 @@ static const PRPC_STUB_FUNCTION IWeChatRobot_table[] =
NdrStubCall2
,
NdrStubCall2
,
NdrStubCall2
,
NdrStubCall2
,
NdrStubCall2
};
...
...
@@ -2126,7 +2165,7 @@ CInterfaceStubVtbl _IWeChatRobotStubVtbl =
{
&
IID_IWeChatRobot
,
&
IWeChatRobot_ServerInfo
,
3
5
,
3
6
,
&
IWeChatRobot_table
[
-
3
],
CStdStubBuffer_DELEGATING_METHODS
};
...
...
CWeChatRobot/pch.cpp
浏览文件 @
4abf77fe
...
...
@@ -19,6 +19,7 @@ DWORD DeleteUserInfoCacheOffset = 0x0;
DWORD
GetSelfInfoOffset
=
0x0
;
DWORD
DeleteSelfInfoCacheOffset
=
0x0
;
DWORD
SearchContactByNetRemoteOffset
=
0x0
;
DWORD
VerifyFriendApplyOffset
=
0x0
;
...
...
@@ -133,6 +134,8 @@ BOOL GetProcOffset(wchar_t* workPath) {
GetSelfInfoOffset
=
GetSelfInfoProcAddr
-
WeChatBase
;
DWORD
DeleteSelfInfoCacheProcAddr
=
(
DWORD
)
GetProcAddress
(
hd
,
DeleteSelfInfoCacheRemote
);
DeleteSelfInfoCacheOffset
=
DeleteSelfInfoCacheProcAddr
-
WeChatBase
;
DWORD
SearchContactByNetRemoteAddr
=
(
DWORD
)
GetProcAddress
(
hd
,
SearchContactByNetRemote
);
SearchContactByNetRemoteOffset
=
SearchContactByNetRemoteAddr
-
WeChatBase
;
DWORD
CheckFriendStatusInitRemoteAddr
=
(
DWORD
)
GetProcAddress
(
hd
,
CheckFriendStatusInitRemote
);
CheckFriendStatusInitRemoteOffset
=
CheckFriendStatusInitRemoteAddr
-
WeChatBase
;
...
...
CWeChatRobot/robotdata.h
浏览文件 @
4abf77fe
...
...
@@ -7,7 +7,7 @@
#include "SendCard.h"
#include "SendAtText.h"
#include "FriendList.h"
#include "
UserInfo
.h"
#include "
SearchContact
.h"
#include "SelfInfo.h"
#include "CheckFriendStatus.h"
#include "ReceiveMessage.h"
...
...
@@ -32,6 +32,7 @@ extern DWORD GetFriendListFinishOffset;
extern
DWORD
GetWxUserInfoOffset
;
extern
DWORD
DeleteUserInfoCacheOffset
;
extern
DWORD
SearchContactByNetRemoteOffset
;
extern
DWORD
VerifyFriendApplyOffset
;
...
...
@@ -77,6 +78,7 @@ extern DWORD AddFriendByV3RemoteOffset;
#define GetSelfInfoRemote "GetSelfInfoRemote"
#define DeleteSelfInfoCacheRemote "DeleteSelfInfoCacheRemote"
#define SearchContactByNetRemote "SearchContactByNetRemote"
#define VerifyFriendApplyRemote "VerifyFriendApplyRemote"
...
...
DWeChatRobot/SearchContact.h
浏览文件 @
4abf77fe
...
...
@@ -4,4 +4,7 @@ BOOL __stdcall GetUserInfoByWxId(wchar_t* wxid);
extern
"C"
__declspec
(
dllexport
)
DWORD
GetWxUserInfoRemote
(
LPVOID
lparamter
);
extern
"C"
__declspec
(
dllexport
)
VOID
DeleteUserInfoCacheRemote
();
wchar_t
*
__stdcall
GetUserNickNameByWxId
(
wchar_t
*
wxid
);
void
__stdcall
SearchContactByNet
(
wchar_t
*
keyword
);
\ No newline at end of file
void
__stdcall
SearchContactByNet
(
wchar_t
*
keyword
);
extern
"C"
__declspec
(
dllexport
)
DWORD
SearchContactByNetRemote
(
LPVOID
keyword
);
void
StopSearchContactHook
();
\ No newline at end of file
DWeChatRobot/SearchContactByNet.cpp
浏览文件 @
4abf77fe
...
...
@@ -3,7 +3,223 @@
#define SearchContactByNetCall1Offset 0x638BF150 - 0x635C0000
#define SearchContactByNetCall2Offset 0x63ACF9C0 - 0x635C0000
#define HookSearchContactErrcodeAddrOffset 0x04DD97C4 - 0x047A0000
#define HookSearchContactErrcodeNextCallOffset 0x0425F170 - 0x03AF0000
#define HookUserInfoAddrOffset 0x04ABB520 - 0x047A0000
#define HookUserInfoNextCallOffset 0x04ABB770 - 0x047A0000
static
BOOL
SearchContactHooked
=
false
;
static
char
HookSearchContactErrcodeOldAsm
[
5
]
=
{
0
};
static
char
HookUserInfoOldAsm
[
5
]
=
{
0
};
static
DWORD
WeChatWinBase
=
GetWeChatWinBase
();
static
struct
UserInfo
{
int
errcode
;
wchar_t
*
keyword
;
int
l_keyword
;
wchar_t
*
v3
;
int
l_v3
;
wchar_t
*
NickName
;
int
l_NickName
;
wchar_t
*
Signature
;
int
l_Signature
;
wchar_t
*
v2
;
int
l_v2
;
wchar_t
*
Nation
;
int
l_Nation
;
wchar_t
*
Province
;
int
l_Province
;
wchar_t
*
City
;
int
l_City
;
wchar_t
*
BigAvatar
;
int
l_BigAvatar
;
wchar_t
*
SmallAvatar
;
int
l_SmallAvatar
;
DWORD
sex
;
BOOL
over
;
}
userinfo
;
DWORD
HookSearchContactErrcodeNextCall
=
WeChatWinBase
+
HookSearchContactErrcodeNextCallOffset
;
DWORD
HookSearchContactErrcodeAddr
=
WeChatWinBase
+
HookSearchContactErrcodeAddrOffset
;
DWORD
HookSearchContactErrcodeJmpBackAddr
=
HookSearchContactErrcodeAddr
+
0x5
;
DWORD
HookUserInfoNextCall
=
WeChatWinBase
+
HookUserInfoNextCallOffset
;
DWORD
HookUserInfoAddr
=
WeChatWinBase
+
HookUserInfoAddrOffset
;
DWORD
HookUserInfoJmpBackAddr
=
HookUserInfoAddr
+
0x5
;
void
GetNetUserInfoFromMemory
(
DWORD
address
)
{
DWORD
length
=
*
(
DWORD
*
)(
address
+
0x8
);
userinfo
.
keyword
=
new
wchar_t
[
length
+
1
];
userinfo
.
l_keyword
=
length
;
if
(
length
)
memcpy
(
userinfo
.
keyword
,
(
wchar_t
*
)(
*
(
DWORD
*
)(
address
+
0x4
)),
(
length
+
1
)
*
sizeof
(
wchar_t
));
else
ZeroMemory
(
userinfo
.
keyword
,
(
length
+
1
)
*
sizeof
(
wchar_t
));
length
=
*
(
DWORD
*
)(
address
+
0x1C
);
userinfo
.
v3
=
new
wchar_t
[
length
+
1
];
userinfo
.
l_v3
=
length
;
if
(
length
)
memcpy
(
userinfo
.
v3
,
(
wchar_t
*
)(
*
(
DWORD
*
)(
address
+
0x18
)),
(
length
+
1
)
*
sizeof
(
wchar_t
));
else
ZeroMemory
(
userinfo
.
v3
,
(
length
+
1
)
*
sizeof
(
wchar_t
));
length
=
*
(
DWORD
*
)(
address
+
0x30
);
userinfo
.
BigAvatar
=
new
wchar_t
[
length
+
1
];
userinfo
.
l_BigAvatar
=
length
;
if
(
length
)
memcpy
(
userinfo
.
BigAvatar
,
(
wchar_t
*
)(
*
(
DWORD
*
)(
address
+
0x2C
)),
(
length
+
1
)
*
sizeof
(
wchar_t
));
else
ZeroMemory
(
userinfo
.
BigAvatar
,
(
length
+
1
)
*
sizeof
(
wchar_t
));
length
=
*
(
DWORD
*
)(
address
+
0xC8
);
userinfo
.
NickName
=
new
wchar_t
[
length
+
1
];
userinfo
.
l_NickName
=
length
;
if
(
length
)
memcpy
(
userinfo
.
NickName
,
(
wchar_t
*
)(
*
(
DWORD
*
)(
address
+
0xC4
)),
(
length
+
1
)
*
sizeof
(
wchar_t
));
else
ZeroMemory
(
userinfo
.
NickName
,
(
length
+
1
)
*
sizeof
(
wchar_t
));
length
=
*
(
DWORD
*
)(
address
+
0x108
);
userinfo
.
v2
=
new
wchar_t
[
length
+
1
];
userinfo
.
l_v2
=
length
;
if
(
length
)
memcpy
(
userinfo
.
v2
,
(
wchar_t
*
)(
*
(
DWORD
*
)(
address
+
0x104
)),
(
length
+
1
)
*
sizeof
(
wchar_t
));
else
ZeroMemory
(
userinfo
.
v2
,
(
length
+
1
)
*
sizeof
(
wchar_t
));
length
=
*
(
DWORD
*
)(
address
+
0x16C
);
userinfo
.
SmallAvatar
=
new
wchar_t
[
length
+
1
];
userinfo
.
l_SmallAvatar
=
length
;
if
(
length
)
memcpy
(
userinfo
.
SmallAvatar
,
(
wchar_t
*
)(
*
(
DWORD
*
)(
address
+
0x168
)),
(
length
+
1
)
*
sizeof
(
wchar_t
));
else
ZeroMemory
(
userinfo
.
SmallAvatar
,
(
length
+
1
)
*
sizeof
(
wchar_t
));
length
=
*
(
DWORD
*
)(
address
+
0x1F8
);
userinfo
.
Signature
=
new
wchar_t
[
length
+
1
];
userinfo
.
l_Signature
=
length
;
if
(
length
)
memcpy
(
userinfo
.
Signature
,
(
wchar_t
*
)(
*
(
DWORD
*
)(
address
+
0x1F4
)),
(
length
+
1
)
*
sizeof
(
wchar_t
));
else
ZeroMemory
(
userinfo
.
Signature
,
(
length
+
1
)
*
sizeof
(
wchar_t
));
length
=
*
(
DWORD
*
)(
address
+
0x20C
);
userinfo
.
Nation
=
new
wchar_t
[
length
+
1
];
userinfo
.
l_Nation
=
length
;
if
(
length
)
memcpy
(
userinfo
.
Nation
,
(
wchar_t
*
)(
*
(
DWORD
*
)(
address
+
0x208
)),
(
length
+
1
)
*
sizeof
(
wchar_t
));
else
ZeroMemory
(
userinfo
.
Nation
,
(
length
+
1
)
*
sizeof
(
wchar_t
));
length
=
*
(
DWORD
*
)(
address
+
0x220
);
userinfo
.
Province
=
new
wchar_t
[
length
+
1
];
userinfo
.
l_Province
=
length
;
if
(
length
)
memcpy
(
userinfo
.
Province
,
(
wchar_t
*
)(
*
(
DWORD
*
)(
address
+
0x21C
)),
(
length
+
1
)
*
sizeof
(
wchar_t
));
else
ZeroMemory
(
userinfo
.
Province
,
(
length
+
1
)
*
sizeof
(
wchar_t
));
length
=
*
(
DWORD
*
)(
address
+
0x234
);
userinfo
.
City
=
new
wchar_t
[
length
+
1
];
userinfo
.
l_City
=
length
;
if
(
length
)
memcpy
(
userinfo
.
City
,
(
wchar_t
*
)(
*
(
DWORD
*
)(
address
+
0x230
)),
(
length
+
1
)
*
sizeof
(
wchar_t
));
else
ZeroMemory
(
userinfo
.
City
,
(
length
+
1
)
*
sizeof
(
wchar_t
));
userinfo
.
sex
=
*
(
DWORD
*
)(
address
+
0x1BC
);
userinfo
.
over
=
true
;
}
void
ChangeSearchContactErrcode
(
int
errcode
)
{
userinfo
.
errcode
=
errcode
;
}
__declspec
(
naked
)
void
dealSearchContactErrcode
()
{
__asm
{
pushad
;
pushfd
;
push
edi
;
call
ChangeSearchContactErrcode
;
add
esp
,
0x4
;
popfd
;
popad
;
call
HookSearchContactErrcodeNextCall
;
jmp
HookSearchContactErrcodeJmpBackAddr
;
}
}
__declspec
(
naked
)
void
dealUserInfo
()
{
__asm
{
pushad
;
pushfd
;
push
dword
ptr
[
ebp
+
0x14
];
call
GetNetUserInfoFromMemory
;
add
esp
,
0x4
;
popfd
;
popad
;
call
HookUserInfoNextCall
;
jmp
HookUserInfoJmpBackAddr
;
}
}
static
void
StartSearchContactHook
()
{
if
(
SearchContactHooked
)
return
;
HookAnyAddress
(
HookSearchContactErrcodeAddr
,
(
LPVOID
)
dealSearchContactErrcode
,
HookSearchContactErrcodeOldAsm
);
HookAnyAddress
(
HookUserInfoAddr
,(
LPVOID
)
dealUserInfo
,
HookUserInfoOldAsm
);
SearchContactHooked
=
true
;
}
void
StopSearchContactHook
()
{
if
(
!
SearchContactHooked
)
return
;
UnHookAnyAddress
(
HookSearchContactErrcodeAddr
,
HookSearchContactErrcodeOldAsm
);
UnHookAnyAddress
(
HookUserInfoAddr
,
HookUserInfoOldAsm
);
SearchContactHooked
=
false
;
}
static
void
DeleteUserInfoCache
()
{
if
(
userinfo
.
keyword
)
{
delete
userinfo
.
keyword
;
}
if
(
userinfo
.
v2
)
{
delete
userinfo
.
v2
;
}
if
(
userinfo
.
v3
)
{
delete
userinfo
.
v3
;
}
if
(
userinfo
.
NickName
)
{
delete
userinfo
.
NickName
;
}
if
(
userinfo
.
Nation
)
{
delete
userinfo
.
Nation
;
}
if
(
userinfo
.
Province
)
{
delete
userinfo
.
Province
;
}
if
(
userinfo
.
City
)
{
delete
userinfo
.
City
;
}
if
(
userinfo
.
Signature
)
{
delete
userinfo
.
Signature
;
}
if
(
userinfo
.
SmallAvatar
)
{
delete
userinfo
.
SmallAvatar
;
}
if
(
userinfo
.
BigAvatar
)
{
delete
userinfo
.
BigAvatar
;
}
ZeroMemory
(
&
userinfo
,
sizeof
(
UserInfo
));
userinfo
.
errcode
=
1
;
}
void
__stdcall
SearchContactByNet
(
wchar_t
*
keyword
)
{
StartSearchContactHook
();
DeleteUserInfoCache
();
DWORD
SearchContactByNetCall1
=
GetWeChatWinBase
()
+
SearchContactByNetCall1Offset
;
DWORD
SearchContactByNetCall2
=
GetWeChatWinBase
()
+
SearchContactByNetCall2Offset
;
WxBaseStruct
pkeyword
(
keyword
);
...
...
@@ -19,4 +235,22 @@ void __stdcall SearchContactByNet(wchar_t* keyword) {
popfd
;
popad
;
}
while
(
userinfo
.
errcode
==
1
&&
SearchContactHooked
)
{
Sleep
(
50
);
}
if
(
userinfo
.
errcode
==
0
)
{
while
(
userinfo
.
over
==
false
&&
SearchContactHooked
)
{
Sleep
(
50
);
}
#ifdef _DEBUG
wcout
<<
userinfo
.
v2
<<
endl
;
wcout
<<
userinfo
.
v3
<<
endl
;
#endif
}
}
DWORD
SearchContactByNetRemote
(
LPVOID
keyword
)
{
SearchContactByNet
((
wchar_t
*
)
keyword
);
return
(
DWORD
)
&
userinfo
;
}
\ No newline at end of file
DWeChatRobot/dllmain.cpp
浏览文件 @
4abf77fe
...
...
@@ -13,6 +13,7 @@ BOOL APIENTRY DllMain( HMODULE hModule,
#ifdef _DEBUG
if
(
ProcessIsWeChat
())
{
PrintProcAddr
();
// HookLogMsgInfo();
}
#endif
break
;
...
...
DWeChatRobot/pch.cpp
浏览文件 @
4abf77fe
...
...
@@ -115,6 +115,7 @@ void UnHookAnyAddress(DWORD dwHookAddr, char* originalRecieveCode)
void
UnHookAll
()
{
UnHookLogMsgInfo
();
UnHookReceiveMessage
();
StopSearchContactHook
();
return
;
}
...
...
@@ -172,6 +173,8 @@ void PrintProcAddr() {
printf
(
"AddFriendByV3 0x%08X
\n
"
,
(
DWORD
)
AddFriendByV3
);
printf
(
"AddFriendByWxid 0x%08X
\n
"
,
(
DWORD
)
AddFriendByWxid
);
printf
(
"SelectDataRemote 0x%08X
\n
"
,
(
DWORD
)
SelectDataRemote
);
printf
(
"SearchContactByNet 0x%08X
\n
"
,
(
DWORD
)
SearchContactByNet
);
printf
(
"SearchContactByNetRemote 0x%08X
\n
"
,
(
DWORD
)
SearchContactByNetRemote
);
}
BOOL
ProcessIsWeChat
()
...
...
Python/wxRobot.py
浏览文件 @
4abf77fe
...
...
@@ -259,4 +259,10 @@ class WeChatRobot():
return
self
.
robot
.
CGetWeChatVer
()
def
StartWeChat
(
self
):
return
self
.
robot
.
CStartWeChat
()
\ No newline at end of file
return
self
.
robot
.
CStartWeChat
()
def
GetUserInfoByNet
(
self
,
keyword
):
userinfo
=
self
.
robot
.
CSearchContactByNet
(
keyword
)
if
userinfo
:
return
dict
(
userinfo
)
return
userinfo
\ No newline at end of file
Release/CWeChatRobot.exe
浏览文件 @
4abf77fe
无法预览此类型文件
Release/DWeChatRobot.dll
浏览文件 @
4abf77fe
无法预览此类型文件
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录