Skip to content

Commit 7f227ca

Browse files
committed
v2.9.18 fixes + JADX decompiler
1 parent fb4f2a1 commit 7f227ca

26 files changed

Lines changed: 594 additions & 78 deletions

libs/android-5.1.jar

178 KB
Binary file not shown.

libs/annotations-17.0.0.jar

18.6 KB
Binary file not shown.

libs/cloning-1.9.12.jar

30.7 KB
Binary file not shown.

libs/dx-1.16.jar

1010 KB
Binary file not shown.

libs/gson-2.8.5.jar

236 KB
Binary file not shown.

libs/jadx-core.jar

749 KB
Binary file not shown.

libs/objenesis-3.0.1.jar

59.5 KB
Binary file not shown.

libs/slf4j-api-1.7.26.jar

40.2 KB
Binary file not shown.

src/the/bytecode/club/bootloader/InitialBootScreen.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
import java.awt.GridBagLayout;
66
import java.awt.Insets;
77
import java.awt.Toolkit;
8+
import java.awt.event.WindowAdapter;
9+
import java.awt.event.WindowEvent;
10+
import java.awt.event.WindowStateListener;
811
import java.io.IOException;
912

1013
import javax.swing.JEditorPane;
@@ -13,6 +16,7 @@
1316
import javax.swing.JScrollPane;
1417
import javax.swing.text.html.HTMLEditorKit;
1518

19+
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
1620
import the.bytecode.club.bytecodeviewer.Resources;
1721

1822
/***************************************************************************
@@ -44,7 +48,14 @@ public class InitialBootScreen extends JFrame {
4448
private JProgressBar progressBar = new JProgressBar();
4549

4650
public InitialBootScreen() throws IOException {
47-
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
51+
setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
52+
addWindowListener(new WindowAdapter() {
53+
@Override
54+
public void windowClosing(WindowEvent e) {
55+
BytecodeViewer.canExit = true;
56+
System.exit(0);
57+
}
58+
});
4859
this.setIconImages(Resources.iconList);
4960

5061
int i = (int) Toolkit.getDefaultToolkit().getScreenSize().getHeight();

src/the/bytecode/club/bytecodeviewer/BytecodeViewer.java

Lines changed: 45 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,12 @@
1616
import java.nio.file.Files;
1717
import java.nio.file.Paths;
1818
import java.util.ArrayList;
19+
import java.util.Enumeration;
1920
import java.util.HashMap;
2021
import java.util.List;
22+
import java.util.jar.JarEntry;
23+
import java.util.jar.JarFile;
24+
import java.util.jar.JarOutputStream;
2125

2226
import javax.swing.JDialog;
2327
import javax.swing.JFileChooser;
@@ -26,12 +30,14 @@
2630
import javax.swing.UIManager;
2731
import javax.swing.filechooser.FileFilter;
2832

33+
import com.google.gson.reflect.TypeToken;
2934
import me.konloch.kontainer.io.DiskReader;
3035
import me.konloch.kontainer.io.DiskWriter;
3136
import me.konloch.kontainer.io.HTTPRequest;
3237

3338
import org.apache.commons.io.FileUtils;
3439
import org.objectweb.asm.tree.ClassNode;
40+
import com.google.gson.*;
3541

3642
import the.bytecode.club.bootloader.Boot;
3743
import the.bytecode.club.bootloader.ILoader;
@@ -68,6 +74,10 @@
6874
***************************************************************************/
6975

