* configure.in: Set version number to 1.1.1.

* jode/obfuscator/Identifier.java.in (writeTable): New boolean
parameter specifying if reversed or not.
* jode/obfuscator/ClassBundle.java.in: Renamed the table file
variables, added outTableFile.
(setOption): Support outtable, intable and outrevtable.
Support verbose.
(writeTable): Writes table unreversed.
(writeRevTable): New method, Writes table reversed.
* jode/obfuscator/Main.java.in: (rand): New variable.
* jode/obfuscator/PackageIdentifier.java.in: Use Main.rand instead
of definining its own random.
* jode/obfuscator/ClassIdentifier.java.in: likewise.


git-svn-id: https://svn.code.sf.net/p/jode/code/branches/branch_1_1@1344 379699f6-c40d-0410-875b-85095c16579e
branch_1_1
hoenicke 23 years ago
parent 03497ae1a2
commit ea5e834abe
  1. 17
      jode/ChangeLog
  2. 3
      jode/NEWS
  3. 10
      jode/configure.in
  4. 63
      jode/jode/obfuscator/ClassBundle.java.in
  5. 6
      jode/jode/obfuscator/ClassIdentifier.java.in
  6. 9
      jode/jode/obfuscator/Identifier.java.in
  7. 9
      jode/jode/obfuscator/Main.java.in
  8. 4
      jode/jode/obfuscator/PackageIdentifier.java.in

@ -1,5 +1,22 @@
2001-08-12 Jochen Hoenicke <jochen@gnu.org> 2001-08-12 Jochen Hoenicke <jochen@gnu.org>
* configure.in: Set version number to 1.1.1.
2001-08-12 Jochen Hoenicke <jochen@gnu.org>
* jode/obfuscator/Identifier.java.in (writeTable): New boolean
parameter specifying if reversed or not.
* jode/obfuscator/ClassBundle.java.in: Renamed the table file
variables, added outTableFile.
(setOption): Support outtable, intable and outrevtable.
Support verbose.
(writeTable): Writes table unreversed.
(writeRevTable): New method, Writes table reversed.
* jode/obfuscator/Main.java.in: (rand): New variable.
* jode/obfuscator/PackageIdentifier.java.in: Use Main.rand instead
of definining its own random.
* jode/obfuscator/ClassIdentifier.java.in: likewise.
* jode/flow/FlowBlock.java.in: * jode/flow/FlowBlock.java.in:
(checkConsistent): Allow lastModified in a finally block. (checkConsistent): Allow lastModified in a finally block.

@ -1,3 +1,6 @@
New in 1.1.1
* Only bug fixes
New in 1.1 New in 1.1
* break long lines * break long lines
* handle most of javac v8 constructs (jdk 1.3) * handle most of javac v8 constructs (jdk 1.3)

