git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@350 379699f6-c40d-0410-875b-85095c16579estable
parent
318e664b1e
commit
6eab48d761
@ -0,0 +1,96 @@ |
||||
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.0//EN"> |
||||
<html> |
||||
<head> |
||||
<title>Using the decompiler under Unix</title> |
||||
</head> |
||||
<body> |
||||
<a href="../index.html">Home</a> <a href="jode.html">Up</a> <br> |
||||
|
||||
<h1>Step by Step</h1> |
||||
|
||||
You need java version 1.1 or higher. In the following description I |
||||
assume you have the JDK 1.1, residing in <code>/usr/lib/java</code>. |
||||
For other installations you have to adopt the paths. Also I use the |
||||
bourne shell syntax. |
||||
|
||||
<ol> |
||||
<li> Set the classpath. It should include the jode_cls.zip as well as |
||||
the directory where the class files you want to decompile resides. |
||||
You can also specify a zip file instead of a directory. It is |
||||
also a good idea to include the zip resp. jar file containing the |
||||
basic <code>java.*</code> class files. |
||||
<pre> |
||||
export CLASSPATH=$HOME/jode_cls.zip:$HOME/download:/usr/lib/java/lib/classes.zip |
||||
</pre> |
||||
</li> |
||||
<li> Now you can start the graphical interface as following (Note the |
||||
case of the parameter) |
||||
<pre> |
||||
java jode.JodeWindow |
||||
</pre> |
||||
</li> |
||||
<li> The classpath field should already contain the classpath you set |
||||
above. The class field contains <code>jode.JodeWindow</code> and |
||||
you may push start immediately to decompile this class. |
||||
</li> |
||||
<li> If you want to decompile your own <code>.class</code> file, enter |
||||
the name of the file without <code>.class</code> extension and |
||||
push the start button. Change the class path if it doesn't point |
||||
to the right directory. |
||||
</li> |
||||
<li> After decompiling, you can save the file using the save button. |
||||
</li> |
||||
</ol> |
||||
|
||||
<h1>Packaged classes</h1> |
||||
|
||||
If the class file belongs to a package (like jode.JodeWindow) you |
||||
have to give the full qualified class name (the package names |
||||
separated by a dot followed by the class name). The class path should |
||||
point to the directory containing the package sub directories in this |
||||
case. <br><br> |
||||
|
||||
<h1>Command line utility</h1> |
||||
|
||||
There is also a command line utility which is much more powerful, but |
||||
also more difficult to use. You can start it (after setting the |
||||
classpath) with |
||||
<pre> |
||||
java jode.Decompiler |
||||
</pre> |
||||
and get a list of the supported parameters. To decompile the whole |
||||
decompiler you can use these magic lines: |
||||
<pre> |
||||
mkdir src |
||||
CLASSPATH=jode_cls.zip java jode.Decompiler --dest src \ |
||||
`unzip -v jode_cls.zip|grep .class|cut -c59-|sed s/.class//|sed s?/?.?g` |
||||
</pre> |
||||
|
||||
<h1>Obfuscator</h1> |
||||
|
||||
So you want to protect your classes from decompiling? Well that is |
||||
your choice. You may use my obfuscator. The class files are |
||||
decompileable again (except when using -strong option, but this is |
||||
reversable by obfuscating again), but at least the information about |
||||
the names of identifiers are completely lost. <br><br> |
||||
|
||||
The obfuscator is quite difficult to use (this is why I hided this |
||||
section here) and there is only a short description of the command |
||||
line parameters: |
||||
<pre> |
||||
CLASSPATH=jode_cls.zip java jode.Obfuscator |
||||
</pre> |
||||
|
||||
As a hint, to obfuscate the obfuscator use the following command line: |
||||
<pre> |
||||
CLASSPATH=jode_cls.zip java jode.Obfuscator \ |
||||
-cp jode_cls.zip:/usr/lib/java/lib/classes.zip -d obfuscated.zip \ |
||||
-weak -revtable translate.tbl -swaporder \ |
||||
-preserve jode.Obfuscator.main jode |
||||
</pre> |
||||
|
||||
The options <code>-unique</code> and <code>-table</code> can be |
||||
helpful to deobfuscate obfuscated code. |
||||
</body> |
||||
|
||||
|
@ -0,0 +1,48 @@ |
||||
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.0//EN"> |
||||
<html> |
||||
<head> |
||||
<title>Using the decompiler as applet (locally)</title> |
||||
</head> |
||||
<body> |
||||
<a href="../index.html">Home</a> <a href="jode.html">Up</a> <br> |
||||
|
||||
<h1>Step by Step</h1> |
||||
|
||||
If you want to use the applet version you need a recent Internet |
||||
Explorer or Netscape which supports java 1.1. |
||||
|
||||
<ol> |
||||
<li> Copy <a |
||||
href="http://www.informatik.uni-oldenburg.de/~delwi/jode/jode-applet.html" |
||||
>jode-applet.html</a> into a local directory. |
||||
</li> |
||||
<li> Copy <a |
||||
href="http://www.informatik.uni-oldenburg.de/~delwi/jode/jode_cls.zip" |
||||
>jode_cls.zip</a> to the <b>same</b> directory. |
||||
</li> |
||||
<li> Copy the <code>.class</code> file or <code>zip</code> file, you |
||||
want to decompile, to that directory. |
||||
</li> |
||||
<li> Load the html file into Netscape or Internet Explorer. |
||||
</li> |
||||
<li> Set the classpath simply to `<code>.</code>' (without quotes). |
||||
You may also specify a zip or jar file here. Note that applet and |
||||
class files must be in the same directory due to security policy. <br> |
||||
You can also change the default classpath in the html file. |
||||
</li> |
||||
<li> Enter the name of the class without <code>.class</code> |
||||
extension. |
||||
</li> |
||||
<li> Press start button in applet. </li> |
||||
<li> Saving doesn't work in Netscape, but maybe in Internet Explorer. </li> |
||||
</ol> |
||||
|
||||
<h1>Packaged classes</h1> |
||||
|
||||
If the class file belongs to a package (like jode.JodeWindow) you |
||||
have to give the full qualified class name (the package names |
||||
separated by a dot followed by the class name). The class path should |
||||
point to the directory containing the package sub directories in this |
||||
case. |
||||
|
||||
</body> |
@ -0,0 +1,62 @@ |
||||
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.0//EN"> |
||||
<html> |
||||
<head> |
||||
<title>Using the decompiler under Windows</title> |
||||
</head> |
||||
<body> |
||||
<a href="../index.html">Home</a> <a href="jode.html">Up</a> <br> |
||||
|
||||
<h1>Step by Step</h1> |
||||
|
||||
You need java version 1.1 or higher. I suggest using the Sun JDK or |
||||
JRE 1.1 or 1.2. In the following description I assume Sun JDK 1.2, |
||||
for other virtual machines the paths and the name of the java |
||||
interpreter (<code>c:\jdk1.2\java</code>) may differ. <br><br> |
||||
|
||||
<ol> |
||||
<li> Set the classpath. It should include the jode_cls.zip as well as |
||||
the directory where the class files you want to decompile resides. |
||||
You can also specify a zip file instead of a directory. It is |
||||
also a good Idea to include the zip resp. jar file containing the |
||||
basic <code>java.*</code> class files. |
||||
<pre> |
||||
set CLASSPATH=c:\temp\jode_cls.zip;c:\temp;c:\jdk1.2\jre\lib\rt.jar |
||||
</pre> |
||||
</li> |
||||
<li> Now you can start the graphical interface as following (Note the |
||||
case of the parameter) |
||||
<pre> |
||||
c:\jdk1.2\java jode.JodeWindow |
||||
</pre> |
||||
</li> |
||||
<li> The classpath field should already contain the classpath you set |
||||
above. The class field contains <code>jode.JodeWindow</code> and |
||||
you may push start immediately to decompile this class. |
||||
</li> |
||||
<li> If you want to decompile your own <code>.class</code> file, enter |
||||
the name of the file without <code>.class</code> extension and |
||||
push the start button. Change the class path if it doesn't point |
||||
to the right directory. |
||||
</li> |
||||
<li> After decompiling, you can save the file using the save button. |
||||
</li> |
||||
</ol> |
||||
|
||||
<h1>Packaged classes</h1> |
||||
|
||||
If the class file belongs to a package (like jode.JodeWindow) you |
||||
have to give the full qualified class name (the package names |
||||
separated by a dot followed by the class name). The class path should |
||||
point to the directory containing the package sub directories in this |
||||
case. <br><br> |
||||
|
||||
<h1>Command line utility</h1> |
||||
|
||||
There is also a command line utility which is much more powerful, but |
||||
also more difficult to use. You can start it (after setting the |
||||
classpath) with |
||||
<pre> |
||||
c:\jdk1.2\java jode.Decompiler |
||||
</pre> |
||||
and get a list of the supported parameters. |
||||
</body> |
@ -0,0 +1,112 @@ |
||||
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 3.0//EN"> |
||||
<html> |
||||
<head> |
||||
<title> JOchens' java-DEcompiler (JODE) </title> |
||||
<meta name="description" content="The home page of jode, my Java decompiler."> |
||||
<meta name="author" content="Jochen Hoenicke"> |
||||
<meta name="keywords" content="jode, java, decompile, decompiler, |
||||
java-decompiler, reverse engineering, free, GPL"> |
||||
<meta name="robots" content="index"> |
||||
<meta name="robots" content="nofollow"> |
||||
<meta name="date" content="1999-03-08"> |
||||
</head> |
||||
|
||||
<body> |
||||
<a href="../index.html">Home</a> |
||||
<h2>What is it?</h2> |
||||
|
||||
<P>This is a decompiler for java I have written in my spare time. It |
||||
takes class-files as input 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 <code>-g</code>) and there are often more ways to write |
||||
the same thing. But it does its job quite well.</P> |
||||
|
||||
<h2>Quick Test</h2> |
||||
I have now an applet interface to the decompiler. |
||||
<a href="jode-applet.html">Check it out</a>. |
||||
|
||||
<h2>How to get it</h2> |
||||
<P>You can donwload the files in zip form. |
||||
The <a href="jode_src.zip">sources</a> contain only the |
||||
<code>java</code> files, the <a href="jode_cls.zip">classes</a> |
||||
contain only the <code>class</code> files. </p> |
||||
|
||||
I also have a <a href="jode.tar.gz">tar.gz file</a> containing only |
||||
the <code>RCS</code> directories. This is the form I maintain the |
||||
project, but you probably need unix and a few tools to use them. |
||||
|
||||
<h2>How to use it</h2> |
||||
|
||||
<p>I have some simple step by step pages. There are three |
||||
possibilities: |
||||
<ul> |
||||
<li> <a href="jode-useapplet.html"> Using the applet version</a>. |
||||
This can make problem due to java's security policy, but is the |
||||
simplest way and works on most platforms. |
||||
</li> |
||||
<li> If you use Windows, you should look on <a |
||||
href="jode-win.html">this page</a>.</li> |
||||
<li> Unix users should look on <a href="jode-unix.html">this page</a>. |
||||
</ul> |
||||
|
||||
<h2>Known bugs</h2> |
||||
|
||||
<p>There may be situations, where the code doesn't understand complex |
||||
expressions. In this many ugly temporary variables are used, but the |
||||
code should still be compileable. This does especially happen when |
||||
you compile with `-O' flag and javac has inlined some methods. </p> |
||||
|
||||
<p>Sometimes this program may exit with an <code>Exception</code> or |
||||
produce incorrect code. Most time the code can't be compiled, so that |
||||
it can be easily spotted. If you have one of these problems (except |
||||
those that occur on some of the <code>jode.test</code> files, I would |
||||
be very interested in a bug report (including the <code>class</code> |
||||
file, if possible).</p> |
||||
|
||||
<p>Sometimes it generates some <code>GOTO</code> expression and |
||||
labels. This can't be compiled, but shouldn't happen any more with |
||||
javac or jikes.</p> |
||||
|
||||
<p>It doesn't handle inner and anonymous classes, yet. You can |
||||
decompile them separately, though (use `<code>+$</code>' switch under |
||||
jikes), but there is a bug in javac, so that a final variable is twice |
||||
initialized. If you encounter this problem just remove the doubled |
||||
line by hand. </p> |
||||
|
||||
<h2>Why did I wrote it?</h2> |
||||
|
||||
<p>Someday I found <code>guavad</code>, a disassembler for java byte |
||||
code (it does similar things like <code>javap -c</code>). I used |
||||
it on a class file, and found that it was possible to reconstruct the |
||||
original java code. First I did it by hand on some small routines, |
||||
but I soon realized that it was a rather stupid task, and that I could |
||||
write a <a href="../perl/dasm_to_java.perl"><code>perl</code> script</a> |
||||
that does the same. At the end of the next day I had a working |
||||
decompiler.</p> |
||||
|
||||
<p>Now while it was working, it was not easy to use. You had to |
||||
decompile the code first with a disassembler, cut the method, you |
||||
wanted to decompile and then run the perl script on it. So I decided |
||||
to get some information of the class files and do this all |
||||
automatically. I decided to write it in <code>java</code> now, |
||||
because it suited best.</p> |
||||
|
||||
<p>Just for the records: the java code is now nearly 50 times bigger |
||||
than the original perl script and is still growing.</p> |
||||
|
||||
<h2>License</h2> |
||||
|
||||
<p>This code is under GNU GPL. That basically means, that you can copy |
||||
or modify this code, as long as you put all your modification under |
||||
the GPL again. <A HREF="http://www.gnu.org/copyleft/gpl.html"> Look |
||||
here for the complete license</a>.</p> |
||||
|
||||
<hr> |
||||
|
||||
<p><A HREF="mailto:Jochen.Hoenicke@Informatik.Uni-Oldenburg.DE"> |
||||
http://www.informatik.uni-oldenburg.de/~delwi/jode/jode.html</A>, last |
||||
updated on <em>08-Mar-1999</em>.</p> |
||||
|
||||
</body> |
||||
</html> |
@ -0,0 +1,29 @@ |
||||
package jode.test; |
||||
|
||||
/* A test class submitted by dave@onekiwi.demon.co.uk */ |
||||
class Unreach |
||||
{ |
||||
static int j = 0; |
||||
final double[] d = {0.5, 0.4, 0.3}; // won't decompile
|
||||
|
||||
public static final void m(int i) throws Exception { |
||||
switch (i) { |
||||
case 1: |
||||
j += 2; |
||||
for (;;) { |
||||
j += 3; |
||||
switch (j) { |
||||
case 2: |
||||
break; |
||||
default: |
||||
j += 4; |
||||
return; |
||||
} |
||||
} |
||||
// An unreachable break is inserted here
|
||||
default: |
||||
j += 5; // decompiles as j = j + 1; -- not quite optimal
|
||||
} |
||||
} |
||||
} |
||||
|
Loading…
Reference in new issue