就他吧-9ta8为您提供:身份证查询、15位转16位身份证,手机号码归属地查询,IP地址查询服务,城市天气预报查询,列车时刻表简易快速查询等等查询服务,就他吧欢迎您的光临!!

对《防止对 Visual Basic .NET 或 C# 代码进行反相工程》的思考


         凡是在使用
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(0this._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(0this.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都出来这么长时间了,还没有一个理想的工具出来,我很想知道保护我们程序集的路在何方?


posted on 2006-09-12 17:14  振河  阅读(3047)  评论(10编辑  收藏  举报

  就他吧-9ta8伴您开心每一天