Skip to content

Commit e88eff5

Browse files
committed
2.4.0 Release
12/19/2014 - Afffsdd made the Bytecode Viewer directory hidden. 12/19/2014 - Added save Java file as, for singular class file decompilation (this is threaded). 12/19/2014 - Removed unused Bytecode Decompiler debug code. 12/20/2014 - Made a new outdated pane - http://i.imgur.com/xMxkwJ9.png 12/20/2014 - Added an expand/collapse the packages in the file navigator. 12/20/2014 - Moved all of the settings to the.bytecode.club.bytecodeviewer.Settings 12/20/2014 - If the class file does not start with CAFEBABE it won't be processed. 12/20/2014 - Properly handled file not found error. 12/21/2014 - Fixed the Refresh Class causing a dupe.
1 parent a42ba69 commit e88eff5

16 files changed

+783
-497
lines changed
Binary file not shown.

README.txt

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,4 +209,13 @@ Changelog:
209209
12/18/2014 - Fixed not escaping the Java strings by default for the Bytecode decompiler. - http://i.imgur.com/YrRnZA7.png
210210
12/18/2014 - Used Eclipse's code formatting tool and formatted the code
211211
12/19/2014 - Priav03 fixed the quick class searcher.
212-
212+
--- 2.4.0 ---:
213+
12/19/2014 - Afffsdd made the Bytecode Viewer directory hidden.
214+
12/19/2014 - Added save Java file as, for singular class file decompilation (this is threaded).
215+
12/19/2014 - Removed unused Bytecode Decompiler debug code.
216+
12/20/2014 - Made a new outdated pane - http://i.imgur.com/xMxkwJ9.png
217+
12/20/2014 - Added an expand/collapse the packages in the file navigator.
218+
12/20/2014 - Moved all of the settings to the.bytecode.club.bytecodeviewer.Settings
219+
12/20/2014 - If the class file does not start with CAFEBABE it won't be processed.
220+
12/20/2014 - Properly handled file not found error.
221+
12/21/2014 - Fixed the Refresh Class causing a dupe.

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
2.3.0
1+
2.4.0

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

