How to Decompile Java
本问题已经有最佳答案,请猛点这里访问。
我想要一个简单的反编译Java的方法。我想检查javac编译器对我的代码所做的转换和修改。哪些产品是好的,哪些产品是好的/坏的。
快速而肮脏,使用JDK附带的
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 | javap -c test Compiled from"test.java" public class test extends java.lang.Object{ public test(); Code: 0: aload_0 1: invokespecial #1; //Method java/lang/Object."<init>":()V 4: return public static void main(java.lang.String[]) throws java.lang.Exception; Code: 0: ldc #2; //String CR_ABC_DEF_GHI 2: astore_1 3: ldc #3; //String TYPE=Eligibility Only|CLIENT_ID=62|EMPLOYER_ID=0|LOCATION_ID=0|PLAN_ID=all|FREQUENCY=52|FILE=null|FILETYPE=C|PROCESSTOLAUNCH=10|PROCESSTOLAUNCHSTATUS=100|SCHEDULE_ID=29837d692f4c43e786f1097fab7c360c 5: astore_2 6: ldc #4; //String \| 8: astore_3 9: ldc #5; //String FILE_NAME_TEMPLATE 11: astore 4 13: ldc #6; //String FILE 15: astore 5 17: new #7; //class java/lang/StringBuilder 20: dup 21: invokespecial #8; //Method java/lang/StringBuilder."<init>":()V 24: aload_3 25: invokevirtual #9; //Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder; 28: aload 4 30: invokevirtual #9; //Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder; 33: ldc #10; //String = 35: invokevirtual #9; //Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder; 38: ldc #11; //String [^ 40: invokevirtual #9; //Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder; 43: aload_3 44: invokevirtual #9; //Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder; 47: ldc #12; //String ]* 49: invokevirtual #9; //Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder; 52: aload_3 53: invokevirtual #9; //Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder; 56: invokevirtual #13; //Method java/lang/StringBuilder.toString:()Ljava/lang/String; 59: astore 6 61: new #7; //class java/lang/StringBuilder 64: dup 65: invokespecial #8; //Method java/lang/StringBuilder."<init>":()V 68: aload_3 69: invokevirtual #9; //Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder; 72: aload 5 74: invokevirtual #9; //Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder; 77: ldc #10; //String = 79: invokevirtual #9; //Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder; 82: ldc #11; //String [^ 84: invokevirtual #9; //Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder; 87: aload_3 88: invokevirtual #9; //Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder; 91: ldc #12; //String ]* 93: invokevirtual #9; //Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder; 96: aload_3 97: invokevirtual #9; //Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder; 100: invokevirtual #13; //Method java/lang/StringBuilder.toString:()Ljava/lang/String; 103: astore 7 105: new #7; //class java/lang/StringBuilder 108: dup 109: invokespecial #8; //Method java/lang/StringBuilder."<init>":()V 112: aload_3 113: invokevirtual #9; //Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder; 116: aload 4 118: invokevirtual #9; //Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder; 121: ldc #10; //String = 123: invokevirtual #9; //Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder; 126: aload_1 127: invokevirtual #9; //Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder; 130: aload_3 131: invokevirtual #9; //Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder; 134: invokevirtual #13; //Method java/lang/StringBuilder.toString:()Ljava/lang/String; 137: astore 8 139: aload_2 140: aload 6 142: aload 8 144: invokevirtual #14; //Method java/lang/String.replaceAll:(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String; 147: aload 7 149: aload 8 151: invokevirtual #14; //Method java/lang/String.replaceAll:(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String; 154: astore 9 156: getstatic #15; //Field java/lang/System.out:Ljava/io/PrintStream; 159: new #7; //class java/lang/StringBuilder 162: dup 163: invokespecial #8; //Method java/lang/StringBuilder."<init>":()V 166: ldc #16; //String before = 168: invokevirtual #9; //Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder; 171: aload_2 172: invokevirtual #9; //Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder; 175: invokevirtual #13; //Method java/lang/StringBuilder.toString:()Ljava/lang/String; 178: invokevirtual #17; //Method java/io/PrintStream.println:(Ljava/lang/String;)V 181: getstatic #15; //Field java/lang/System.out:Ljava/io/PrintStream; 184: new #7; //class java/lang/StringBuilder 187: dup 188: invokespecial #8; //Method java/lang/StringBuilder."<init>":()V 191: ldc #18; //String pattern1 = 193: invokevirtual #9; //Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder; 196: aload 6 198: invokevirtual #9; //Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder; 201: invokevirtual #13; //Method java/lang/StringBuilder.toString:()Ljava/lang/String; 204: invokevirtual #17; //Method java/io/PrintStream.println:(Ljava/lang/String;)V 207: getstatic #15; //Field java/lang/System.out:Ljava/io/PrintStream; 210: new #7; //class java/lang/StringBuilder 213: dup 214: invokespecial #8; //Method java/lang/StringBuilder."<init>":()V 217: ldc #19; //String pattern2 = 219: invokevirtual #9; //Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder; 222: aload 7 224: invokevirtual #9; //Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder; 227: invokevirtual #13; //Method java/lang/StringBuilder.toString:()Ljava/lang/String; 230: invokevirtual #17; //Method java/io/PrintStream.println:(Ljava/lang/String;)V 233: getstatic #15; //Field java/lang/System.out:Ljava/io/PrintStream; 236: new #7; //class java/lang/StringBuilder 239: dup 240: invokespecial #8; //Method java/lang/StringBuilder."<init>":()V 243: ldc #20; //String replace = 245: invokevirtual #9; //Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder; 248: aload 8 250: invokevirtual #9; //Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder; 253: invokevirtual #13; //Method java/lang/StringBuilder.toString:()Ljava/lang/String; 256: invokevirtual #17; //Method java/io/PrintStream.println:(Ljava/lang/String;)V 259: getstatic #15; //Field java/lang/System.out:Ljava/io/PrintStream; 262: new #7; //class java/lang/StringBuilder 265: dup 266: invokespecial #8; //Method java/lang/StringBuilder."<init>":()V 269: ldc #21; //String after = 271: invokevirtual #9; //Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder; 274: aload 9 276: invokevirtual #9; //Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder; 279: invokevirtual #13; //Method java/lang/StringBuilder.toString:()Ljava/lang/String; 282: invokevirtual #17; //Method java/io/PrintStream.println:(Ljava/lang/String;)V 285: return } |
最好的可能是jad:
http://www.varaneckas.com/jad
如果您使用Eclipse,您可以使用jadclipse插件,以获得更符合人体工程学的界面:
http://jadclipse.sourceforge.net/wiki/index.php/main_页面
另一个Java反编译程序——ANDROCHECF Java反编译程序是可用的:HTTP://www. NeHKOV.COM/AC.DealPiel.HTML
我发现这个工具很好。
我已经用过JAD,并且可以测试它的有用性。
尽管任何未编译的代码都很可能没有任何注释,但要提醒大家,如果代码被混淆了,那么反编译就不会真正为您带来任何好处。它仍然看起来像是圣战。