43
43
import the .bytecode .club .bytecodeviewer .plugin .PluginManager ;
44
44
45
45
/**
46
- * A lightweight Java Reverse Engineering suite, developed by Konloch -
47
- * http://konloch.me
46
+ * A lightweight Java Reverse Engineering suite, developed by Konloch - http://konloch.me
48
47
*
49
- * Are you a Java Reverse Engineer? Or maybe you want to learn Java Reverse
50
- * Engineering? Join The Bytecode Club, we're noob friendly, and censorship
51
- * free.
48
+ * Are you a Java Reverse Engineer? Or maybe you want to learn Java Reverse Engineering?
49
+ * Join The Bytecode Club, we're noob friendly, and censorship free.
52
50
*
53
51
* http://the.bytecode.club
54
52
*
91
89
* refresh appears under panes that are non refreshable
92
90
* make ez-injection plugin console show all sys.out calls
93
91
* edit then save issues?
94
- * Search open doesnt append .class to tab name
92
+ * Search open doesn't append .class to tab name
95
93
*
96
94
* -----2.9.7-----:
97
95
* 07/02/2015 - Added ajustable font size.
98
96
* 07/05/2015 - Started working on the new Boot Screen.
99
97
* 07/06/2015 - Moved the font size to be under the view menu.
100
98
* 07/06/2015 - Fixed a bug with plugins not being able to grab the currently viewed class.
99
+ * 07/07/2015 - Started adding enjarify as an optional APK converter instead of Dex2Jar.
100
+ * 07/07/2015 - Finished the new Boot Screen
101
+ * 07/09/2015 - Fixed a process leak with krakatau decompiler.
102
+ * 07/09/2015 - Finished adding enjarify.
101
103
*
102
104
* @author Konloch
103
105
*
@@ -107,14 +109,15 @@ public class BytecodeViewer {
107
109
108
110
/*per version*/
109
111
public static String version = "2.9.7" ;
110
- public static String krakatauVersion = "2" ;
112
+ public static boolean previewCopy = true ;
111
113
/*the rest*/
112
114
public static MainViewerGUI viewer = null ;
113
115
public static ClassNodeLoader loader = new ClassNodeLoader (); //might be insecure due to assholes targeting BCV, however that's highly unlikely.
114
116
public static String python = "" ;
117
+ public static String python3 = "" ;
115
118
public static String rt = "" ;
116
119
public static String library = "" ;
117
- public static SecurityMan sm = new SecurityMan ();
120
+ public static SecurityMan sm = new SecurityMan (); //might be insecure due to assholes targeting BCV, however that's highly unlikely.
118
121
public static HashMap <String , ClassNode > loadedClasses = new HashMap <String , ClassNode >();
119
122
public static HashMap <String , byte []> loadedResources = new HashMap <String , byte []>();
120
123
private static int maxRecentFiles = 25 ;
@@ -126,13 +129,17 @@ public class BytecodeViewer {
126
129
public static String settingsName = getBCVDirectory () + fs + "settings.bcv" ;
127
130
public static String tempDirectory = getBCVDirectory () + fs + "bcv_temp" + fs ;
128
131
public static String libsDirectory = getBCVDirectory () + fs + "libs" + fs ;
129
- public static String krakatauWorkingDirectory = getBCVDirectory () + fs + "krakatau_" + krakatauVersion + fs + "Krakatau-master" ;
132
+ public static String krakatauWorkingDirectory = "" ;
133
+ public static String krakatauVersion = "" ;
134
+ public static String enjarifyWorkingDirectory = "" ;
135
+ public static String enjarifyVersion = "" ;
130
136
private static ArrayList <String > recentFiles = DiskReader .loadArrayList (filesName , false );
131
137
private static ArrayList <String > recentPlugins = DiskReader .loadArrayList (pluginsName , false );
132
138
public static boolean runningObfuscation = false ;
133
139
private static long start = System .currentTimeMillis ();
134
140
public static String lastDirectory = "" ;
135
141
public static ArrayList <Process > krakatau = new ArrayList <Process >();
142
+ public static ArrayList <Process > enjarify = new ArrayList <Process >();
136
143
public static Refactorer refactorer = new Refactorer ();
137
144
public static boolean pingback = false ;
138
145
public static boolean deleteForiegnLibraries = true ;
@@ -303,7 +310,7 @@ public void run() {
303
310
try {
304
311
new HTTPRequest (new URL ("https://bytecodeviewer.com/add.php" )).read ();
305
312
} catch (Exception e ) {
306
- //ignore
313
+ pingback = false ;
307
314
}
308
315
}
309
316
};
@@ -356,21 +363,25 @@ public static void main(String[] args) {
356
363
System .setSecurityManager (sm );
357
364
try {
358
365
UIManager .setLookAndFeel (UIManager .getSystemLookAndFeelClassName ());
366
+ if (previewCopy )
367
+ showMessage ("WARNING: This is a preview/dev copy, you WON'T be alerted when 2.9.7 is actually out if you use this." +nl +
368
+ "Make sure to watch the repo: https://github.com/Konloch/bytecode-viewer for 2.9.7's release" );
359
369
new BootScreen ().DO_FIRST_BOOT (args );
360
370
} catch (Exception e ) {
361
371
new the .bytecode .club .bytecodeviewer .api .ExceptionUI (e );
362
372
}
363
373
}
364
374
365
375
public static void BOOT (String [] args ) {
366
- checkKrakatau ();
367
376
System .out .println ("https://the.bytecode.club - Created by @Konloch - Bytecode Viewer " + version );
368
377
cleanup ();
369
378
Runtime .getRuntime ().addShutdownHook (new Thread () {
370
379
@ Override
371
380
public void run () {
372
381
for (Process krakatau : krakatau )
373
382
krakatau .destroy ();
383
+ for (Process enjarify : enjarify )
384
+ enjarify .destroy ();
374
385
Settings .saveGUI ();
375
386
cleanup ();
376
387
}
@@ -558,33 +569,6 @@ public static boolean compile(boolean message) {
558
569
559
570
return true ;
560
571
}
561
-
562
- /**
563
- * Drops the latest krakatau safely
564
- */
565
- public static void checkKrakatau () {
566
- File krakatauDirectory = new File (getBCVDirectory () + fs + "krakatau_" + krakatauVersion );
567
- if (!krakatauDirectory .exists ()) {
568
- try {
569
- File temp = new File (getBCVDirectory () + fs + "krakatau_" + krakatauVersion + ".zip" );
570
- while (temp .exists ())
571
- temp .delete ();
572
- InputStream is = BytecodeViewer .class .getClassLoader ().getResourceAsStream ("krakatau.zip" );
573
- FileOutputStream baos = new FileOutputStream (temp );
574
- int r = 0 ;
575
- byte [] buffer = new byte [8192 ];
576
- while ((r =is .read (buffer ))>=0 ) {
577
- baos .write (buffer , 0 , r );
578
- }
579
- baos .close ();
580
- ZipUtils .unzipFilesToPath (temp .getAbsolutePath (), krakatauDirectory .getAbsolutePath ());
581
- temp .delete ();
582
- } catch (Exception e ) {
583
- showMessage ("ERROR: There was an issue unzipping Krakatau decompiler, please contact @Konloch with your stacktrace." );
584
- new the .bytecode .club .bytecodeviewer .api .ExceptionUI (e );
585
- }
586
- }
587
- }
588
572
589
573
private static boolean update = true ;
590
574
@@ -653,7 +637,12 @@ public void run() {
653
637
654
638
String name = getRandomizedName ()+".jar" ;
655
639
File output = new File (tempDirectory + fs + name );
656
- Dex2Jar .dex2Jar (f , output );
640
+
641
+ if (BytecodeViewer .viewer .apkConversionGroup .isSelected (BytecodeViewer .viewer .apkConversionDex .getModel ()))
642
+ Dex2Jar .dex2Jar (f , output );
643
+ else if (BytecodeViewer .viewer .apkConversionGroup .isSelected (BytecodeViewer .viewer .apkConversionEnjarify .getModel ()))
644
+ Enjarify .apk2Jar (f , output );
645
+
657
646
BytecodeViewer .viewer .setIcon (false );
658
647
openFiles (new File []{output }, false );
659
648
} catch (final Exception e ) {
@@ -664,7 +653,12 @@ public void run() {
664
653
try {
665
654
String name = getRandomizedName ()+".jar" ;
666
655
File output = new File (tempDirectory + fs + name );
667
- Dex2Jar .dex2Jar (f , output );
656
+
657
+ if (BytecodeViewer .viewer .apkConversionGroup .isSelected (BytecodeViewer .viewer .apkConversionDex .getModel ()))
658
+ Dex2Jar .dex2Jar (f , output );
659
+ else if (BytecodeViewer .viewer .apkConversionGroup .isSelected (BytecodeViewer .viewer .apkConversionEnjarify .getModel ()))
660
+ Enjarify .apk2Jar (f , output );
661
+
668
662
BytecodeViewer .viewer .setIcon (false );
669
663
openFiles (new File []{output }, false );
670
664
} catch (final Exception e ) {
0 commit comments