轉自 http://www.lwolf.cn/blog/article/code/csharp-shell%20.htm
最近上網找了下給C#程序加殼的方法,找到了一些方法,自己試了一下,感覺還挺不錯的。以下是在網上找到的,在這里整理一下,以后要用到的時候也方便。
1.反射加殼
新建一個CMD項目,復制程序到項目文件中,並設置成為“嵌入式資源”。

Stream sr = Assembly.GetExecutingAssembly().GetManifestResourceStream("命名空間.程序.exe");
byte[] fileBytes = new byte[sr.Length];
sr.Read(fileBytes, 0, (int)sr.Length -1);
Assembly assembly = Assembly.Load(fileBytes);
MethodInfo mi = assembly.EntryPoint;
mi.Invoke(null, null);
byte[] fileBytes = new byte[sr.Length];
sr.Read(fileBytes, 0, (int)sr.Length -1);
Assembly assembly = Assembly.Load(fileBytes);
MethodInfo mi = assembly.EntryPoint;
mi.Invoke(null, null);
編譯運行這個后,再用Reflector查看就看不到源代碼。不過還是可以用反射脫殼破解的,這個我就不太懂了
2.使用Sixxpack
這是個給.net程序加殼並壓縮的工具,壓縮比最大可達80%,壓縮完之后就編譯不出源文件了。用Reflector查看的話都是actmp.dll的信息。不過最近看cnblogs里有人給出了破解這個的方法,有興趣的可以去找找看。
找關天沒找到官網地址,網上找的都是2.2漢化版,也不知道是不是最新的,下載地址:http://dl.onlinedown.net/soft/56183.htm
把這兩種方法結合起來使用還是挺有意思的,起碼增加了別人破解的難度~~~呵呵