7076
/**
77+
* TODO:
78+
* open as folder doesn't actually work
79+
* smali compile
80+
*
7181
* A lightweight Java Reverse Engineering suite, developed by Konloch - http://konloch.me
7282
*
7383
* All you have to do is add a jar or class file into the workspace,
@@ -109,7 +119,7 @@
109119
public class BytecodeViewer
110120
{
111121
/*per version*/
112-
public static final String VERSION = "2.9.17";
122+
public static final String VERSION = "2.9.18";
113123
public static String krakatauVersion = "12";
114124
public static String enjarifyVersion = "4";
115125
public static final boolean BLOCK_TAB_MENU = true;
@@ -142,22 +152,46 @@ public class BytecodeViewer
142152
public static String nl = System.getProperty("line.separator");
143153
private static File BCVDir = new File(System.getProperty("user.home") + fs + ".Bytecode-Viewer");
144154
public static File RJ_JAR = new File(System.getProperty("java.home") + fs + "lib" + fs + "rt.jar");
145-
private static String filesName = getBCVDirectory() + fs + "recentfiles.bcv";
146-
private static String pluginsName = getBCVDirectory() + fs + "recentplugins.bcv";
155+
private static String filesName = getBCVDirectory() + fs + "recentfiles.json";
156+
private static String pluginsName = getBCVDirectory() + fs + "recentplugins.json";
147157
public static String settingsName = getBCVDirectory() + fs + "settings.bcv";
148158
public static String tempDirectory = getBCVDirectory() + fs + "bcv_temp" + fs;
149159
public static String libsDirectory = getBCVDirectory() + fs + "libs" + fs;
150160
public static String krakatauWorkingDirectory = getBCVDirectory() + fs + "krakatau_" + krakatauVersion;
151161
public static String enjarifyWorkingDirectory = getBCVDirectory() + fs + "enjarify_" + enjarifyVersion;
152-
private static ArrayList<String> recentFiles = DiskReader.loadArrayList(filesName, false);
153-
private static ArrayList<String> recentPlugins = DiskReader.loadArrayList(pluginsName, false);
154162
public static boolean runningObfuscation = false;
155163
private static long start = System.currentTimeMillis();
156-
public static String lastDirectory = "";
164+
public static String lastDirectory = ".";
157165
public static ArrayList<Process> createdProcesses = new ArrayList<Process>();
158166
public static Refactorer refactorer = new Refactorer();
159167
public static boolean pingback = false;
160168
public static boolean deleteForeignLibraries = true;
169+
public static boolean canExit = false;
170+
public static Gson gson;
171+
172+
private static ArrayList<String> recentPlugins;
173+
private static ArrayList<String> recentFiles;
174+
175+
static
176+
{
177+
try
178+
{
179+
gson = new GsonBuilder().setPrettyPrinting().create();
180+
if(new File(filesName).exists())
181+
recentFiles = gson.fromJson(DiskReader.loadAsString(filesName), new TypeToken<ArrayList<String>>() {}.getType());
182+
else
183+
recentFiles = DiskReader.loadArrayList(getBCVDirectory() + fs + "recentfiles.bcv", false);
184+
185+
if(new File(pluginsName).exists())
186+
recentPlugins = gson.fromJson(DiskReader.loadAsString(pluginsName), new TypeToken<ArrayList<String>>() {}.getType());
187+
else
188+
recentPlugins = DiskReader.loadArrayList(getBCVDirectory() + fs + "recentplugins.bcv", false);
189+
}
190+
catch (Exception e)
191+
{
192+
e.printStackTrace();
193+
}
194+
}
161195

162196
/**
163197
* The version checker thread
@@ -812,7 +846,7 @@ public void run() {
812846
} else {
813847
if (f.isDirectory()) {
814848
FileContainer container = new FileContainer(f);
815-
HashMap<String, byte[]> files = new HashMap<String, byte[]>();
849+
HashMap<String, byte[]> files = new HashMap<>();
816850
boolean finished = false;
817851
ArrayList<File> totalFiles = new ArrayList<File>();
818852
totalFiles.add(f);
@@ -844,10 +878,10 @@ public void run() {
844878
container.files = files;
845879
BytecodeViewer.files.add(container);
846880
} else {
847-
if (fn.endsWith(".jar") || fn.endsWith(".zip")) {
881+
if (fn.endsWith(".jar") || fn.endsWith(".zip") || fn.endsWith(".war")) {
848882
try {
849883
JarUtils.put(f);
850-
} catch (final java.util.zip.ZipException z) {
884+
} catch (java.io.IOException z) {
851885
try {
852886
JarUtils.put2(f);
853887
} catch (final Exception e) {
@@ -938,7 +972,7 @@ else if (BytecodeViewer.viewer.apkConversionGroup.isSelected(BytecodeViewer.view
938972
}
939973
return;
940974
} else {
941-
HashMap<String, byte[]> files = new HashMap<String, byte[]>();
975+
HashMap<String, byte[]> files = new HashMap<>();
942976
byte[] bytes = JarUtils.getBytes(new FileInputStream(f));
943977
files.put(f.getName(), bytes);
944978

@@ -1201,10 +1235,7 @@ private static void hideFile(File f) {
12011235
* @return string with newline per array object
12021236
*/
12031237
private static String quickConvert(ArrayList<String> a) {
1204-
String s = "";
1205-
for (String r : a)
1206-
s += r + nl;
1207-
return s;
1238+
return gson.toJson(a);
12081239
}
12091240

12101241
private static long last = System.currentTimeMillis();

0 commit comments

Comments
 (0)