惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

K
Kaspersky official blog
Martin Fowler
Martin Fowler
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
V
Visual Studio Blog
博客园_首页
Engineering at Meta
Engineering at Meta
The Cloudflare Blog
MongoDB | Blog
MongoDB | Blog
Blog — PlanetScale
Blog — PlanetScale
T
The Blog of Author Tim Ferriss
雷峰网
雷峰网
D
Docker
博客园 - 司徒正美
S
SegmentFault 最新的问题
M
MIT News - Artificial intelligence
博客园 - 叶小钗
博客园 - 三生石上(FineUI控件)
U
Unit 42
J
Java Code Geeks
A
About on SuperTechFans
N
Netflix TechBlog - Medium
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
S
Security Affairs
I
Intezer
Cisco Talos Blog
Cisco Talos Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
B
Blog RSS Feed
P
Privacy & Cybersecurity Law Blog
T
Tenable Blog
T
Threatpost
H
Hacker News: Front Page
G
Google Developers Blog
博客园 - 【当耐特】
Hugging Face - Blog
Hugging Face - Blog
Apple Machine Learning Research
Apple Machine Learning Research
L
Lohrmann on Cybersecurity
大猫的无限游戏
大猫的无限游戏
Google DeepMind News
Google DeepMind News
A
Arctic Wolf
S
Secure Thoughts
GbyAI
GbyAI
NISL@THU
NISL@THU
S
Security @ Cisco Blogs
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Webroot Blog
Webroot Blog
C
CXSECURITY Database RSS Feed - CXSecurity.com
O
OpenAI News
Spread Privacy
Spread Privacy
Application and Cybersecurity Blog
Application and Cybersecurity Blog

博客园 - 紫雨轩 .Net

DNGuard Enterprise v3.56 released DNGuard Enterprise v3.30 released ComboBox 使用数据绑定时 Sorted 属性的bug DNGuard Enterprise v3.2 released DNGuard 企业版 v3.1 发布 DNGuard 专业版 v2.95 发布 DNGuard Enterprise v2.95 released 在 FlexGrid 控件中指定最右侧显示的列 Windows 2003 上使用 Windows Live Writer .Net程序集的不同加载方式,以及其在内存中格式 DNGuard Enterprise v2.92 released - 紫雨轩 .Net DNGuard 标准版 v2.90发布 DNGuard Enterprise v2.90 released DNGuard Enterprise v2.82 released 采用Native 引导方式的.Net加密保护 C#中使用晚绑定实现压缩Access数据库 直接在.Net程序(C#)中执行 native code C#复杂表达式的问题 DNGuard HVM Trial V2.82 发布
.Net 中枚举AppDomains
紫雨轩 .Net · 2008-05-22 · via 博客园 - 紫雨轩 .Net

.Net 框架提供的基础类库中并没有枚举AppDomains的功能,只提供了获取当前执行代码所在的AppDomain功能。

国外一家提供.Net保护工具的,同时提供了一个AppDomain dump工具。用来证明其保护有效。

名称就不提了,简单介绍一下其保护原理:整体加密保护,支持嵌入程序集生成单一可执行文件。

也就是用native loader 包裹一下,仍然还是整体加密保护模式。

但是和其它工具有一点区别。程序集整体解密后不是放在默认AppDomain中执行的,它另外创建了一个AppDomain。

其提供的dump 工具的原理:

注入到选择的进程,然后获取当前AppDomain,枚举AppDomain中的 程序集,直接整体dump程序集。

这个工具可以对付大多数整体加密保护。却对付不了他们自家的。被其用来证明自己的保护效果。

程序集一般在默认AppDomain中执行的,其注入后,获取当前appdomain得到的使默认AppDomain,所以无法枚举被加密保护的程序集。

如果加上AppDomain的枚举功能,这个工具就可以用来对付他们自己的保护产品了。

基础类库中并没有枚举AppDomains的功能,那是否可以在C#中实现呢?

答案使肯定的。基础类库没有,但是其宿主接口提供了这个功能。

ICorRuntimeHost 接口中的两个方法

EnumDomains 和 NextDomain 。

具体详情可以参考 msdn。

在C#中怎么使用呢?

首先添加引用

C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\mscoree.tlb

路径根据实际情况来定,版本号也不一定非得要2.0.50727 只要存在 mscoree.tlb就行。

这个接口在 1.0 中就提供了,更高的版本就不用说了。

IntPtr enumHandle = IntPtr.Zero;

CorRuntimeHostClass host = new mscoree.CorRuntimeHostClass();

host.EnumDomains(out enumHandle);

object domain = null;

while (true)

{

host.NextDomain(enumHandle, out domain);

if (domain == null) break;

AppDomain appDomain = (AppDomain)domain;

//********

}

host.CloseEnum(enumHandle);

Marshal.ReleaseComObject(host);