JODE
Homepage

Jode

Using the Decompiler

After you have downloaded the necessary packages, put them into your CLASSPATH:
  • Under Windows you have to start a MSDOS session and type something like:
    set CLASSPATH=C:\download\jode-xxx.jar;C:\swing\swingall.jar
    
  • Under Unix you start a shell and type (for bourne shell):
    export CLASSPATH=/tmp/jode-xxx.jar:/usr/local/swing/swingall.jar
    or for csh:
    setenv CLASSPATH /tmp/jode-xxx.jar:/usr/local/swing/swingall.jar

Command Line Interface

The most powerful way to start JODE's decompiler is the command line interface. Some people don't like long command lines; they should go to the next section.
Start the class jode.decompiler.Main with the options. The following command will give a complete list of the available commands:
java jode.decompiler.Main --help

AWT Interface

The AWT Interface looks exactly like the applet. In fact the applet uses the AWT Interface. You start it after setting the CLASSPATH (see above), with
java jode.JodeWindow
In 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.

Swing Interface

For the swing interface you need java version 1.2 or the separately available swing package (see download page.
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 nice, if you just want to work how something works, and you don't have the source code. It is especially useful to trace bugs through library code. It is not meant to generate java files and so you won't find a save option there.

Using the Obfuscator

To use the obfuscator you have to create a script file, say
myproject.jos, with the following contents (You have to adapt it to match your project, of course). It should contain the following options:

First select what you want to strip. There are several possibilities, which can be separated by comma(,):

unreach
strip unreachable methods and classes.
source
remove the name of the java file (exceptions will get unreadable).
lnt
remove the line number table (exceptions will get unreadable).
lvt
remove the local variable table (debugging doesn't work).
inner
strip inner class info (reflection doesn't work correctly).
strip = "unreach","lvt","inner"

Select the packages and classes you want to obfuscate. You should only include libraries, that you don't ship separately.

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.

preserve = new WildCard { value = "org.myorg.application.main.*" },
           new WildCard { value = "org.myorg.applet.<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

StrongRenamer
Renames to the shortest possible name. You can give a charset that should be used. It uses the same name as much as possible.
UniqueRenamer
Renames to unique identifier of the form xxx123. Useful to reduce name conflicts, before you decompile an obfuscated package.
NameSwapper
This renamer just swaps the names. This is a funny obfuscation option that is not very strong, but very confusing.
KeywordRenamer
Renames identifiers to keyword. You can give your own list of keywords as parameters. Resulting code is not decompilable directly, but it is legal bytecode.
renamer = new KeywordRenamer

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.

SimpleAnalyzer
Straight forward analyzer. It is fast and will remove dead code on method basis.
ConstantAnalyzer
Strong analyzer that will determine, which fields and instructions have constant values. It will remove dead code on instruction basis and replace constant instruction with a load constant, or remove them completely.
This analyzer is especially useful to revert Zelix Klassmaster's flow obfuscation.

analyzer = new SimpleAnalyzer

Pre- and Post transformers transform the bytecode before resp. after the Analyzer runs. Using this defaults should be okay.

post = new LocalOptimizer, new RemovePopAnalyzer

http://www.informatik.uni-oldenburg.de/~delwi/jode/usage.html, last updated on 24-Okt-1999.