凡是在使用vs.net的開發人員都在努力尋找一個方法:防止或者是阻止其他人對自己的代碼進行反相,其目的是為了防止別人了解自己的業務流程或者是一些重要的算法的實現流程。
其中大家最為熟悉的就是vs.net上自帶的dotfuscator community edition工具了,這里就不再介紹這個工具了,有興趣的可以去http://thesource.ofallevil.com/china/msdn/library/langtool/vcsharp/misnetcodeobfuscation.mspx?mfr=true看看,最主要的就是采取了模糊處理和元素重命名的一種機制。但是這種方法遠遠沒有達到隱藏我們算法的目的。
1public void undo() {
2 if (this.numofmoves > 0) {
3 this.numofmoves =
4 this.numofmoves - 1;
5 if (this._usermoves.length >= 2)
6 this._usermoves =
7 this._usermoves.substring(0, this._usermoves.length - 2);
8 this.loadboard(
9 this.movehistory[this.numofmoves -
10 this.numofmoves / 50 * 50]);
11 this.drawboard(this.gr);
12 }
13}
14
15
16public void c() {
17 if (this.p > 0) {
18 this.p = this.p - 1;
19 if (this.r.length >= 2)
20 this.r = this.r.substring(0, this.r.length - 2);
21 this.a(this.q[this.p - this.p / 50 * 50]);
22 this.a(this.e);
23 }
24}
25
這兩種方法有什么區別?
還有一種工具xenocode 2005 enterprise,這款工具倒是不錯,可惜的是把所有的函數名和名稱空間名都加密了,在使用的時候還得這么使用
1class program
2 {
3 public static void main()
4 {
5 // 載入程序集,test.exe 為被混淆的程序集文件名。
6 assembly asm = assembly.loadfrom(@"test.exe");
7
8 // 獲取xenocode插入的解密類型(包含其namespace),對應上面字符串前面的類名,每次混淆結果可能都不同。
9 type type = asm.gettype("x293b01486f981425.x1110bdd110cdcea4");
10
11 // 字符串參數和解密參數
12 object[] parameters = {"/udbac/ue2b7/ue9bb/uf0af/uf7b8/ufeb3/u05a8/u0c61", 0x555ddb55};
13 type[] paramtypes = new type[parameters.length];
14 for (int i = 0; i < parameters.length; i++)
15 paramtypes[i] = parameters[i].gettype();
16
17 // 調用解密方法
18 bindingflags flags = bindingflags.public | bindingflags.static;
19 methodinfo method = type.getmethod("_d574bb1a8f3e9cbc", flags, null, paramtypes, null);
20 object result = method.invoke(null, parameters);
21
22 // 顯示解密結果
23 console.writeline(result);
24
25 console.writeline("press enter key to exit");
26 console.readline();
27 }
28 }
29
不知道這是在保護我們的程序集還是在折騰我們的開發人員?
還有其他的軟件也都在極力的尋找保護我們程序集的方式,vs.net都出來這么長時間了,還沒有一個理想的工具出來,我很想知道保護我們程序集的路在何方?
新聞熱點
疑難解答
圖片精選