@ -1,7 +1,7 @@
dnl Process this file with autoconf to produce a configure script. dnl Process this file with autoconf to produce a configure script.
AC_INIT() AC_INIT()
AM_INIT_AUTOMAKE(jode, 1.1) AM_INIT_AUTOMAKE(jode, 1.1.1)
dnl Checks for programs. dnl Checks for programs.
AC_PROG_MAKE_SET AC_PROG_MAKE_SET
@ -241,10 +241,4 @@ bin/jode.bat
doc/Makefile doc/Makefile
test/Makefile, test/Makefile,
[chmod 755 javaDependencies.pl bin/jode], [chmod 755 javaDependencies.pl bin/jode],
[for i in \$CONFIG_FILES; do [$PERL $srcdir/jcpp $JCPPFLAGS \`ls \$CONFIG_FILES | grep '.java\$'\`])
changequote(, )dnl
if echo \$i | grep '.java\$'; then
changequote([, ])dnl
$PERL $srcdir/jcpp $JCPPFLAGS \$i
fi
done])

@ -52,8 +52,9 @@ public class ClassBundle implements OptionHandler {
String classPath; String classPath;
String destDir; String destDir;
String tableFile; String inTableFile;
String toTableFile; String outTableFile;
String outRevTableFile;
IdentifierMatcher loading; IdentifierMatcher loading;
IdentifierMatcher preserving; IdentifierMatcher preserving;
@ -103,21 +104,39 @@ public class ClassBundle implements OptionHandler {
return; return;
} }
if (option.equals("table")) { if (option.equals("verbose")) {
if (values.size() != 1)
throw new IllegalArgumentException
("Verbose takes one int parameter");
GlobalOptions.verboseLevel
= ((Integer) values.iterator().next()).intValue();
return;
}
if (option.equals("intable") || option.equals("table")) {
if (values.size() != 1) if (values.size() != 1)
throw new IllegalArgumentException throw new IllegalArgumentException
("Only one destination path allowed"); ("Only one destination path allowed");
tableFile = (String) values.iterator().next(); inTableFile = (String) values.iterator().next();
return; return;
} }
if (option.equals("revtable")) { if (option.equals("outtable")) {
if (values.size() != 1) if (values.size() != 1)
throw new IllegalArgumentException throw new IllegalArgumentException
("Only one destination path allowed"); ("Only one destination path allowed");
toTableFile = (String) values.iterator().next(); outTableFile = (String) values.iterator().next();
return; return;
} }
if (option.equals("outrevtable") || option.equals("revtable")) {
if (values.size() != 1)
throw new IllegalArgumentException
("Only one destination path allowed");
outRevTableFile = (String) values.iterator().next();
return;
}
if (option.equals("strip")) { if (option.equals("strip")) {
next_token: next_token:
for (Iterator iter = values.iterator(); iter.hasNext(); ) { for (Iterator iter = values.iterator(); iter.hasNext(); ) {
@ -359,25 +378,41 @@ public class ClassBundle implements OptionHandler {
public void readTable() { public void readTable() {
try { try {
TranslationTable table = new TranslationTable(); TranslationTable table = new TranslationTable();
InputStream input = new FileInputStream(tableFile); InputStream input = new FileInputStream(inTableFile);
table.load(input); table.load(input);
input.close(); input.close();
basePackage.readTable(table); basePackage.readTable(table);
} catch (java.io.IOException ex) { } catch (java.io.IOException ex) {
GlobalOptions.err.println("Can't read rename table " + tableFile); GlobalOptions.err.println("Can't read rename table "
+ inTableFile);
ex.printStackTrace(GlobalOptions.err); ex.printStackTrace(GlobalOptions.err);
} }
} }
public void writeTable() { public void writeTable() {
TranslationTable table = new TranslationTable(); TranslationTable table = new TranslationTable();
basePackage.writeTable(table); basePackage.writeTable(table, false);
try { try {
OutputStream out = new FileOutputStream(toTableFile); OutputStream out = new FileOutputStream(outTableFile);
table.store(out); table.store(out);
out.close(); out.close();
} catch (java.io.IOException ex) { } catch (java.io.IOException ex) {
GlobalOptions.err.println("Can't write rename table "+toTableFile); GlobalOptions.err.println("Can't write rename table "
+ outTableFile);
ex.printStackTrace(GlobalOptions.err);
}
}
public void writeRevTable() {
TranslationTable revtable = new TranslationTable();
basePackage.writeTable(revtable, true);
try {
OutputStream out = new FileOutputStream(outRevTableFile);
revtable.store(out);
out.close();
} catch (java.io.IOException ex) {
GlobalOptions.err.println("Can't write rename table "
+ outRevTableFile);
ex.printStackTrace(GlobalOptions.err); ex.printStackTrace(GlobalOptions.err);
} }
} }
@ -477,11 +512,13 @@ public class ClassBundle implements OptionHandler {
GlobalOptions.err.println("Renaming methods"); GlobalOptions.err.println("Renaming methods");
time = System.currentTimeMillis(); time = System.currentTimeMillis();
if (tableFile != null) if (inTableFile != null)
readTable(); readTable();
buildTable(renamer); buildTable(renamer);
if (toTableFile != null) if (outTableFile != null)
writeTable(); writeTable();
if (outRevTableFile != null)
writeRevTable();
System.err.println("Time used: "+(System.currentTimeMillis() - time)); System.err.println("Time used: "+(System.currentTimeMillis() - time));
GlobalOptions.err.println("Transforming the classes"); GlobalOptions.err.println("Transforming the classes");

@ -30,7 +30,6 @@ import @COLLECTIONS@.Iterator;
import @COLLECTIONS@.List; import @COLLECTIONS@.List;
import @COLLECTIONS@.LinkedList; import @COLLECTIONS@.LinkedList;
import @COLLECTIONS@.Map; import @COLLECTIONS@.Map;
import @COLLECTIONS@.Random;
import @COLLECTIONEXTRA@.UnsupportedOperationException; import @COLLECTIONEXTRA@.UnsupportedOperationException;
import java.lang.reflect.Modifier; import java.lang.reflect.Modifier;
@ -374,9 +373,8 @@ public class ClassIdentifier extends Identifier {
FieldInfo[] finfos = info.getFields(); FieldInfo[] finfos = info.getFields();
MethodInfo[] minfos = info.getMethods(); MethodInfo[] minfos = info.getMethods();
if (Main.swapOrder) { if (Main.swapOrder) {
Random rand = new Random(); Collections.shuffle(Arrays.asList(finfos), Main.rand);
Collections.shuffle(Arrays.asList(finfos), rand); Collections.shuffle(Arrays.asList(minfos), Main.rand);
Collections.shuffle(Arrays.asList(minfos), rand);
} }
fieldIdents = new ArrayList(finfos.length); fieldIdents = new ArrayList(finfos.length);
methodIdents = new ArrayList(minfos.length); methodIdents = new ArrayList(minfos.length);

@ -199,7 +199,7 @@ public abstract class Identifier {
((Identifier)i.next()).buildTable(renameRule); ((Identifier)i.next()).buildTable(renameRule);
} }
public void writeTable(Map table) { public void writeTable(Map table, boolean reversed) {
if (!isReachable() if (!isReachable()
&& (Main.stripping & Main.STRIP_UNREACH) != 0) && (Main.stripping & Main.STRIP_UNREACH) != 0)
return; return;
@ -212,11 +212,14 @@ public abstract class Identifier {
name = outer.getName() + "." + name; name = outer.getName() + "." + name;
outer = outer.getParent(); outer = outer.getParent();
} }
table.put(getFullAlias(), name); if (reversed)
table.put(getFullAlias(), name);
else
table.put(getFullName(), getAlias());
} }
for (Iterator i = getChilds(); i.hasNext(); ) for (Iterator i = getChilds(); i.hasNext(); )
((Identifier)i.next()).writeTable(table); ((Identifier)i.next()).writeTable(table, reversed);
} }
public void readTable(Map table) { public void readTable(Map table) {

@ -31,6 +31,7 @@ import java.io.FileReader;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.io.IOException; import java.io.IOException;
import @COLLECTIONS@.Collections; import @COLLECTIONS@.Collections;
import @COLLECTIONS@.Random;
public class Main { public class Main {
public static boolean swapOrder = false; public static boolean swapOrder = false;
@ -58,6 +59,14 @@ public class Main {
public static final int STRIP_LNT = 0x0008; public static final int STRIP_LNT = 0x0008;
public static final int STRIP_SOURCE = 0x0010; public static final int STRIP_SOURCE = 0x0010;
public static int stripping = 0; public static int stripping = 0;
/**
* A random pool used to destroy order of method identifiers and
* classes in packages. <br>
*
* A pseudo random is enough, no need to generate the seed
* securely. This makes obfuscating errors reproducable.
*/
public static Random rand = new Random(123456);
private static ClassBundle bundle; private static ClassBundle bundle;

@ -34,7 +34,6 @@ import @COLLECTIONS@.HashMap;
import @COLLECTIONS@.Iterator; import @COLLECTIONS@.Iterator;
import @COLLECTIONS@.List; import @COLLECTIONS@.List;
import @COLLECTIONS@.ArrayList; import @COLLECTIONS@.ArrayList;
import @COLLECTIONS@.Random;
import @COLLECTIONS@.Arrays; import @COLLECTIONS@.Arrays;
import @COLLECTIONS@.Collections; import @COLLECTIONS@.Collections;
@ -47,7 +46,6 @@ public class PackageIdentifier extends Identifier {
boolean loadOnDemand; boolean loadOnDemand;
Map loadedClasses; Map loadedClasses;
List swappedClasses; List swappedClasses;
Random rand = new Random();
public PackageIdentifier(ClassBundle bundle, public PackageIdentifier(ClassBundle bundle,
PackageIdentifier parent, PackageIdentifier parent,
@ -355,7 +353,7 @@ public class PackageIdentifier extends Identifier {
*/ */
if (swappedClasses == null) { if (swappedClasses == null) {
swappedClasses = Arrays.asList(loadedClasses.values().toArray()); swappedClasses = Arrays.asList(loadedClasses.values().toArray());
Collections.shuffle(swappedClasses, rand); Collections.shuffle(swappedClasses, Main.rand);
} }
return swappedClasses.iterator(); return swappedClasses.iterator();
} }

Loading…
Cancel
Save