16
16
import java .nio .file .Files ;
17
17
import java .nio .file .Paths ;
18
18
import java .util .ArrayList ;
19
- import java .util .Enumeration ;
20
19
import java .util .HashMap ;
21
20
import java .util .List ;
22
- import java .util .jar .JarEntry ;
23
- import java .util .jar .JarFile ;
24
- import java .util .jar .JarOutputStream ;
25
21
26
22
import javax .swing .JDialog ;
27
23
import javax .swing .JFileChooser ;
118
114
public class BytecodeViewer
119
115
{
120
116
/*per version*/
121
- public static final String VERSION = "2.9.19 " ;
117
+ public static final String VERSION = "2.9.20 " ;
122
118
public static String krakatauVersion = "12" ;
123
119
public static String enjarifyVersion = "4" ;
124
120
public static final boolean BLOCK_TAB_MENU = true ;
@@ -145,12 +141,13 @@ public class BytecodeViewer
145
141
public static boolean currentlyDumping = false ;
146
142
public static boolean needsReDump = true ;
147
143
public static boolean warnForEditing = false ;
148
- public static ArrayList <FileContainer > files = new ArrayList <FileContainer >(); //all of BCV's loaded files/classes/etc
144
+ public static List <FileContainer > files = new ArrayList <FileContainer >(); //all of BCV's loaded files/classes/etc
149
145
private static int maxRecentFiles = 25 ;
150
146
public static String fs = System .getProperty ("file.separator" );
151
147
public static String nl = System .getProperty ("line.separator" );
152
148
private static File BCVDir = new File (System .getProperty ("user.home" ) + fs + ".Bytecode-Viewer" );
153
- public static File RJ_JAR = new File (System .getProperty ("java.home" ) + fs + "lib" + fs + "rt.jar" );
149
+ public static File RT_JAR = new File (System .getProperty ("java.home" ) + fs + "lib" + fs + "rt.jar" );
150
+ public static File RT_JAR_DUMPED = new File (getBCVDirectory () + fs + "rt.jar" );
154
151
private static String filesName = getBCVDirectory () + fs + "recentfiles.json" ;
155
152
private static String pluginsName = getBCVDirectory () + fs + "recentplugins.json" ;
156
153
public static String settingsName = getBCVDirectory () + fs + "settings.bcv" ;
@@ -161,15 +158,15 @@ public class BytecodeViewer
161
158
public static boolean runningObfuscation = false ;
162
159
private static long start = System .currentTimeMillis ();
163
160
public static String lastDirectory = "." ;
164
- public static ArrayList <Process > createdProcesses = new ArrayList <Process >();
161
+ public static List <Process > createdProcesses = new ArrayList <Process >();
165
162
public static Refactorer refactorer = new Refactorer ();
166
163
public static boolean pingback = false ;
167
164
public static boolean deleteForeignLibraries = true ;
168
165
public static boolean canExit = false ;
169
166
public static Gson gson ;
170
167
171
- private static ArrayList <String > recentPlugins ;
172
- private static ArrayList <String > recentFiles ;
168
+ private static List <String > recentPlugins ;
169
+ private static List <String > recentFiles ;
173
170
174
171
static
175
172
{
@@ -669,6 +666,10 @@ public static FileContainer getFileContainer(String name) {
669
666
return null ;
670
667
}
671
668
669
+ public static List <FileContainer > getFiles () {
670
+ return files ;
671
+ }
672
+
672
673
public static ClassNode getClassNode (FileContainer container , String name ) {
673
674
for (ClassNode c : container .classes )
674
675
if (c .name .equals (name ))
@@ -943,7 +944,7 @@ public void run() {
943
944
944
945
if (viewer .decodeAPKResources .isSelected ()) {
945
946
File decodedResources = new File (tempDirectory + fs + MiscUtils .randomString (32 ) + ".apk" );
946
- APKTool .decodeResources (tempCopy , decodedResources );
947
+ APKTool .decodeResources (tempCopy , decodedResources , container );
947
948
container .files = JarUtils .loadResources (decodedResources );
948
949
}
949
950
@@ -1080,7 +1081,7 @@ public static void resetWorkSpace(boolean ask)
1080
1081
the .bytecode .club .bytecodeviewer .api .BytecodeViewer .getClassNodeLoader ().clear ();
1081
1082
}
1082
1083
1083
- private static ArrayList <String > killList = new ArrayList <String >();
1084
+ private static List <String > killList = new ArrayList <String >();
1084
1085
1085
1086
/**
1086
1087
* Add the recent file
@@ -1109,7 +1110,7 @@ public static void addRecentFile(File f) {
1109
1110
resetRecentFilesMenu ();
1110
1111
}
1111
1112
1112
- private static ArrayList <String > killList2 = new ArrayList <String >();
1113
+ private static List <String > killList2 = new ArrayList <String >();
1113
1114
1114
1115
/**
1115
1116
* Add to the recent plugin list
@@ -1187,7 +1188,7 @@ public static void cleanup() {
1187
1188
tempF .mkdir ();
1188
1189
}
1189
1190
1190
- public static ArrayList <String > createdRandomizedNames = new ArrayList <String >();
1191
+ public static List <String > createdRandomizedNames = new ArrayList <String >();
1191
1192
1192
1193
/**
1193
1194
* Ensures it will only return a uniquely generated names, contains a dupe checker to be sure
@@ -1254,7 +1255,7 @@ private static void hideFile(File f) {
1254
1255
* @param a array
1255
1256
* @return string with newline per array object
1256
1257
*/
1257
- private static String quickConvert (ArrayList <String > a ) {
1258
+ private static String quickConvert (List <String > a ) {
1258
1259
return gson .toJson (a );
1259
1260
}
1260
1261
@@ -1471,11 +1472,30 @@ else if (BytecodeViewer.viewer.panelGroup3.isSelected(BytecodeViewer.viewer.pane
1471
1472
return files ;
1472
1473
}
1473
1474
1474
- public static void rtCheck ()
1475
+ public synchronized static void rtCheck ()
1475
1476
{
1476
- if (rt .equals ("" ) && RJ_JAR . exists () )
1477
+ if (rt .equals ("" ))
1477
1478
{
1478
- rt = RJ_JAR .getAbsolutePath ();
1479
+ if (RT_JAR .exists ())
1480
+ {
1481
+ rt = RT_JAR .getAbsolutePath ();
1482
+ }
1483
+ else if (RT_JAR_DUMPED .exists ())
1484
+ {
1485
+ rt = RT_JAR_DUMPED .getAbsolutePath ();
1486
+ }
1487
+ else
1488
+ {
1489
+ try
1490
+ {
1491
+ JRTExtractor .extractRT (RT_JAR_DUMPED .getAbsolutePath ());
1492
+ rt = RT_JAR_DUMPED .getAbsolutePath ();
1493
+ }
1494
+ catch (Throwable t )
1495
+ {
1496
+ t .printStackTrace ();
1497
+ }
1498
+ }
1479
1499
}
1480
1500
}
1481
1501
0 commit comments