Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
888H355
ComWeChatRobot
提交
02c78b33
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,发现更多精彩内容 >>
提交
02c78b33
编写于
6月 03, 2022
作者:
K
Kerwin
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
c# example
上级
1f056b9a
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
162 addition
and
19 deletion
+162
-19
.gitignore
.gitignore
+1
-0
wxRobot/Program.cs
wxRobot/Program.cs
+142
-19
wxRobot/packages.config
wxRobot/packages.config
+4
-0
wxRobot/wxRobot.csproj
wxRobot/wxRobot.csproj
+15
-0
未找到文件。
.gitignore
浏览文件 @
02c78b33
...
...
@@ -12,3 +12,4 @@
/wxRobot/bin/Debug/
/wxRobot/bin/Release/*.pdb
*/__pycache__/
packages
\ No newline at end of file
wxRobot/Program.cs
浏览文件 @
02c78b33
using
System
;
using
Newtonsoft.Json
;
using
Newtonsoft.Json.Linq
;
using
System
;
using
System.ComponentModel
;
using
System.Runtime.InteropServices
;
using
System.Threading
;
namespace
wxRobot
{
...
...
@@ -6,25 +11,143 @@ namespace wxRobot
{
static
void
Main
()
{
System
.
Type
wxProtId
=
Type
.
GetTypeFromProgID
(
"WeChatRobot.CWeChatRobot"
);
if
(
wxProtId
==
null
)
return
;
string
workpath
=
System
.
AppDomain
.
CurrentDomain
.
BaseDirectory
;
string
basePath
=
workpath
.
Replace
(
"wxRobot\\bin\\Release\\"
,
""
);
dynamic
wx
=
Activator
.
CreateInstance
(
wxProtId
);
wx
.
CStartRobotService
();
wx
.
CSendText
(
"filehelper"
,
"来自C艹艹的消息"
);
wx
.
CSendImage
(
"filehelper"
,
basePath
+
"test\\测试图片.png"
);
wx
.
CSendFile
(
"filehelper"
,
basePath
+
"test\\测试文件"
);
wx
.
CSendArticle
(
"filehelper"
,
"PC微信逆向--获取通讯录"
,
"确定不来看看么?"
,
"https://www.ljczero.top/article/2022/3/13/133.html"
);
string
selfinfo
=
wx
.
CGetSelfInfo
();
Console
.
WriteLine
(
selfinfo
);
System
.
Object
[,,]
FriendList
=
wx
.
CGetFriendList
();
int
length
=
FriendList
.
GetLength
(
0
);
for
(
int
i
=
0
;
i
<
1
/*length*/
;
i
++)
{
Console
.
WriteLine
(
FriendList
[
i
,
0
,
1
]);
var
wx
=
new
WeChatRobotCOMLib
.
WeChatRobotClass
();
try
{
string
workpath
=
System
.
AppDomain
.
CurrentDomain
.
BaseDirectory
;
string
basePath
=
workpath
.
Replace
(
"wxRobot\\bin\\Release\\"
,
""
);
wx
.
CStartRobotService
();
wx
.
CSendText
(
"filehelper"
,
"来自C艹艹的消息"
);
wx
.
CSendImage
(
"filehelper"
,
basePath
+
"test\\测试图片.png"
);
wx
.
CSendFile
(
"filehelper"
,
basePath
+
"test\\测试文件"
);
wx
.
CSendArticle
(
"filehelper"
,
"PC微信逆向--获取通讯录"
,
"确定不来看看么?"
,
"https://www.ljczero.top/article/2022/3/13/133.html"
);
var
selfinfo
=
wx
.
CGetSelfInfo
();
if
(
string
.
IsNullOrWhiteSpace
(
selfinfo
))
{
Console
.
WriteLine
(
"无法获取用户信息"
);
wx
.
CStopRobotService
();
return
;
}
Console
.
WriteLine
(
selfinfo
);
var
info
=
JsonConvert
.
DeserializeObject
<
WxUserInfo
>(
selfinfo
);
wx
.
CStartReceiveMessage
();
try
{
while
(
true
)
{
var
message
=
wx
.
CReceiveMessage
()
as
System
.
Object
[,];
if
(
message
==
null
)
{
Thread
.
Sleep
(
500
);
continue
;
}
var
msgType
=
(
MessageType
)
Convert
.
ToInt32
(
message
[
0
,
1
]);
var
sender
=
message
[
1
,
1
].
ToString
();
var
wxId
=
message
[
2
,
1
].
ToString
();
var
roomType
=
RoomType
.
Private
;
if
(
msgType
==
MessageType
.
ServiceGroup
)
{
roomType
=
RoomType
.
Service
;
}
else
if
(
sender
!=
wxId
)
{
roomType
=
RoomType
.
Group
;
}
var
content
=
message
[
3
,
1
].
ToString
();
var
filePath
=
message
[
4
,
1
].
ToString
();
var
wxUser
=
JsonConvert
.
DeserializeObject
<
WxUserInfo
>(
wx
.
CGetWxUserInfo
(
wxId
));
Console
.
WriteLine
(
$"消息类型:
{
msgType
}
"
);
Console
.
WriteLine
(
$"对话类型:
{
roomType
}
"
);
if
(
roomType
==
RoomType
.
Group
)
{
var
groupInfo
=
JsonConvert
.
DeserializeObject
<
WxUserInfo
>(
wx
.
CGetWxUserInfo
(
sender
));
Console
.
WriteLine
(
$"群:
{
groupInfo
.
WxId
}
\t
{
groupInfo
.
WxNickName
}
"
);
}
Console
.
WriteLine
(
$"来自:
{
wxUser
.
WxNumber
}
\t
{
wxUser
.
WxNickName
}
"
);
Console
.
WriteLine
(
$"内容:
{
content
}
"
);
Console
.
WriteLine
();
Thread
.
Sleep
(
500
);
}
}
catch
(
Exception
ex
)
{
Console
.
WriteLine
(
ex
);
}
finally
{
wx
.
CStopReceiveMessage
();
}
System
.
Object
[,,]
FriendList
=
wx
.
CGetFriendList
()
as
System
.
Object
[,,];
int
length
=
FriendList
.
GetLength
(
0
);
for
(
int
i
=
0
;
i
<
1
/*length*/
;
i
++)
{
Console
.
WriteLine
(
FriendList
[
i
,
1
,
1
]);
}
}
catch
(
Exception
ex
)
{
Console
.
WriteLine
(
ex
);
}
finally
{
wx
.
CStopRobotService
();
}
wx
.
CStopRobotService
();
}
}
enum
MessageType
{
Text
=
1
,
Image
=
3
,
/// <summary>
/// 服务号群发的消息
/// </summary>
ServiceGroup
=
49
,
}
enum
RoomType
{
Private
=
0
,
Group
=
1
,
Service
=
2
,
Subscription
=
3
,
}
public
class
WxUserInfo
{
/// <summary>
/// 原始 id
/// </summary>
public
string
WxId
{
get
;
set
;
}
/// <summary>
/// 修改过的微信号
/// </summary>
public
string
WxNumber
{
get
;
set
;
}
public
string
WxV3
{
get
;
set
;
}
public
string
WxRemark
{
get
;
set
;
}
public
string
WxNickName
{
get
;
set
;
}
public
string
WxBigAvatar
{
get
;
set
;
}
public
string
WxSmallAvatar
{
get
;
set
;
}
public
string
WxSignature
{
get
;
set
;
}
public
string
WxNation
{
get
;
set
;
}
public
string
WxProvince
{
get
;
set
;
}
public
string
WxCity
{
get
;
set
;
}
public
string
WxBackground
{
get
;
set
;
}
public
string
PhoneNumber
{
get
;
set
;
}
}
}
wxRobot/packages.config
0 → 100644
浏览文件 @
02c78b33
<?
xml
version
=
"1.0"
encoding
=
"utf-8"
?>
<
packages
>
<
package
id
=
"Newtonsoft.Json"
version
=
"13.0.1"
targetFramework
=
"net472"
/>
</
packages
>
\ No newline at end of file
wxRobot/wxRobot.csproj
浏览文件 @
02c78b33
...
...
@@ -33,6 +33,9 @@
<WarningLevel>
4
</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference
Include=
"Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL"
>
<HintPath>
..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll
</HintPath>
</Reference>
<Reference
Include=
"System"
/>
<Reference
Include=
"System.Core"
/>
<Reference
Include=
"System.Xml.Linq"
/>
...
...
@@ -48,6 +51,18 @@
</ItemGroup>
<ItemGroup>
<None
Include=
"App.config"
/>
<None
Include=
"packages.config"
/>
</ItemGroup>
<ItemGroup>
<COMReference
Include=
"WeChatRobotCOMLib"
>
<Guid>
{721ABB35-141A-4AA2-94F2-762E2833FA6C}
</Guid>
<VersionMajor>
1
</VersionMajor>
<VersionMinor>
0
</VersionMinor>
<Lcid>
0
</Lcid>
<WrapperTool>
tlbimp
</WrapperTool>
<Isolated>
False
</Isolated>
<EmbedInteropTypes>
False
</EmbedInteropTypes>
</COMReference>
</ItemGroup>
<Import
Project=
"$(MSBuildToolsPath)\Microsoft.CSharp.targets"
/>
</Project>
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录