Powered by HTML coding Best viewed with |
Home Project page Applet Download FAQ Feedback Documentation License History Links Blue Sky |
After you have downloaded the jar archive put it into your CLASSPATH. The package swingall.jar is also needed if you are using JDK 1.1.
set CLASSPATH=C:\download\jode-1.1.jar;C:\swing\swingall.jar
export CLASSPATH=/tmp/jode-1.1.jar:/usr/local/swing/swingall.jaror for csh:
setenv CLASSPATH /tmp/jode-1.1.jar:/usr/local/swing/swingall.jar
jar -xvf jode-1.1".jar bin/jode.bat resp. bin/jodeEdit the file to adapt it to your paths and put it to a convenient location.
java jode.decompiler.Main --helpIf you want to decompile a jar package you can do it this way:
java jode.decompiler.Main --dest srcdir program.jarIf you have installed the batch file/script, you can use it like this:
jode --dest srcdir program.jar
java jode.decompiler.WindowIn the classpath line you can enter a number of jar files, zip files and directories separated by comma(,). Then enter the dot(.) separated name of the class you want to decompile. Press the
start
button and the decompiled class should
appear. You can save it via the save
button.
java -jar jode-1.1.jar classes.jaror if you have set the classpath (see above)
java jode.swingui.Main classes.jar resp. jode swi classes.jar
The swing interface will show the package hierarchie of all classes in the classpath on the left side. You can now select a class and the decompiled code will appear on the right side. Via the menu, you may change the classpath or switch between package hierarchie tree and class inheritence tree.
The swing interface is very useful to browse through class files if you don't have the source code. You can also use it to trace bugs in library code. It is not meant to generate java files and so you won't find a save option there.
If you want to integrate JODE into your own java program,
you can use the jode.decompiler.Decompiler
class. Note that the LGPL allows dynamic linking as long as you don't change
Jode itself. Please tell me if you use JODE in this way.
You should ship jode-1.1-embedded.jar
with your program. This jar file is
available in the
download area.
It works only under JDK 1.2 and above.
To use the obfuscator you should first create a script file, say myproject.jos. Then you can invoke the obfuscator with:
java jode.obfuscator.Main myproject.jos
The script file should contain the following options:
First select the classpath. You should include everything in the
classpath that you need to run your application. This also includes
the system class files (Sun puts them into classes.zip
or
rt.jar
))
classpath = "c:\\jdk1.2\\jre\\lib\\rt.jar","d:\\project\\java", "ftp://www.myorg.org/pub/classlib.jar"
Specify where you want the obfuscated classes to go. I recommend to write them directly into a zip file, but you can also give a directory.
dest = "obfuscated.zip"
You can make JODE write its translation table. This table can be used later to undo the name obfuscation, or you can look there to decrypt exceptions you may get.
revtable = "translat.tbl"
Select what you want to strip. There are several possibilities, which can be separated by comma(,):
strip = "unreach","lvt","inner"
Select the packages and classes you want to obfuscate. You should
only include libraries, that you don't ship separately. If you give a
package, all classes and subpackages are loaded. You can also use
*
as wild card, that matches everything (including dots).
load = new WildCard { value = "org.myorg.myproject" }, new WildCard { value = "org.myorg.mylib*" }, new WildCard { value = "org.otherorg.shortlib" }
Select the methods and classes you want to preserve. This is
the main method for applications and the default constructor
<init>.()V for applets, resource bundles and other classes
that you load manually at runtime.
You have to give the method
name and the type signature to identify your method. javap
-s will show you the type signatures for your classes, but you
may also use *, to select all methods with that name.
If you have serializable classes and want to preserve their serialized
form you can use the SerializePreserver.
preserve = new SerializePreserver, new WildCard { value = "org.myorg.ApplicationClass.main.*" }, new WildCard { value = "org.myorg.AppletClass.<init>.()V" }, new WildCard { value = "org.resources.Bundle*.<init>.()V" },
If you want to obfuscate (or just shorten) the identifier you can specify a renamer. There are currently following renamer available
renamer = new StrongRenamer
You can also create a renaming table with the same format as the table written by revtable. The entries in the table get precedence over renamer. Entries not in the table will get renamed by the renamer.
table = "translat.tbl"
Now you can select the analyzer. The purpose of the analyzer is to mark all reachable methods, find out which methods needs to get the same name (overloading), and which method names mustn't change (overload of library methods, e.g. nextElement for Enumerations). There are currently two analyzers.
analyzer = new ConstantAnalyzer
Pre- and Post transformers transform the bytecode before resp. after the Analyzer runs. Using this default should be okay. You may remove the LocalOptimizer, though, if you have problems.
In the future I may add some new post transformers, that do string encryption, flow obfuscation and similar things. If you want to write your own Transformers please contact me, since the next version will change the bytecode interface.
post = new LocalOptimizer, new RemovePopAnalyzer