Lines changed: 111 additions & 290 deletions
Large diffs are not rendered by default.

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

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,17 +35,31 @@ public static void put(final File jarFile,
3535
final HashMap<String, ClassNode> clazzList) throws IOException {
3636
jis = new JarInputStream(new FileInputStream(jarFile));
3737
while ((entry = jis.getNextJarEntry()) != null) {
38-
final String name = entry.getName();
39-
if (!name.endsWith(".class")) {
40-
BytecodeViewer.loadedResources.put(name, getBytes(jis));
38+
try {
39+
final String name = entry.getName();
40+
if (!name.endsWith(".class")) {
41+
BytecodeViewer.loadedResources.put(name, getBytes(jis));
42+
jis.closeEntry();
43+
continue;
44+
}
45+
46+
byte[] bytes = getBytes(jis);
47+
String cafebabe = String.format("%02X", bytes[0])
48+
+ String.format("%02X", bytes[1])
49+
+ String.format("%02X", bytes[2])
50+
+ String.format("%02X", bytes[3]);
51+
if(cafebabe.toLowerCase().equals("cafebabe")) {
52+
final ClassNode cn = getNode(bytes);
53+
clazzList.put(cn.name, cn);
54+
} else {
55+
System.out.println(jarFile+">"+name+": Header does not start with CAFEBABE, ignoring.");
56+
}
57+
58+
} catch(Exception e) {
59+
e.printStackTrace();
60+
} finally {
4161
jis.closeEntry();
42-
continue;
4362
}
44-
45-
final ClassNode cn = getNode(getBytes(jis));
46-
clazzList.put(cn.name, cn);
47-
48-
jis.closeEntry();
4963
}
5064
jis.close();
5165

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

Lines changed: 267 additions & 0 deletions
Large diffs are not rendered by default.

src/the/bytecode/club/bytecodeviewer/decompilers/bytecode/MethodNodeDecompiler.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ public static PrefixedStringBuilder decompile(PrefixedStringBuilder sb,
4242
if (s.length() > 0)
4343
sb.append(" ");
4444

45-
System.out.println(m.name);
4645
if (m.name.equals("<init>")) {
4746
sb.append(class_);
4847
} else if (m.name.equals("<clinit>")) {

src/the/bytecode/club/bytecodeviewer/decompilers/java/CFRDecompiler.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import java.util.zip.ZipOutputStream;
1515

1616
import me.konloch.kontainer.io.DiskReader;
17+
import me.konloch.kontainer.io.DiskWriter;
1718

1819
import org.objectweb.asm.ClassWriter;
1920
import org.objectweb.asm.tree.ClassNode;
@@ -29,6 +30,12 @@
2930

3031
public class CFRDecompiler extends JavaDecompiler {
3132

33+
@Override
34+
public void decompileToClass(String className, String classNameSaved) {
35+
String contents = decompileClassNode(BytecodeViewer.getClassNode(className));
36+
DiskWriter.replaceFile(classNameSaved, contents, false);
37+
}
38+
3239
@Override
3340
public String decompileClassNode(ClassNode cn) {
3441
final ClassWriter cw = new ClassWriter(0);

src/the/bytecode/club/bytecodeviewer/decompilers/java/FernFlowerDecompiler.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
import java.io.IOException;
66

77
import me.konloch.kontainer.io.DiskReader;
8+
import me.konloch.kontainer.io.DiskWriter;
89

910
import org.objectweb.asm.ClassWriter;
1011
import org.objectweb.asm.tree.ClassNode;
@@ -22,6 +23,12 @@
2223

2324
public class FernFlowerDecompiler extends JavaDecompiler {
2425

26+
@Override
27+
public void decompileToClass(String className, String classNameSaved) {
28+
String contents = decompileClassNode(BytecodeViewer.getClassNode(className));
29+
DiskWriter.replaceFile(classNameSaved, contents, false);
30+
}
31+
2532
@Override
2633
public void decompileToZip(String zipName) {
2734
File tempZip = new File(BytecodeViewer.tempDirectory + "temp.zip");

src/the/bytecode/club/bytecodeviewer/decompilers/java/JavaDecompiler.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ public abstract class JavaDecompiler {
1616

1717
public abstract void decompileToZip(String zipName);
1818

19+
public abstract void decompileToClass(String className, String classNameSaved);
20+
1921
File tempF = null;
2022

2123
public int getClassNumber(String start, String ext) {

src/the/bytecode/club/bytecodeviewer/decompilers/java/ProcyonDecompiler.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
import java.util.zip.ZipException;
1919
import java.util.zip.ZipOutputStream;
2020

21+
import me.konloch.kontainer.io.DiskWriter;
22+
2123
import org.objectweb.asm.ClassWriter;
2224
import org.objectweb.asm.tree.ClassNode;
2325

@@ -46,6 +48,12 @@
4648

4749
public class ProcyonDecompiler extends JavaDecompiler {
4850

51+
@Override
52+
public void decompileToClass(String className, String classNameSaved) {
53+
String contents = decompileClassNode(BytecodeViewer.getClassNode(className));
54+
DiskWriter.replaceFile(classNameSaved, contents, false);
55+
}
56+
4957
public DecompilerSettings getDecompilerSettings() {
5058
DecompilerSettings settings = new DecompilerSettings();
5159
settings.setAlwaysGenerateExceptionVariableForCatchBlocks(BytecodeViewer.viewer.chckbxmntmNewCheckItem_6

src/the/bytecode/club/bytecodeviewer/gui/AboutWindow.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public AboutWindow() {
2424
txtrBytecodeViewerIs.setWrapStyleWord(true);
2525
getContentPane().add(txtrBytecodeViewerIs, "name_140466526081695");
2626
txtrBytecodeViewerIs
27-
.setText("Bytecode Viewer 2.3.0 is an open source program\r\ndeveloped by Konloch (konloch@gmail.com)\r\nDir: "
27+
.setText("Bytecode Viewer "+BytecodeViewer.version+" is an open source program\r\ndeveloped by Konloch (konloch@gmail.com)\r\nDir: "
2828
+ BytecodeViewer.getBCVDirectory()
2929
+ "\r\n\r\nIt uses code from the following:\r\n J-RET by WaterWolf\r\n JHexPane by Sam Koivu\r\n RSyntaxTextArea by Bobbylight\r\n Commons IO by Apache\r\n ASM by OW2\r\n CFIDE by Bibl\r\n FernFlower by Stiver\r\n Procyon by Mstrobel\r\n CFR by Lee Benfield\r\n\r\nIf you're interested in Java Reverse\r\nEngineering, join The Bytecode Club\r\nhttps://the.bytecode.club");
3030
txtrBytecodeViewerIs.setEnabled(false);

0 commit comments

Comments
 (0)