1

I saw some Java applications that have code like this:

public class Test {
  public Test();
    Code:
       0: aload_0       
       1: invokespecial #1                  // Method     java/lang/Object."":()V
   4: return        

  public static void main(java.lang.String[]);
    Code:
       0: invokestatic  #2                  // Method     printOne:()V
       3: invokestatic  #2                  // Method     printOne:()V
       6: invokestatic  #3                  // Method     printTwo:()V
       9: return        

  public static void printOne();
    Code:
       0: getstatic     #4                  // Field     java/lang/System.out:Ljava/io/PrintStream;
       3: ldc           #5                  // String Hello World
       5: invokevirtual #6                  // Method     java/io/PrintStream.println:(Ljava/lang/String;)V
       8: return        

  public static void printTwo();
    Code:
       0: invokestatic  #2                  // Method     printOne:()V
       3: invokestatic  #2                  // Method     printOne:()V
       6: return        
}

And I wanted to know which kind of obfuscation is this, and what are the tools that can obfuscate a JAR file like that.

Nicholas K
  • 15,148
  • 7
  • 31
  • 57
gave
  • 181
  • 13

2 Answers2

4

Run javap -c on a compiled java class and you will get java byte code. That's not obfuscation, rather de-compilation. A pretty good resource from IBM is Java bytecode:Understanding bytecode makes you a better programmer

Mike
  • 1,924
  • 14
  • 16
1

that is what javac generated - the compiler for the java code. It's actually really easy to transpose that to code:

public class Test {
   // an implicit constructor:
   public Test(){

   }

   public static void testOne(){
      System.out.println("Hello World");
   }

   public static String testTwo(){
      testOne();
      testOne();
   }

}
Eugene
  • 117,005
  • 15
  • 201
  • 306