反编译 VS “反反编译”???还会有“反反反编译”吗?

来源:互联网 发布:网络语言jg是什么意思 编辑:程序博客网 时间:2024/04/30 02:07

Java是半编译半解释型语言,也就是源码首先要编译成字节码,再由虚拟机来解释执行,这也是java之所以能“平台无关”的原因。Java要实现这一点,就使得从字节码再反编译回源码不是什么难事(字节码“可读性”强)。Java也似乎没在源代码加密上下太多工夫,这也似乎不是Java的重点。

    从得到的class文件,程序员可以轻松的利用反编译器得到源码,现在最流行的应该就是JAD以及以JAD为引擎的几个GUI程序。

 

Jad - the fast JAva Decompiler

http://www.kpdus.com/jad.html

引擎。本身是个命令行程序,很多GUI程序是用它做引擎。

 

Cavaj Java Decompiler

Cavaj Java Decompiler is a graphical freeware utility that reconstructs java source code from CLASS files. You can decompile java applets, jar and zip files producing accurate java source code. Browse the reconstructed source code with the Class View for instant access to methods and fields.

Cavaj Java Decompiler is Windows 95/98/ME/NT/2000/XP compatible. Cavaj Java Decompiler is a standalone Windows application, it doesn't require you to have Java installed.

 

Cavaj Java decompiler uses Jad as its Java decompiling engine. If you have questions about Jad please visit the Jad site.

http://www.sureshotsoftware.com/cavaj/index.html

 

JODE

 

JODE is a java package containing a decompiler and an optimizer for java.

The decompiler reads in class files and produces something similar to the original java file. Of course this can't be perfect: There is no way to produce the comments or the names of local variables (except when compiled with debuging) and there are often more ways to write the same thing.

The optimizer transforms class files in various ways with can be controlled by a script file. It supports the following operations:

  • Renaming class, method, field and local names to shorter, obfuscated, or unique names or according to a given translation table
  • Removing debugging information
  • Removing dead code (classes, fields, methods) and constant fields
  • Optimizing local variable allocation

   http://jode.sourceforge.net/index.html

 

DJ JAVA DECOMPILER

http://members.fortunecity.com/neshkov/dj.html

这个东西收费,但功能较多,还可以当Java-IDE来用。免费版的只能用n次(好像是10次),不爽。

 

 

    既然能反编译,当然就能反反编译。但是并不像想象的那样可以完全让反编译的人得不到源代码,这是不可能的。所谓反反编译只是把源码中有意义的符号变得无意义,所以反反编译工具实际叫“混淆器”Obfuscator)。如:有一属性private long accessNumber; 猜也猜出大概就是指访问次数的变量,但经过混淆后也许会变成private long t001;这样的话,其他人就很难猜出它是什么意思了。如果你得到的是全篇都是这样无意义符号的源码,你是不是就立刻崩溃了?可读性很差。当然,如果你本来写代码就毫不注重编码规则的话,也就根本不需要混淆器了(笑)。另外,这样做的话,还会起到节省档案空间的作用,毕竟起一个长的容易懂的代号和短的无意义的代号,对JVM来说都一样,易读性只是对人类而言的。混淆器除了会对属性、方法、变量等符号作无意义化处理,有的还会加入根本不会执行的代码来“混淆视听”。

    常用的有Proguard,开源软件,当然免费。http://proguard.sourceforge.net/

 

    那么还会不会有反混淆器的东西呢(反反反编译器??)。如果要反混淆,那么就要从杂乱无意义的符号中读出原程序员的本意,即机器来理解人的思维,这需要较高的AI,短期内恐难实现。所以,用反混淆器作出的class就基本可以说是不可能被反编译回原本的源码了。

    但不可能被反编译 不等于 不可能被读懂。

    再烂的代码只要人想读,还是有读懂的可能性的。我们只是用混淆器,给试图盗用者制造一堆麻烦而以。拿到一大堆烂代码比重写还要困难吧?

 

 
 
原创粉丝点击