Skip to content

Commit

Permalink
2.4.0 Release
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Konloch committed Dec 21, 2014
1 parent a42ba69 commit e88eff5
Show file tree
Hide file tree
Showing 16 changed files with 783 additions and 497 deletions.
Binary file not shown.
11 changes: 10 additions & 1 deletion README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -209,4 +209,13 @@ Changelog:
12/18/2014 - Fixed not escaping the Java strings by default for the Bytecode decompiler. - http://i.imgur.com/YrRnZA7.png
12/18/2014 - Used Eclipse's code formatting tool and formatted the code
12/19/2014 - Priav03 fixed the quick class searcher.

--- 2.4.0 ---:
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.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.3.0
2.4.0
401 changes: 111 additions & 290 deletions src/the/bytecode/club/bytecodeviewer/BytecodeViewer.java

Large diffs are not rendered by default.

32 changes: 23 additions & 9 deletions src/the/bytecode/club/bytecodeviewer/JarUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,31 @@ public static void put(final File jarFile,
final HashMap<String, ClassNode> clazzList) throws IOException {
jis = new JarInputStream(new FileInputStream(jarFile));
while ((entry = jis.getNextJarEntry()) != null) {
final String name = entry.getName();
if (!name.endsWith(".class")) {
BytecodeViewer.loadedResources.put(name, getBytes(jis));
try {
final String name = entry.getName();
if (!name.endsWith(".class")) {
BytecodeViewer.loadedResources.put(name, getBytes(jis));
jis.closeEntry();
continue;
}

byte[] bytes = getBytes(jis);
String cafebabe = String.format("%02X", bytes[0])
+ String.format("%02X", bytes[1])
+ String.format("%02X", bytes[2])
+ String.format("%02X", bytes[3]);
if(cafebabe.toLowerCase().equals("cafebabe")) {
final ClassNode cn = getNode(bytes);
clazzList.put(cn.name, cn);
} else {
System.out.println(jarFile+">"+name+": Header does not start with CAFEBABE, ignoring.");
}

} catch(Exception e) {
e.printStackTrace();
} finally {
jis.closeEntry();
continue;
}

final ClassNode cn = getNode(getBytes(jis));
clazzList.put(cn.name, cn);

jis.closeEntry();
}
jis.close();

Expand Down
267 changes: 267 additions & 0 deletions src/the/bytecode/club/bytecodeviewer/Settings.java

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ public static PrefixedStringBuilder decompile(PrefixedStringBuilder sb,
if (s.length() > 0)
sb.append(" ");

System.out.println(m.name);
if (m.name.equals("<init>")) {
sb.append(class_);
} else if (m.name.equals("<clinit>")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import java.util.zip.ZipOutputStream;

import me.konloch.kontainer.io.DiskReader;
import me.konloch.kontainer.io.DiskWriter;

import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.tree.ClassNode;
Expand All @@ -29,6 +30,12 @@

public class CFRDecompiler extends JavaDecompiler {

@Override
public void decompileToClass(String className, String classNameSaved) {
String contents = decompileClassNode(BytecodeViewer.getClassNode(className));
DiskWriter.replaceFile(classNameSaved, contents, false);
}

@Override
public String decompileClassNode(ClassNode cn) {
final ClassWriter cw = new ClassWriter(0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import java.io.IOException;

import me.konloch.kontainer.io.DiskReader;
import me.konloch.kontainer.io.DiskWriter;

import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.tree.ClassNode;
Expand All @@ -22,6 +23,12 @@

public class FernFlowerDecompiler extends JavaDecompiler {

@Override
public void decompileToClass(String className, String classNameSaved) {
String contents = decompileClassNode(BytecodeViewer.getClassNode(className));
DiskWriter.replaceFile(classNameSaved, contents, false);
}

@Override
public void decompileToZip(String zipName) {
File tempZip = new File(BytecodeViewer.tempDirectory + "temp.zip");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ public abstract class JavaDecompiler {

public abstract void decompileToZip(String zipName);

public abstract void decompileToClass(String className, String classNameSaved);

File tempF = null;

public int getClassNumber(String start, String ext) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
import java.util.zip.ZipException;
import java.util.zip.ZipOutputStream;

import me.konloch.kontainer.io.DiskWriter;

import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.tree.ClassNode;

Expand Down Expand Up @@ -46,6 +48,12 @@

public class ProcyonDecompiler extends JavaDecompiler {

@Override
public void decompileToClass(String className, String classNameSaved) {
String contents = decompileClassNode(BytecodeViewer.getClassNode(className));
DiskWriter.replaceFile(classNameSaved, contents, false);
}

public DecompilerSettings getDecompilerSettings() {
DecompilerSettings settings = new DecompilerSettings();
settings.setAlwaysGenerateExceptionVariableForCatchBlocks(BytecodeViewer.viewer.chckbxmntmNewCheckItem_6
Expand Down
2 changes: 1 addition & 1 deletion src/the/bytecode/club/bytecodeviewer/gui/AboutWindow.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public AboutWindow() {
txtrBytecodeViewerIs.setWrapStyleWord(true);
getContentPane().add(txtrBytecodeViewerIs, "name_140466526081695");
txtrBytecodeViewerIs
.setText("Bytecode Viewer 2.3.0 is an open source program\r\ndeveloped by Konloch ([email protected])\r\nDir: "
.setText("Bytecode Viewer "+BytecodeViewer.version+" is an open source program\r\ndeveloped by Konloch ([email protected])\r\nDir: "
+ BytecodeViewer.getBCVDirectory()
+ "\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");
txtrBytecodeViewerIs.setEnabled(false);
Expand Down
Loading

0 comments on commit e88eff5

Please sign in to comment.