Fix Code Style No1

This commit is contained in:
Nico Mexis 2021-04-12 22:19:12 +02:00
parent ff61c80dfc
commit 7840b5c266
No known key found for this signature in database
GPG key ID: 27D6E17CE092AB78
134 changed files with 7101 additions and 7548 deletions

View file

@ -1,8 +1,21 @@
package com.jhe.hexed;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Rectangle;
import java.awt.event.AdjustmentEvent;
import java.awt.event.AdjustmentListener;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import java.awt.event.KeyEvent;
import java.awt.event.MouseWheelEvent;
import java.awt.event.MouseWheelListener;
import javax.swing.JPanel;
import javax.swing.JScrollBar;
/**
* Created by IntelliJ IDEA. User: laullon Date: 08-abr-2003 Time: 13:21:09
@ -15,8 +28,8 @@ public class JHexEditor extends JPanel implements FocusListener,
protected static Font font = new Font("Monospaced", 0, 12);
protected int border = 2;
public boolean DEBUG = false;
private JPanel panel;
private JScrollBar sb;
private final JPanel panel;
private final JScrollBar sb;
private int inicio = 0;
private int lineas = 10;

View file

@ -1,8 +1,14 @@
package com.jhe.hexed;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import javax.swing.JComponent;
/**
* Created by IntelliJ IDEA. User: laullon Date: 09-abr-2003 Time: 12:47:18
@ -10,7 +16,7 @@ import java.awt.event.*;
public class JHexEditorASCII extends JComponent implements MouseListener,
KeyListener {
private static final long serialVersionUID = 5505374841731053461L;
private JHexEditor he;
private final JHexEditor he;
public JHexEditorASCII(JHexEditor he) {
this.he = he;

View file

@ -1,8 +1,14 @@
package com.jhe.hexed;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import javax.swing.JComponent;
/**
* Created by IntelliJ IDEA. User: laullon Date: 09-abr-2003 Time: 12:47:32
@ -10,8 +16,8 @@ import java.awt.event.*;
public class JHexEditorHEX extends JComponent implements MouseListener,
KeyListener {
private static final long serialVersionUID = 1481995655372014571L;
private JHexEditor he;
private int cursor = 0;
private final JHexEditor he;
private final int cursor = 0;
public JHexEditorHEX(JHexEditor he) {
this.he = he;

View file

@ -2,7 +2,6 @@ package jd.cli;
import java.io.File;
import java.io.PrintStream;
import jd.cli.loader.DirectoryLoader;
import jd.cli.preferences.CommonPreferences;
import jd.cli.printer.text.PlainTextPrinter;

View file

@ -1,7 +1,6 @@
package jd.cli.loader;
import java.io.File;
import jd.core.loader.Loader;
public abstract class BaseLoader implements Loader {

View file

@ -5,7 +5,6 @@ import java.io.DataInputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import jd.core.loader.LoaderException;

View file

@ -5,12 +5,11 @@ import java.io.File;
import java.io.IOException;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import jd.core.loader.LoaderException;
public class JarLoader extends BaseLoader {
private ZipFile zipFile;
private final ZipFile zipFile;
public JarLoader(File file) throws LoaderException {
super(file);

View file

@ -3,7 +3,6 @@ package jd.cli.loader;
import java.io.File;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import jd.core.loader.LoaderException;
public class LoaderManager {

View file

@ -1,7 +1,6 @@
package jd.cli.printer.html;
import java.io.PrintStream;
import jd.cli.util.VersionUtil;
import jd.core.CoreConstants;
import jd.core.printer.Printer;
@ -32,9 +31,9 @@ import jd.core.printer.Printer;
public class HtmlPrinter implements Printer {
private final static boolean DEBUG = true;
private PrintStream printStream;
private StringBuffer sbLineNumber;
private StringBuffer sbCode;
private final PrintStream printStream;
private final StringBuffer sbLineNumber;
private final StringBuffer sbCode;
private int maxLineNumber;
private int majorVersion;
private int minorVersion;
@ -57,20 +56,20 @@ public class HtmlPrinter implements Printer {
public void print(char c) {
switch (c) {
case '<':
this.sbCode.append("&lt;");
break;
case '>':
this.sbCode.append("&gt;");
break;
default:
this.sbCode.append(String.valueOf(c));
break;
case '<':
this.sbCode.append("&lt;");
break;
case '>':
this.sbCode.append("&gt;");
break;
default:
this.sbCode.append(c);
break;
}
}
public void print(int i) {
this.sbCode.append(String.valueOf(i));
this.sbCode.append(i);
}
public void print(String s) {
@ -228,9 +227,11 @@ public class HtmlPrinter implements Printer {
"body,html{font-family:Lucida Grande,Lucida Sans Unicode,Arial,sans-serif;font-size:90%}" +
"#demo .out{background-color:#FFFFFF}" +
"#demo .out .content{padding:0px;font-size:12px;font-family:courier new,courier;white-space:pre;border-radius:0 0 10px 10px}" +
"#demo .out .content{padding:0px;font-size:12px;font-family:courier new,courier;"
+ "white-space:pre;border-radius:0 0 10px 10px}" +
"#demo .out .content .e{color:#FF0000;margin:10px}" +
"#linenumber{float:left;margin:0;padding:1px 8px 5px 1px;border-style:solid;border-color:#888888;border-width:0 1px 0 0;color:#888888}" +
"#linenumber{float:left;margin:0;padding:1px 8px 5px 1px;border-style:solid;"
+ "border-color:#888888;border-width:0 1px 0 0;color:#888888}" +
"#linenumber s{text-decoration:none}" +
"#linenumber span{color:#FF0000;font-style:normal}" +
"#javacode{padding:0 0 5px 0;margin:1px 5px 1px 5px;color:black}" +
@ -248,13 +249,19 @@ public class HtmlPrinter implements Printer {
"#javacode em{color:#0000c0;font-style:italic;line-height:1}" +
"#javacode samp{font-style:italic;line-height:1}" +
"#javacode .debuglayoutblock{color:#000000;background-color:#ccffff;border:1px solid #99eeee}" +
"#javacode .debugseparatorlayoutblock{color:#000000;background-color:#ccffcc;border:1px solid #99ee99}" +
"#javacode .debugstatementblocklayoutblock{color:#000000;background-color:#ffcccc;border:1px solid #ee9999}" +
"#javacode .debugenumblocklayoutblock{color:#000000;background-color:#ffffcc;border:1px solid #eeee99}" +
"#javacode .debugcommentdeprecatedlayoutblock{color:#000000;background-color:#fefefe;border:1px solid #e9e9e9}" +
"#javacode .debugseparatorlayoutblock{color:#000000;background-color:#ccffcc;border:1px solid"
+ " #99ee99}" +
"#javacode .debugstatementblocklayoutblock{color:#000000;background-color:#ffcccc;border:1px "
+ "solid #ee9999}" +
"#javacode .debugenumblocklayoutblock{color:#000000;background-color:#ffffcc;border:1px solid"
+ " #eeee99}" +
"#javacode .debugcommentdeprecatedlayoutblock{color:#000000;background-color:#fefefe;"
+ "border:1px solid #e9e9e9}" +
"#javacode .debugmarker{color:#000000;background-color:#ffd2ff;border:1px solid #cfb2cf}" +
"#javacode .debugcaseblocklayoutblock{color:#000000;background-color:#ffde66;border:1px solid #ff9a11}" +
"#metadata{padding:5px;color:#444444;background-color:#EEEEEE;border-radius:0 0 10px 10px;font-size:11px}" +
"#javacode .debugcaseblocklayoutblock{color:#000000;background-color:#ffde66;border:1px solid"
+ " #ff9a11}" +
"#metadata{padding:5px;color:#444444;background-color:#EEEEEE;border-radius:0 0 10px 10px;"
+ "font-size:11px}" +
"</style>" +
"</head><body>" +
@ -274,7 +281,8 @@ public class HtmlPrinter implements Printer {
this.printStream.print("</div>");
this.printStream.print("<div id='metadata'>");
this.printStream.print("Java Class Version: " + VersionUtil.getJDKVersion(this.majorVersion, this.minorVersion) + "<br>");
this.printStream.print("Java Class Version: " + VersionUtil.getJDKVersion(this.majorVersion,
this.minorVersion) + "<br>");
this.printStream.print("JD-CL Version: " + "0.1.0" + "<br>");
this.printStream.print("JD-Core Version: " + CoreConstants.JD_CORE_VERSION);
this.printStream.print("</div>");

View file

@ -1,7 +1,6 @@
package jd.cli.printer.text;
import java.io.PrintStream;
import jd.cli.preferences.CommonPreferences;
import jd.core.model.instruction.bytecode.instruction.Instruction;
import jd.core.printer.Printer;
@ -340,7 +339,7 @@ public class PlainTextPrinter implements Printer {
char c = s.charAt(i);
if (c == '\t') {
this.printStream.append(c);
this.printStream.append('\t');
} else if (c < 32) {
// Write octal format
this.printStream.append("\\0");

View file

@ -6,7 +6,6 @@ import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import jd.core.CoreConstants;
import jd.core.model.classfile.constant.Constant;
import jd.core.model.classfile.constant.ConstantClass;
@ -104,34 +103,34 @@ public class ClassFileUtil {
byte tag = dis.readByte();
switch (tag) {
case ConstantConstant.CONSTANT_Class:
constants[i] = new ConstantClass(tag, dis.readUnsignedShort());
break;
case ConstantConstant.CONSTANT_Utf8:
constants[i] = new ConstantUtf8(tag, dis.readUTF());
break;
case ConstantConstant.CONSTANT_Long:
case ConstantConstant.CONSTANT_Double:
dis.read();
dis.read();
dis.read();
dis.read();
i++;
case ConstantConstant.CONSTANT_Fieldref:
case ConstantConstant.CONSTANT_Methodref:
case ConstantConstant.CONSTANT_InterfaceMethodref:
case ConstantConstant.CONSTANT_NameAndType:
case ConstantConstant.CONSTANT_Integer:
case ConstantConstant.CONSTANT_Float:
dis.read();
dis.read();
case ConstantConstant.CONSTANT_String:
dis.read();
dis.read();
break;
default:
//throw new ClassFormatException("Invalid constant pool entry");
return constants;
case ConstantConstant.CONSTANT_Class:
constants[i] = new ConstantClass(tag, dis.readUnsignedShort());
break;
case ConstantConstant.CONSTANT_Utf8:
constants[i] = new ConstantUtf8(tag, dis.readUTF());
break;
case ConstantConstant.CONSTANT_Long:
case ConstantConstant.CONSTANT_Double:
dis.read();
dis.read();
dis.read();
dis.read();
i++;
case ConstantConstant.CONSTANT_Fieldref:
case ConstantConstant.CONSTANT_Methodref:
case ConstantConstant.CONSTANT_InterfaceMethodref:
case ConstantConstant.CONSTANT_NameAndType:
case ConstantConstant.CONSTANT_Integer:
case ConstantConstant.CONSTANT_Float:
dis.read();
dis.read();
case ConstantConstant.CONSTANT_String:
dis.read();
dis.read();
break;
default:
//throw new ClassFormatException("Invalid constant pool entry");
return constants;
}
}

View file

@ -1,13 +1,12 @@
package me.konloch.kontainer.io;
import the.bytecode.club.bytecodeviewer.util.EncodeUtils;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.File;
import java.io.FileReader;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Random;
import the.bytecode.club.bytecodeviewer.util.EncodeUtils;
/**
* Used to load from the disk, optional caching

View file

@ -19,7 +19,7 @@ public class DiskWriter {
* @param fileName The file name
* @param difference Normally an integer
* @return The filename with the difference inserted and the file extension
* preserved
* preserved
*/
public static String insertFileName(String fileName, String difference) {
String[] babe = fileName.split("\\.");

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -2,7 +2,6 @@ package the.bytecode.club.bootloader;
import java.util.HashMap;
import java.util.Map;
import the.bytecode.club.bootloader.resource.ExternalResource;
/***************************************************************************

View file

@ -6,18 +6,15 @@ import java.io.InputStream;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
import javax.swing.JOptionPane;
import javax.swing.SwingUtilities;
import org.apache.commons.io.FileUtils;
import me.konloch.kontainer.io.HTTPRequest;
import org.apache.commons.io.FileUtils;
import the.bytecode.club.bootloader.resource.EmptyExternalResource;
import the.bytecode.club.bootloader.resource.ExternalResource;
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
import the.bytecode.club.bytecodeviewer.util.ZipUtils;
import the.bytecode.club.bytecodeviewer.api.ExceptionUI;
import the.bytecode.club.bytecodeviewer.util.ZipUtils;
/***************************************************************************
* Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite *
@ -50,9 +47,9 @@ public class Boot {
public static boolean downloading = false;
private static InitialBootScreen screen;
private static List<String> libsList = new ArrayList<String>();
private static List<String> libsFileList = new ArrayList<String>();
private static List<String> urlList = new ArrayList<String>();
private static final List<String> libsList = new ArrayList<String>();
private static final List<String> libsFileList = new ArrayList<String>();
private static final List<String> urlList = new ArrayList<String>();
static {
try {
@ -62,8 +59,7 @@ public class Boot {
}
}
public static void boot(String[] args, boolean CLI) throws Exception
{
public static void boot(String[] args, boolean CLI) throws Exception {
bootstrap();
ILoader<?> loader = findLoader();
@ -108,7 +104,9 @@ public class Boot {
}
if (urlList.isEmpty()) {
JOptionPane.showMessageDialog(null, "Bytecode Viewer ran into an issue, for some reason github is not returning what we're expecting. Please try rebooting, if this issue persists please contact @Konloch.", "Error", JOptionPane.ERROR_MESSAGE);
JOptionPane.showMessageDialog(null, "Bytecode Viewer ran into an issue, for some reason github is not "
+ "returning what we're expecting. Please try rebooting, if this issue persists please contact "
+ "@Konloch.", "Error", JOptionPane.ERROR_MESSAGE);
return;
}
@ -125,7 +123,8 @@ public class Boot {
int completedCheck = 0;
for (String s : urlList) {
String fileName = s.substring("https://github.com/Konloch/bytecode-viewer/blob/master/libs/".length(), s.length());
String fileName = s.substring("https://github.com/Konloch/bytecode-viewer/blob/master/libs/".length()
);
File file = new File(libsDirectory, fileName);
boolean passed = false;
@ -177,9 +176,8 @@ public class Boot {
System.out.println("Verifying " + fileName + "...");
File f = new File(BytecodeViewer.tempDirectory, "temp");
if(!f.exists())
{
f.getParentFile().mkdirs();
if (!f.exists()) {
f.getParentFile().mkdirs();
}
ZipUtils.zipFile(file, f);
f.delete();
@ -223,7 +221,9 @@ public class Boot {
File f = new File(s);
boolean delete = true;
for (String urlS : urlList) {
String fileName = urlS.substring("https://github.com/Konloch/bytecode-viewer/blob/master/libs/".length(), urlS.length());
String fileName =
urlS.substring("https://github.com/Konloch/bytecode-viewer/blob/master/libs/".length()
);
if (fileName.equals(f.getName()))
delete = false;
}
@ -250,7 +250,8 @@ public class Boot {
} catch (Exception e) {
e.printStackTrace();
f.delete();
JOptionPane.showMessageDialog(null, "Error, Library " + f.getName() + " is corrupt, please restart to redownload it.",
JOptionPane.showMessageDialog(null, "Error, Library " + f.getName() + " is corrupt, please "
+ "restart to redownload it.",
"Error", JOptionPane.ERROR_MESSAGE);
}
}
@ -318,31 +319,30 @@ public class Boot {
}
}
public static void dropKrakatau()
{
File temp = new File(BytecodeViewer.getBCVDirectory() + BytecodeViewer.fs + "krakatau_" + BytecodeViewer.krakatauVersion + ".zip");
public static void dropKrakatau() {
File temp =
new File(BytecodeViewer.getBCVDirectory() + BytecodeViewer.fs + "krakatau_" + BytecodeViewer.krakatauVersion + ".zip");
File krakatauDirectory = new File(BytecodeViewer.krakatauWorkingDirectory);
BytecodeViewer.krakatauWorkingDirectory = BytecodeViewer.krakatauWorkingDirectory + BytecodeViewer.fs + "Krakatau-master";
if (!krakatauDirectory.exists() || temp.exists())
{
if(temp.exists())
BytecodeViewer.krakatauWorkingDirectory = BytecodeViewer.krakatauWorkingDirectory + BytecodeViewer.fs +
"Krakatau-master";
if (!krakatauDirectory.exists() || temp.exists()) {
if (temp.exists())
temp.delete();
setState("Bytecode Viewer Boot Screen - Extracting Krakatau");
System.out.println("Extracting Krakatau");
try
{
try {
while (temp.exists())
temp.delete();
InputStream is = BytecodeViewer.class.getClassLoader().getResourceAsStream("Krakatau-" + BytecodeViewer.krakatauVersion + ".zip");
InputStream is =
BytecodeViewer.class.getClassLoader().getResourceAsStream("Krakatau-" + BytecodeViewer.krakatauVersion + ".zip");
FileOutputStream baos = new FileOutputStream(temp);
int r = 0;
byte[] buffer = new byte[8192];
while ((r = is.read(buffer)) >= 0)
{
while ((r = is.read(buffer)) >= 0) {
baos.write(buffer, 0, r);
}
@ -350,39 +350,36 @@ public class Boot {
ZipUtils.unzipFilesToPath(temp.getAbsolutePath(), krakatauDirectory.getAbsolutePath());
temp.delete();
System.out.println("Succesfully extracted Krakatau");
}
catch (Exception e)
{
} catch (Exception e) {
setState("Bytecode Viewer Boot Screen - ERROR, please contact @Konloch with your stacktrace.");
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e);
}
}
}
public static void dropEnjarify()
{
File temp = new File(BytecodeViewer.getBCVDirectory() + BytecodeViewer.fs + "enjarify" + BytecodeViewer.enjarifyVersion + ".zip");
public static void dropEnjarify() {
File temp =
new File(BytecodeViewer.getBCVDirectory() + BytecodeViewer.fs + "enjarify" + BytecodeViewer.enjarifyVersion + ".zip");
File enjarifyDirectory = new File(BytecodeViewer.enjarifyWorkingDirectory);
BytecodeViewer.enjarifyWorkingDirectory = BytecodeViewer.enjarifyWorkingDirectory + BytecodeViewer.fs + "enjarify-master";
if (!enjarifyDirectory.exists() || temp.exists())
{
if(temp.exists())
BytecodeViewer.enjarifyWorkingDirectory = BytecodeViewer.enjarifyWorkingDirectory + BytecodeViewer.fs +
"enjarify-master";
if (!enjarifyDirectory.exists() || temp.exists()) {
if (temp.exists())
temp.delete();
setState("Bytecode Viewer Boot Screen - Extracting Enjarify");
System.out.println("Extracting Enjarify");
try
{
try {
while (temp.exists())
temp.delete();
InputStream is = BytecodeViewer.class.getClassLoader().getResourceAsStream("enjarify-" + BytecodeViewer.enjarifyVersion + ".zip");
InputStream is =
BytecodeViewer.class.getClassLoader().getResourceAsStream("enjarify-" + BytecodeViewer.enjarifyVersion + ".zip");
FileOutputStream baos = new FileOutputStream(temp);
int r = 0;
byte[] buffer = new byte[8192];
while ((r = is.read(buffer)) >= 0)
{
while ((r = is.read(buffer)) >= 0) {
baos.write(buffer, 0, r);
}
@ -390,9 +387,7 @@ public class Boot {
ZipUtils.unzipFilesToPath(temp.getAbsolutePath(), enjarifyDirectory.getAbsolutePath());
temp.delete();
System.out.println("Succesfully extracted Enjarify");
}
catch (Exception e)
{
} catch (Exception e) {
setState("Bytecode Viewer Boot Screen - ERROR, please contact @Konloch with your stacktrace.");
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e);
}
@ -401,7 +396,8 @@ public class Boot {
public static void downloadZipsOnly() throws Exception {
for (String s : urlList) {
String fileName = s.substring("https://github.com/Konloch/bytecode-viewer/blob/master/libs/".length(), s.length());
String fileName = s.substring("https://github.com/Konloch/bytecode-viewer/blob/master/libs/".length()
);
File file = new File(libsDir(), fileName);
boolean passed = false;
@ -495,15 +491,18 @@ public class Boot {
}
}
BytecodeViewer.enjarifyWorkingDirectory = BytecodeViewer.getBCVDirectory() + BytecodeViewer.fs + "enjarify_" + BytecodeViewer.enjarifyVersion + BytecodeViewer.fs + "enjarify-master";
File enjarifyDirectory = new File(BytecodeViewer.getBCVDirectory() + BytecodeViewer.fs + "enjarify_" + BytecodeViewer.enjarifyVersion);
BytecodeViewer.enjarifyWorkingDirectory =
BytecodeViewer.getBCVDirectory() + BytecodeViewer.fs + "enjarify_" + BytecodeViewer.enjarifyVersion + BytecodeViewer.fs + "enjarify-master";
File enjarifyDirectory =
new File(BytecodeViewer.getBCVDirectory() + BytecodeViewer.fs + "enjarify_" + BytecodeViewer.enjarifyVersion);
if (!enjarifyDirectory.exists()) {
try {
setState("Bytecode Viewer Boot Screen - Updating to " + enjarifyDirectory.getName() + "...");
ZipUtils.unzipFilesToPath(enjarifyZip.getAbsolutePath(), enjarifyDirectory.getAbsolutePath());
System.out.println("Updated to enjarify v" + BytecodeViewer.enjarifyVersion);
} catch (Exception e) {
BytecodeViewer.showMessage("ERROR: There was an issue unzipping enjarify (possibly corrupt). Restart BCV." + BytecodeViewer.nl +
BytecodeViewer.showMessage("ERROR: There was an issue unzipping enjarify (possibly corrupt). Restart "
+ "BCV." + BytecodeViewer.nl +
"If the error persists contact @Konloch.");
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e);
enjarifyZip.delete();
@ -540,14 +539,16 @@ public class Boot {
BytecodeViewer.krakatauWorkingDirectory = BytecodeViewer.getBCVDirectory() + BytecodeViewer.fs + "krakatau_" +
BytecodeViewer.krakatauVersion + BytecodeViewer.fs + "Krakatau-master";
File krakatauDirectory = new File(BytecodeViewer.getBCVDirectory() + BytecodeViewer.fs + "krakatau_" + BytecodeViewer.krakatauVersion);
File krakatauDirectory =
new File(BytecodeViewer.getBCVDirectory() + BytecodeViewer.fs + "krakatau_" + BytecodeViewer.krakatauVersion);
if (!krakatauDirectory.exists()) {
try {
setState("Bytecode Viewer Boot Screen - Updating to " + krakatauDirectory.getName() + "...");
ZipUtils.unzipFilesToPath(krakatauZip.getAbsolutePath(), krakatauDirectory.getAbsolutePath());
System.out.println("Updated to krakatau v" + BytecodeViewer.krakatauVersion);
} catch (Exception e) {
BytecodeViewer.showMessage("ERROR: There was an issue unzipping Krakatau decompiler (possibly corrupt). Restart BCV." + BytecodeViewer.nl +
BytecodeViewer.showMessage("ERROR: There was an issue unzipping Krakatau decompiler (possibly "
+ "corrupt). Restart BCV." + BytecodeViewer.nl +
"If the error persists contact @Konloch.");
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e);
krakatauZip.delete();

View file

@ -4,7 +4,6 @@ import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.net.URL;
import java.net.URLClassLoader;
import the.bytecode.club.bootloader.resource.ExternalResource;
/***************************************************************************
@ -31,13 +30,14 @@ import the.bytecode.club.bootloader.resource.ExternalResource;
*/
public class ClassPathLoader implements ILoader<Object> {
void extendClassPath(URL url) throws NoSuchMethodException, SecurityException, IllegalAccessException, IllegalArgumentException,
void extendClassPath(URL url) throws NoSuchMethodException, SecurityException, IllegalAccessException,
IllegalArgumentException,
InvocationTargetException {
URLClassLoader urlClassLoader = (URLClassLoader) ClassLoader.getSystemClassLoader();
Class<URLClassLoader> urlClass = URLClassLoader.class;
Method method = urlClass.getDeclaredMethod("addURL", new Class[]{URL.class});
Method method = urlClass.getDeclaredMethod("addURL", URL.class);
method.setAccessible(true);
method.invoke(urlClassLoader, new Object[]{url});
method.invoke(urlClassLoader, url);
}
/*

View file

@ -24,11 +24,11 @@ import the.bytecode.club.bootloader.resource.ExternalResource;
* @author Bibl (don't ban me pls)
* @created 19 Jul 2015 02:29:43
*/
public abstract interface ILoader<T> {
public interface ILoader<T> {
public abstract void bind(ExternalResource<T> resource);
void bind(ExternalResource<T> resource);
abstract Class<?> findClass(String name) throws ClassNotFoundException, NoClassDefFoundError;
Class<?> findClass(String name) throws ClassNotFoundException, NoClassDefFoundError;
public abstract Class<?> loadClass(String name) throws ClassNotFoundException, NoClassDefFoundError;
Class<?> loadClass(String name) throws ClassNotFoundException, NoClassDefFoundError;
}

View file

@ -7,15 +7,12 @@ import java.awt.Insets;
import java.awt.Toolkit;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.awt.event.WindowStateListener;
import java.io.IOException;
import javax.swing.JEditorPane;
import javax.swing.JFrame;
import javax.swing.JProgressBar;
import javax.swing.JScrollPane;
import javax.swing.text.html.HTMLEditorKit;
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
import the.bytecode.club.bytecodeviewer.Resources;
@ -45,7 +42,7 @@ import the.bytecode.club.bytecodeviewer.Resources;
public class InitialBootScreen extends JFrame {
private static final long serialVersionUID = -1098467609722393444L;
private JProgressBar progressBar = new JProgressBar();
private final JProgressBar progressBar = new JProgressBar();
public InitialBootScreen() throws IOException {
setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
@ -71,9 +68,11 @@ public class InitialBootScreen extends JFrame {
setTitle("Bytecode Viewer Boot Screen - Starting Up");
GridBagLayout gridBagLayout = new GridBagLayout();
gridBagLayout.columnWidths = new int[]{0, 0};
gridBagLayout.rowHeights = new int[]{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
gridBagLayout.rowHeights = new int[]{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0};
gridBagLayout.columnWeights = new double[]{1.0, Double.MIN_VALUE};
gridBagLayout.rowWeights = new double[]{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE};
gridBagLayout.rowWeights = new double[]{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0,
0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, Double.MIN_VALUE};
getContentPane().setLayout(gridBagLayout);
JScrollPane scrollPane = new JScrollPane();
@ -88,7 +87,8 @@ public class InitialBootScreen extends JFrame {
JEditorPane editorPane = new JEditorPane();
editorPane.setEditorKit(new HTMLEditorKit());
editorPane.setText(convertStreamToString(InitialBootScreen.class.getClassLoader().getResourceAsStream("intro.html")));
editorPane.setText(convertStreamToString(InitialBootScreen.class.getClassLoader().getResourceAsStream("intro"
+ ".html")));
scrollPane.setViewportView(editorPane);

View file

@ -6,11 +6,9 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.tree.ClassNode;
import the.bytecode.club.bootloader.resource.ExternalResource;
import the.bytecode.club.bootloader.resource.JarContents;
import the.bytecode.club.bootloader.util.ClassTree;
@ -36,8 +34,8 @@ import the.bytecode.club.bootloader.util.ClassTree;
/**
* @author Bibl (don't ban me pls)
* @created 19 Jul 2015 02:48:41
* <p>
* TODO: Resource loading
* <p>
* TODO: Resource loading
*/
@Deprecated
public class LibraryClassLoader extends ClassLoader implements ILoader<JarContents<ClassNode>> {
@ -53,7 +51,8 @@ public class LibraryClassLoader extends ClassLoader implements ILoader<JarConten
}
/* (non-Javadoc)
* @see the.bytecode.club.bytecodeviewer.loadermodel.ILoader#bind(the.bytecode.club.bytecodeviewer.loadermodel.ExternalResource)
* @see the.bytecode.club.bytecodeviewer.loadermodel.ILoader#bind(the.bytecode.club.bytecodeviewer.loadermodel
* .ExternalResource)
*/
@Override
public void bind(ExternalResource<JarContents<ClassNode>> resource) {

View file

@ -22,7 +22,7 @@ package the.bytecode.club.bootloader;
* @author Bibl (don't ban me pls)
* @created 21 Jul 2015 00:14:53
*/
public abstract interface LoaderFactory<T> {
public interface LoaderFactory<T> {
public abstract ILoader<T> spawnLoader();
ILoader<T> spawnLoader();
}

View file

@ -9,7 +9,6 @@ import java.net.URL;
import java.util.Enumeration;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.tree.ClassNode;

View file

@ -59,11 +59,8 @@ public abstract class ExternalResource<T> {
return false;
ExternalResource<?> other = (ExternalResource<?>) obj;
if (location == null) {
if (other.location != null)
return false;
} else if (!location.equals(other.location))
return false;
return true;
return other.location == null;
} else return location.equals(other.location);
}
@Override

View file

@ -6,7 +6,6 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.objectweb.asm.tree.ClassNode;
/***************************************************************************

View file

@ -114,8 +114,6 @@ public class JarInfo {
return false;
} else if (!path.equals(other.path))
return false;
if (type != other.type)
return false;
return true;
return type == other.type;
}
}

View file

@ -63,10 +63,7 @@ public class JarResource {
if (!Arrays.equals(data, other.data))
return false;
if (name == null) {
if (other.name != null)
return false;
} else if (!name.equals(other.name))
return false;
return true;
return other.name == null;
} else return name.equals(other.name);
}
}

View file

@ -37,7 +37,7 @@ public enum JarType {
private final String prefix;
private JarType(String prefix) {
JarType(String prefix) {
this.prefix = prefix;
}

View file

@ -1,7 +1,6 @@
package the.bytecode.club.bootloader.resource;
import java.net.URL;
import org.objectweb.asm.tree.ClassNode;
/***************************************************************************
@ -35,7 +34,8 @@ public class LocateableJarContents<C extends ClassNode> extends JarContents<C> {
this.jarUrls = jarUrls;
}
public LocateableJarContents(DataContainer<C> classContents, DataContainer<JarResource> resourceContents, URL... jarUrls) {
public LocateableJarContents(DataContainer<C> classContents, DataContainer<JarResource> resourceContents,
URL... jarUrls) {
super(classContents, resourceContents);
this.jarUrls = jarUrls;
}

View file

@ -1,25 +1,27 @@
package the.bytecode.club.bootloader.util;
import java.io.FilterOutputStream;
import java.io.InputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.ByteBuffer;
import java.nio.charset.StandardCharsets;
import java.util.*;
import java.util.Arrays;
import java.util.Objects;
public class Base64 {
private Base64() {}
private Base64() {
}
/**
* Returns a {@link Encoder} that encodes using the
* <a href="#basic">Basic</a> type base64 encoding scheme.
*
* @return A Base64 encoder.
* @return A Base64 encoder.
*/
public static Encoder getEncoder() {
return Encoder.RFC4648;
return Encoder.RFC4648;
}
/**
@ -27,17 +29,17 @@ public class Base64 {
* <a href="#url">URL and Filename safe</a> type base64
* encoding scheme.
*
* @return A Base64 encoder.
* @return A Base64 encoder.
*/
public static Encoder getUrlEncoder() {
return Encoder.RFC4648_URLSAFE;
return Encoder.RFC4648_URLSAFE;
}
/**
* Returns a {@link Encoder} that encodes using the
* <a href="#mime">MIME</a> type base64 encoding scheme.
*
* @return A Base64 encoder.
* @return A Base64 encoder.
*/
public static Encoder getMimeEncoder() {
return Encoder.RFC2045;
@ -48,41 +50,37 @@ public class Base64 {
* <a href="#mime">MIME</a> type base64 encoding scheme
* with specified line length and line separators.
*
* @param lineLength
* the length of each output line (rounded down to nearest multiple
* of 4). If {@code lineLength <= 0} the output will not be separated
* in lines
* @param lineSeparator
* the line separator for each output line
*
* @return A Base64 encoder.
*
* @throws IllegalArgumentException if {@code lineSeparator} includes any
* character of "The Base64 Alphabet" as specified in Table 1 of
* RFC 2045.
* @param lineLength the length of each output line (rounded down to nearest multiple
* of 4). If {@code lineLength <= 0} the output will not be separated
* in lines
* @param lineSeparator the line separator for each output line
* @return A Base64 encoder.
* @throws IllegalArgumentException if {@code lineSeparator} includes any
* character of "The Base64 Alphabet" as specified in Table 1 of
* RFC 2045.
*/
public static Encoder getMimeEncoder(int lineLength, byte[] lineSeparator) {
Objects.requireNonNull(lineSeparator);
int[] base64 = Decoder.fromBase64;
for (byte b : lineSeparator) {
if (base64[b & 0xff] != -1)
throw new IllegalArgumentException(
"Illegal base64 line separator character 0x" + Integer.toString(b, 16));
}
if (lineLength <= 0) {
return Encoder.RFC4648;
}
return new Encoder(false, lineSeparator, lineLength >> 2 << 2, true);
Objects.requireNonNull(lineSeparator);
int[] base64 = Decoder.fromBase64;
for (byte b : lineSeparator) {
if (base64[b & 0xff] != -1)
throw new IllegalArgumentException(
"Illegal base64 line separator character 0x" + Integer.toString(b, 16));
}
if (lineLength <= 0) {
return Encoder.RFC4648;
}
return new Encoder(false, lineSeparator, lineLength >> 2 << 2, true);
}
/**
* Returns a {@link Decoder} that decodes using the
* <a href="#basic">Basic</a> type base64 encoding scheme.
*
* @return A Base64 decoder.
* @return A Base64 decoder.
*/
public static Decoder getDecoder() {
return Decoder.RFC4648;
return Decoder.RFC4648;
}
/**
@ -90,20 +88,20 @@ public class Base64 {
* <a href="#url">URL and Filename safe</a> type base64
* encoding scheme.
*
* @return A Base64 decoder.
* @return A Base64 decoder.
*/
public static Decoder getUrlDecoder() {
return Decoder.RFC4648_URLSAFE;
return Decoder.RFC4648_URLSAFE;
}
/**
* Returns a {@link Decoder} that decodes using the
* <a href="#mime">MIME</a> type base64 decoding scheme.
*
* @return A Base64 decoder.
* @return A Base64 decoder.
*/
public static Decoder getMimeDecoder() {
return Decoder.RFC2045;
return Decoder.RFC2045;
}
/**
@ -118,8 +116,8 @@ public class Base64 {
* {@link java.lang.NullPointerException NullPointerException} to
* be thrown.
*
* @see Decoder
* @since 1.8
* @see Decoder
* @since 1.8
*/
public static class Encoder {
@ -141,11 +139,11 @@ public class Base64 {
* in "Table 1: The Base64 Alphabet" of RFC 2045 (and RFC 4648).
*/
private static final char[] toBase64 = {
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/'
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/'
};
/**
@ -154,15 +152,15 @@ public class Base64 {
* '_'. This table is used when BASE64_URL is specified.
*/
private static final char[] toBase64URL = {
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '-', '_'
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M',
'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm',
'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '-', '_'
};
private static final int MIMELINEMAX = 76;
private static final byte[] CRLF = new byte[] {'\r', '\n'};
private static final byte[] CRLF = new byte[]{'\r', '\n'};
static final Encoder RFC4648 = new Encoder(false, null, -1, true);
static final Encoder RFC4648_URLSAFE = new Encoder(true, null, -1, true);
@ -186,17 +184,16 @@ public class Base64 {
* byte array using the {@link Base64} encoding scheme. The returned byte
* array is of the length of the resulting bytes.
*
* @param src
* the byte array to encode
* @return A newly-allocated byte array containing the resulting
* encoded bytes.
* @param src the byte array to encode
* @return A newly-allocated byte array containing the resulting
* encoded bytes.
*/
public byte[] encode(byte[] src) {
int len = outLength(src.length); // dst array size
byte[] dst = new byte[len];
int ret = encode0(src, 0, src.length, dst);
if (ret != dst.length)
return Arrays.copyOf(dst, ret);
return Arrays.copyOf(dst, ret);
return dst;
}
@ -210,20 +207,17 @@ public class Base64 {
* all bytes from the input byte array. No bytes will be written to the
* output byte array if the output byte array is not big enough.
*
* @param src
* the byte array to encode
* @param dst
* the output byte array
* @return The number of bytes written to the output byte array
*
* @throws IllegalArgumentException if {@code dst} does not have enough
* space for encoding all input bytes.
* @param src the byte array to encode
* @param dst the output byte array
* @return The number of bytes written to the output byte array
* @throws IllegalArgumentException if {@code dst} does not have enough
* space for encoding all input bytes.
*/
public int encode(byte[] src, byte[] dst) {
int len = outLength(src.length); // dst array size
if (dst.length < len)
throw new IllegalArgumentException(
"Output byte array is too small for encoding all input bytes");
"Output byte array is too small for encoding all input bytes");
return encode0(src, 0, src.length, dst);
}
@ -240,9 +234,8 @@ public class Base64 {
* effect as invoking
* {@code new String(encode(src), StandardCharsets.ISO_8859_1)}.
*
* @param src
* the byte array to encode
* @return A String containing the resulting Base64 encoded characters
* @param src the byte array to encode
* @return A String containing the resulting Base64 encoded characters
*/
@SuppressWarnings("deprecation")
public String encodeToString(byte[] src) {
@ -254,15 +247,14 @@ public class Base64 {
* Encodes all remaining bytes from the specified byte buffer into
* a newly-allocated ByteBuffer using the {@link Base64} encoding
* scheme.
*
* <p>
* Upon return, the source buffer's position will be updated to
* its limit; its limit will not have been changed. The returned
* output buffer's position will be zero and its limit will be the
* number of resulting encoded bytes.
*
* @param buffer
* the source ByteBuffer to encode
* @return A newly-allocated byte buffer containing the encoded bytes.
* @param buffer the source ByteBuffer to encode
* @return A newly-allocated byte buffer containing the encoded bytes.
*/
public ByteBuffer encode(ByteBuffer buffer) {
int len = outLength(buffer.remaining());
@ -270,9 +262,9 @@ public class Base64 {
int ret = 0;
if (buffer.hasArray()) {
ret = encode0(buffer.array(),
buffer.arrayOffset() + buffer.position(),
buffer.arrayOffset() + buffer.limit(),
dst);
buffer.arrayOffset() + buffer.position(),
buffer.arrayOffset() + buffer.limit(),
dst);
buffer.position(buffer.limit());
} else {
byte[] src = new byte[buffer.remaining()];
@ -280,7 +272,7 @@ public class Base64 {
ret = encode0(src, 0, src.length, dst);
}
if (ret != dst.length)
dst = Arrays.copyOf(dst, ret);
dst = Arrays.copyOf(dst, ret);
return ByteBuffer.wrap(dst);
}
@ -293,15 +285,14 @@ public class Base64 {
* output stream. Closing the returned output stream will close the underlying
* output stream.
*
* @param os
* the output stream.
* @return the output stream for encoding the byte data into the
* specified Base64 encoded format
* @param os the output stream.
* @return the output stream for encoding the byte data into the
* specified Base64 encoded format
*/
public OutputStream wrap(OutputStream os) {
Objects.requireNonNull(os);
return new EncOutputStream(os, isURL ? toBase64URL : toBase64,
newline, linemax, doPadding);
newline, linemax, doPadding);
}
/**
@ -327,42 +318,42 @@ public class Base64 {
int sp = off;
int slen = (end - off) / 3 * 3;
int sl = off + slen;
if (linemax > 0 && slen > linemax / 4 * 3)
if (linemax > 0 && slen > linemax / 4 * 3)
slen = linemax / 4 * 3;
int dp = 0;
while (sp < sl) {
int sl0 = Math.min(sp + slen, sl);
for (int sp0 = sp, dp0 = dp ; sp0 < sl0; ) {
for (int sp0 = sp, dp0 = dp; sp0 < sl0; ) {
int bits = (src[sp0++] & 0xff) << 16 |
(src[sp0++] & 0xff) << 8 |
(src[sp0++] & 0xff);
dst[dp0++] = (byte)base64[(bits >>> 18) & 0x3f];
dst[dp0++] = (byte)base64[(bits >>> 12) & 0x3f];
dst[dp0++] = (byte)base64[(bits >>> 6) & 0x3f];
dst[dp0++] = (byte)base64[bits & 0x3f];
(src[sp0++] & 0xff) << 8 |
(src[sp0++] & 0xff);
dst[dp0++] = (byte) base64[(bits >>> 18) & 0x3f];
dst[dp0++] = (byte) base64[(bits >>> 12) & 0x3f];
dst[dp0++] = (byte) base64[(bits >>> 6) & 0x3f];
dst[dp0++] = (byte) base64[bits & 0x3f];
}
int dlen = (sl0 - sp) / 3 * 4;
dp += dlen;
sp = sl0;
if (dlen == linemax && sp < end) {
for (byte b : newline){
for (byte b : newline) {
dst[dp++] = b;
}
}
}
if (sp < end) { // 1 or 2 leftover bytes
int b0 = src[sp++] & 0xff;
dst[dp++] = (byte)base64[b0 >> 2];
dst[dp++] = (byte) base64[b0 >> 2];
if (sp == end) {
dst[dp++] = (byte)base64[(b0 << 4) & 0x3f];
dst[dp++] = (byte) base64[(b0 << 4) & 0x3f];
if (doPadding) {
dst[dp++] = '=';
dst[dp++] = '=';
}
} else {
int b1 = src[sp++] & 0xff;
dst[dp++] = (byte)base64[(b0 << 4) & 0x3f | (b1 >> 4)];
dst[dp++] = (byte)base64[(b1 << 2) & 0x3f];
dst[dp++] = (byte) base64[(b0 << 4) & 0x3f | (b1 >> 4)];
dst[dp++] = (byte) base64[(b1 << 2) & 0x3f];
if (doPadding) {
dst[dp++] = '=';
}
@ -395,8 +386,8 @@ public class Base64 {
* {@link java.lang.NullPointerException NullPointerException} to
* be thrown.
*
* @see Encoder
* @since 1.8
* @see Encoder
* @since 1.8
*/
public static class Decoder {
@ -414,9 +405,9 @@ public class Base64 {
* their 6-bit positive integer equivalents. Characters that
* are not in the Base64 alphabet but fall within the bounds of
* the array are encoded to -1.
*
*/
private static final int[] fromBase64 = new int[256];
static {
Arrays.fill(fromBase64, -1);
for (int i = 0; i < Encoder.toBase64.length; i++)
@ -437,9 +428,9 @@ public class Base64 {
fromBase64URL['='] = -2;
}
static final Decoder RFC4648 = new Decoder(false, false);
static final Decoder RFC4648 = new Decoder(false, false);
static final Decoder RFC4648_URLSAFE = new Decoder(true, false);
static final Decoder RFC2045 = new Decoder(false, true);
static final Decoder RFC2045 = new Decoder(false, true);
/**
* Decodes all bytes from the input byte array using the {@link Base64}
@ -447,13 +438,9 @@ public class Base64 {
* byte array. The returned byte array is of the length of the resulting
* bytes.
*
* @param src
* the byte array to decode
*
* @return A newly-allocated byte array containing the decoded bytes.
*
* @throws IllegalArgumentException
* if {@code src} is not in valid Base64 scheme
* @param src the byte array to decode
* @return A newly-allocated byte array containing the decoded bytes.
* @throws IllegalArgumentException if {@code src} is not in valid Base64 scheme
*/
public byte[] decode(byte[] src) {
byte[] dst = new byte[outLength(src, 0, src.length)];
@ -471,13 +458,9 @@ public class Base64 {
* <p> An invocation of this method has exactly the same effect as invoking
* {@code decode(src.getBytes(StandardCharsets.ISO_8859_1))}
*
* @param src
* the string to decode
*
* @return A newly-allocated byte array containing the decoded bytes.
*
* @throws IllegalArgumentException
* if {@code src} is not in valid Base64 scheme
* @param src the string to decode
* @return A newly-allocated byte array containing the decoded bytes.
* @throws IllegalArgumentException if {@code src} is not in valid Base64 scheme
*/
public byte[] decode(String src) {
return decode(src.getBytes(StandardCharsets.ISO_8859_1));
@ -497,22 +480,17 @@ public class Base64 {
* then some bytes may have been written to the output byte array before
* IllegalargumentException is thrown.
*
* @param src
* the byte array to decode
* @param dst
* the output byte array
*
* @return The number of bytes written to the output byte array
*
* @throws IllegalArgumentException
* if {@code src} is not in valid Base64 scheme, or {@code dst}
* does not have enough space for decoding all input bytes.
* @param src the byte array to decode
* @param dst the output byte array
* @return The number of bytes written to the output byte array
* @throws IllegalArgumentException if {@code src} is not in valid Base64 scheme, or {@code dst}
* does not have enough space for decoding all input bytes.
*/
public int decode(byte[] src, byte[] dst) {
int len = outLength(src, 0, src.length);
if (dst.length < len)
throw new IllegalArgumentException(
"Output byte array is too small for decoding all input bytes");
"Output byte array is too small for decoding all input bytes");
return decode0(src, 0, src.length, dst);
}
@ -529,13 +507,9 @@ public class Base64 {
* is not in valid Base64 encoding scheme. The position of the input
* buffer will not be advanced in this case.
*
* @param buffer
* the ByteBuffer to decode
*
* @return A newly-allocated byte buffer containing the decoded bytes
*
* @throws IllegalArgumentException
* if {@code src} is not in valid Base64 scheme.
* @param buffer the ByteBuffer to decode
* @return A newly-allocated byte buffer containing the decoded bytes
* @throws IllegalArgumentException if {@code src} is not in valid Base64 scheme.
*/
public ByteBuffer decode(ByteBuffer buffer) {
int pos0 = buffer.position();
@ -570,11 +544,9 @@ public class Base64 {
* <p> Closing the returned input stream will close the underlying
* input stream.
*
* @param is
* the input stream
*
* @return the input stream for decoding the specified Base64 encoded
* byte stream
* @param is the input stream
* @return the input stream for decoding the specified Base64 encoded
* byte stream
*/
public InputStream wrap(InputStream is) {
Objects.requireNonNull(is);
@ -591,7 +563,7 @@ public class Base64 {
if (isMIME && base64[0] == -1)
return 0;
throw new IllegalArgumentException(
"Input byte[] should at least have 2 bytes for base64 bytes");
"Input byte[] should at least have 2 bytes for base64 bytes");
}
if (isMIME) {
// scan all bytes to fill out all non-alphabet. a performance
@ -614,7 +586,7 @@ public class Base64 {
paddings++;
}
}
if (paddings == 0 && (len & 0x3) != 0)
if (paddings == 0 && (len & 0x3) != 0)
paddings = 4 - (len & 0x3);
return 3 * ((len + 3) / 4) - paddings;
}
@ -634,9 +606,9 @@ public class Base64 {
// xx= shiftto==6&&sp==sl missing last =
// xx=y shiftto==6 last is not =
if (shiftto == 6 && (sp == sl || src[sp++] != '=') ||
shiftto == 18) {
shiftto == 18) {
throw new IllegalArgumentException(
"Input byte array has wrong 4-byte ending unit");
"Input byte array has wrong 4-byte ending unit");
}
break;
}
@ -644,29 +616,29 @@ public class Base64 {
continue;
else
throw new IllegalArgumentException(
"Illegal base64 character " +
Integer.toString(src[sp - 1], 16));
"Illegal base64 character " +
Integer.toString(src[sp - 1], 16));
}
bits |= (b << shiftto);
shiftto -= 6;
if (shiftto < 0) {
dst[dp++] = (byte)(bits >> 16);
dst[dp++] = (byte)(bits >> 8);
dst[dp++] = (byte)(bits);
dst[dp++] = (byte) (bits >> 16);
dst[dp++] = (byte) (bits >> 8);
dst[dp++] = (byte) (bits);
shiftto = 18;
bits = 0;
}
}
// reached end of byte array or hit padding '=' characters.
if (shiftto == 6) {
dst[dp++] = (byte)(bits >> 16);
dst[dp++] = (byte) (bits >> 16);
} else if (shiftto == 0) {
dst[dp++] = (byte)(bits >> 16);
dst[dp++] = (byte)(bits >> 8);
dst[dp++] = (byte) (bits >> 16);
dst[dp++] = (byte) (bits >> 8);
} else if (shiftto == 12) {
// dangling single "x", incorrectly encoded.
throw new IllegalArgumentException(
"Last unit does not have enough valid bits");
"Last unit does not have enough valid bits");
}
// anything left is invalid, if is not MIME.
// if MIME, ignore all non-base64 character
@ -674,7 +646,7 @@ public class Base64 {
if (isMIME && base64[src[sp++]] < 0)
continue;
throw new IllegalArgumentException(
"Input byte array has incorrect ending byte at " + sp);
"Input byte array has incorrect ending byte at " + sp);
}
return dp;
}
@ -707,7 +679,7 @@ public class Base64 {
@Override
public void write(int b) throws IOException {
byte[] buf = new byte[1];
buf[0] = (byte)(b & 0xff);
buf[0] = (byte) (b & 0xff);
write(buf, 0, 1);
}
@ -749,14 +721,14 @@ public class Base64 {
while (nBits24-- > 0) {
checkNewline();
int bits = (b[off++] & 0xff) << 16 |
(b[off++] & 0xff) << 8 |
(b[off++] & 0xff);
(b[off++] & 0xff) << 8 |
(b[off++] & 0xff);
out.write(base64[(bits >>> 18) & 0x3f]);
out.write(base64[(bits >>> 12) & 0x3f]);
out.write(base64[(bits >>> 6) & 0x3f]);
out.write(base64[(bits >>> 6) & 0x3f]);
out.write(base64[bits & 0x3f]);
linepos += 4;
}
}
if (leftover == 1) {
b0 = b[off++] & 0xff;
} else if (leftover == 2) {
@ -783,7 +755,7 @@ public class Base64 {
out.write(base64[(b0 << 4) & 0x3f | (b1 >> 4)]);
out.write(base64[(b1 << 2) & 0x3f]);
if (doPadding) {
out.write('=');
out.write('=');
}
}
leftover = 0;
@ -802,9 +774,9 @@ public class Base64 {
private final int[] base64; // base64 -> byte mapping
private int bits = 0; // 24-bit buffer for decoding
private int nextin = 18; // next available "off" in "bits" for input;
// -> 18, 12, 6, 0
// -> 18, 12, 6, 0
private int nextout = -8; // next available "off" in "bits" for output;
// -> 8, 0, -8 (no byte for output)
// -> 8, 0, -8 (no byte for output)
private boolean eof = false;
private boolean closed = false;
@ -814,7 +786,7 @@ public class Base64 {
this.isMIME = isMIME;
}
private byte[] sbBuf = new byte[1];
private final byte[] sbBuf = new byte[1];
@Override
public int read() throws IOException {
@ -834,7 +806,7 @@ public class Base64 {
do {
if (len == 0)
return off - oldOff;
b[off++] = (byte)(bits >> nextout);
b[off++] = (byte) (bits >> nextout);
len--;
nextout -= 8;
} while (nextout >= 0);
@ -849,14 +821,14 @@ public class Base64 {
throw new IOException("Base64 stream has one un-decoded dangling byte.");
// treat ending xx/xxx without padding character legal.
// same logic as v == '=' below
b[off++] = (byte)(bits >> (16));
b[off++] = (byte) (bits >> (16));
len--;
if (nextin == 0) { // only one padding byte
if (len == 0) { // no enough output space
bits >>= 8; // shift to lowest byte
nextout = 0;
} else {
b[off++] = (byte) (bits >> 8);
b[off++] = (byte) (bits >> 8);
}
}
}
@ -871,17 +843,17 @@ public class Base64 {
// xx= shiftto==6 && missing last '='
// xx=y or last is not '='
if (nextin == 18 || nextin == 12 ||
nextin == 6 && is.read() != '=') {
nextin == 6 && is.read() != '=') {
throw new IOException("Illegal base64 ending sequence:" + nextin);
}
b[off++] = (byte)(bits >> (16));
b[off++] = (byte) (bits >> (16));
len--;
if (nextin == 0) { // only one padding byte
if (len == 0) { // no enough output space
bits >>= 8; // shift to lowest byte
nextout = 0;
} else {
b[off++] = (byte) (bits >> 8);
b[off++] = (byte) (bits >> 8);
}
}
eof = true;
@ -892,14 +864,14 @@ public class Base64 {
continue;
else
throw new IOException("Illegal base64 character " +
Integer.toString(v, 16));
Integer.toString(v, 16));
}
bits |= (v << nextin);
if (nextin == 0) {
nextin = 18; // clear for next
nextout = 16;
while (nextout >= 0) {
b[off++] = (byte)(bits >> nextout);
b[off++] = (byte) (bits >> nextout);
len--;
nextout -= 8;
if (len == 0 && nextout >= 0) { // don't clean "bits"

View file

@ -4,7 +4,6 @@ import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import org.objectweb.asm.tree.ClassNode;
/***************************************************************************

View file

@ -1,18 +1,17 @@
package the.bytecode.club.bootloader.util;
import static the.bytecode.club.bootloader.util.ClassHelper.convertToMap;
import static the.bytecode.club.bootloader.util.ClassHelper.copyOf;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import org.objectweb.asm.tree.ClassNode;
import org.objectweb.asm.tree.MethodNode;
import static the.bytecode.club.bootloader.util.ClassHelper.convertToMap;
import static the.bytecode.club.bootloader.util.ClassHelper.copyOf;
/***************************************************************************
* Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite *
* Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com *
@ -133,7 +132,8 @@ public class ClassTree {
classes.put(node.name, node);
}
private void buildSubTree(Map<String, ClassNode> classes, Collection<ClassNode> superinterfaces, ClassNode current) {
private void buildSubTree(Map<String, ClassNode> classes, Collection<ClassNode> superinterfaces,
ClassNode current) {
superinterfaces.add(current);
for (String iface : current.interfaces) {
ClassNode cs = classes.get(iface);

View file

@ -22,7 +22,7 @@ package the.bytecode.club.bootloader.util;
* @author Bibl (don't ban me pls)
* @created ages ago
*/
public abstract interface ValueCreator<V> {
public interface ValueCreator<V> {
public abstract V create();
V create();
}

View file

@ -1,6 +1,9 @@
package the.bytecode.club.bytecodeviewer;
import java.awt.*;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.reflect.TypeToken;
import java.awt.Desktop;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
@ -18,23 +21,17 @@ import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import javax.swing.JDialog;
import javax.swing.JFileChooser;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;
import javax.swing.UIManager;
import javax.swing.filechooser.FileFilter;
import com.google.gson.reflect.TypeToken;
import me.konloch.kontainer.io.DiskReader;
import me.konloch.kontainer.io.DiskWriter;
import me.konloch.kontainer.io.HTTPRequest;
import org.apache.commons.io.FileUtils;
import org.objectweb.asm.tree.ClassNode;
import com.google.gson.*;
import the.bytecode.club.bootloader.Boot;
import the.bytecode.club.bootloader.ILoader;
import the.bytecode.club.bootloader.resource.EmptyExternalResource;
@ -49,7 +46,14 @@ import the.bytecode.club.bytecodeviewer.gui.SystemErrConsole;
import the.bytecode.club.bytecodeviewer.gui.WorkPane;
import the.bytecode.club.bytecodeviewer.obfuscators.mapping.Refactorer;
import the.bytecode.club.bytecodeviewer.plugin.PluginManager;
import the.bytecode.club.bytecodeviewer.util.*;
import the.bytecode.club.bytecodeviewer.util.APKTool;
import the.bytecode.club.bytecodeviewer.util.Dex2Jar;
import the.bytecode.club.bytecodeviewer.util.Enjarify;
import the.bytecode.club.bytecodeviewer.util.FileContainer;
import the.bytecode.club.bytecodeviewer.util.JRTExtractor;
import the.bytecode.club.bytecodeviewer.util.JarUtils;
import the.bytecode.club.bytecodeviewer.util.LazyNameUtil;
import the.bytecode.club.bytecodeviewer.util.MiscUtils;
/***************************************************************************
* Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite *
@ -71,63 +75,65 @@ import the.bytecode.club.bytecodeviewer.util.*;
/**
* TODO:
* open as folder doesn't actually work
* smali compile
*
* open as folder doesn't actually work
* smali compile
* <p>
* A lightweight Java Reverse Engineering suite, developed by Konloch - http://konloch.me
*
* <p>
* All you have to do is add a jar or class file into the workspace,
* select the file you want then it will start decompiling the class in the background.
* When it's done it will show the Source code, Bytecode and Hexcode of the class file you chose.
*
* <p>
* There is also a plugin system that will allow you to interact with the loaded classfiles.
* For example you can write a String deobfuscator, a malicious code searcher,
* or anything else you can think of.
*
* <p>
* You can either use one of the pre-written plugins, or write your own. It supports java scripting.
* Once a plugin is activated, it will send a ClassNode ArrayList of every single class loaded in the
* file system to the execute function, this allows the user to handle it completely using ASM.
*
* <p>
* Are you a Java Reverse Engineer? Or maybe you want to learn Java Reverse Engineering?
* Join The Bytecode Club, we're noob friendly, and censorship free.
* http://the.bytecode.club
*
* TODO:
* Finish dragging code
* Finish right-click tab menu detection
* make it use that global last used inside of export as jar
* Add https://github.com/ptnkjke/Java-Bytecode-Editor visualize as a plugin
* make zipfile not include the decode shit
* add stackmapframes to bytecode decompiler
* make ez-injection plugin console show all sys.out calls
* add JEB decompiler optionally, requires them to add jeb library jar externally and disable update check ?
* add decompile as zip for krakatau-bytecode, jd-gui and smali for CLI
* add decompile all as zip for CLI
* fix hook inject for EZ-Injection
* fix classfile searcher
* make the decompilers launch in a separate process
* Join The Bytecode Club, we're noob friendly, and censorship free.
* http://the.bytecode.club
* <p>
* TODO:
* Finish dragging code
* Finish right-click tab menu detection
* make it use that global last used inside of export as jar
* Add https://github.com/ptnkjke/Java-Bytecode-Editor visualize as a plugin
* make zipfile not include the decode shit
* add stackmapframes to bytecode decompiler
* make ez-injection plugin console show all sys.out calls
* add JEB decompiler optionally, requires them to add jeb library jar externally and disable update check ?
* add decompile as zip for krakatau-bytecode, jd-gui and smali for CLI
* add decompile all as zip for CLI
* fix hook inject for EZ-Injection
* fix classfile searcher
* make the decompilers launch in a separate process
*
* @author Konloch
* @author The entire BCV community
*/
public class BytecodeViewer
{
public class BytecodeViewer {
/*per version*/
public static final String VERSION = "2.9.23";
public static String krakatauVersion = "12";
public static String enjarifyVersion = "4";
public static final boolean BLOCK_TAB_MENU = true;
public static final boolean PREVIEW_COPY = false;
public static final boolean FAT_JAR = true; //could be automatic by checking if it's loaded a class named whatever for a library
public static final boolean FAT_JAR = true; //could be automatic by checking if it's loaded a class named
// whatever for a library
public static final boolean OFFLINE_MODE = true; //disables the automatic updater
/*the rest*/
public static boolean verify = false; //eventually may be a setting
public static String[] args;
public static MainViewerGUI viewer = null;
public static ClassNodeLoader loader = new ClassNodeLoader(); //might be insecure due to assholes targeting BCV, however that's highly unlikely.
public static SecurityMan sm = new SecurityMan(); //might be insecure due to assholes targeting BCV, however that's highly unlikely.
public static ClassNodeLoader loader = new ClassNodeLoader(); //might be insecure due to assholes targeting BCV,
// however that's highly unlikely.
public static SecurityMan sm = new SecurityMan(); //might be insecure due to assholes targeting BCV, however
// that's highly unlikely.
public static String python = "";
public static String python3 = "";
public static String rt = "";
@ -142,21 +148,21 @@ public class BytecodeViewer
public static boolean needsReDump = true;
public static boolean warnForEditing = false;
public static List<FileContainer> files = new ArrayList<FileContainer>(); //all of BCV's loaded files/classes/etc
private static int maxRecentFiles = 25;
private static final int maxRecentFiles = 25;
public static String fs = System.getProperty("file.separator");
public static String nl = System.getProperty("line.separator");
private static File BCVDir = new File(System.getProperty("user.home") + fs + ".Bytecode-Viewer");
private static final File BCVDir = new File(System.getProperty("user.home") + fs + ".Bytecode-Viewer");
public static File RT_JAR = new File(System.getProperty("java.home") + fs + "lib" + fs + "rt.jar");
public static File RT_JAR_DUMPED = new File(getBCVDirectory() + fs + "rt.jar");
private static String filesName = getBCVDirectory() + fs + "recentfiles.json";
private static String pluginsName = getBCVDirectory() + fs + "recentplugins.json";
public static File RT_JAR_DUMPED = new File(getBCVDirectory() + fs + "rt.jar");
private static final String filesName = getBCVDirectory() + fs + "recentfiles.json";
private static final String pluginsName = getBCVDirectory() + fs + "recentplugins.json";
public static String settingsName = getBCVDirectory() + fs + "settings.bcv";
public static String tempDirectory = getBCVDirectory() + fs + "bcv_temp" + fs;
public static String libsDirectory = getBCVDirectory() + fs + "libs" + fs;
public static String krakatauWorkingDirectory = getBCVDirectory() + fs + "krakatau_" + krakatauVersion;
public static String enjarifyWorkingDirectory = getBCVDirectory() + fs + "enjarify_" + enjarifyVersion;
public static boolean runningObfuscation = false;
private static long start = System.currentTimeMillis();
private static final long start = System.currentTimeMillis();
public static String lastDirectory = ".";
public static List<Process> createdProcesses = new ArrayList<Process>();
public static Refactorer refactorer = new Refactorer();
@ -168,23 +174,21 @@ public class BytecodeViewer
private static List<String> recentPlugins;
private static List<String> recentFiles;
static
{
try
{
static {
try {
gson = new GsonBuilder().setPrettyPrinting().create();
if(new File(filesName).exists())
recentFiles = gson.fromJson(DiskReader.loadAsString(filesName), new TypeToken<ArrayList<String>>() {}.getType());
if (new File(filesName).exists())
recentFiles = gson.fromJson(DiskReader.loadAsString(filesName), new TypeToken<ArrayList<String>>() {
}.getType());
else
recentFiles = DiskReader.loadArrayList(getBCVDirectory() + fs + "recentfiles.bcv", false);
if(new File(pluginsName).exists())
recentPlugins = gson.fromJson(DiskReader.loadAsString(pluginsName), new TypeToken<ArrayList<String>>() {}.getType());
if (new File(pluginsName).exists())
recentPlugins = gson.fromJson(DiskReader.loadAsString(pluginsName), new TypeToken<ArrayList<String>>() {
}.getType());
else
recentPlugins = DiskReader.loadArrayList(getBCVDirectory() + fs + "recentplugins.bcv", false);
}
catch (Exception e)
{
} catch (Exception e) {
e.printStackTrace();
}
}
@ -192,11 +196,12 @@ public class BytecodeViewer
/**
* The version checker thread
*/
private static Thread versionChecker = new Thread() {
private static final Thread versionChecker = new Thread() {
@Override
public void run() {
try {
HTTPRequest r = new HTTPRequest(new URL("https://raw.githubusercontent.com/Konloch/bytecode-viewer/master/VERSION"));
HTTPRequest r = new HTTPRequest(new URL("https://raw.githubusercontent"
+ ".com/Konloch/bytecode-viewer/master/VERSION"));
final String version = r.readSingle();
try {
int simplemaths = Integer.parseInt(version.replace(".", ""));
@ -207,8 +212,7 @@ public class BytecodeViewer
}
if (!BytecodeViewer.VERSION.equals(version))
{
if (!BytecodeViewer.VERSION.equals(version)) {
JOptionPane pane = new JOptionPane("Your version: "
+ BytecodeViewer.VERSION
+ ", latest version: "
@ -230,7 +234,8 @@ public class BytecodeViewer
if (Desktop.isDesktopSupported()) {
Desktop.getDesktop().browse(new URI("https://github.com/Konloch/bytecode-viewer/releases"));
} else {
showMessage("Cannot open the page, please manually type it." + nl + "https://github.com/Konloch/bytecode-viewer/releases");
showMessage("Cannot open the page, please manually type it." + nl + "https://github"
+ ".com/Konloch/bytecode-viewer/releases");
}
}
if (result == 1) {
@ -283,15 +288,20 @@ public class BytecodeViewer
@Override
public void run() {
try {
InputStream is = new URL("https://github.com/Konloch/bytecode-viewer/releases/download/v" + version + "/BytecodeViewer." + version + ".zip").openConnection().getInputStream();
InputStream is = new URL("https://github.com/Konloch/bytecode-viewer/releases"
+ "/download/v" + version + "/BytecodeViewer." + version + ".zip").openConnection().getInputStream();
FileOutputStream fos = new FileOutputStream(finalFile);
try {
System.out.println("Downloading from https://github.com/Konloch/bytecode-viewer/releases/download/v" + version + "/BytecodeViewer." + version + ".zip");
System.out.println("Downloading from https://github"
+ ".com/Konloch/bytecode-viewer/releases/download/v" + version +
"/BytecodeViewer." + version + ".zip");
byte[] buffer = new byte[8192];
int len;
int downloaded = 0;
boolean flag = false;
showMessage("Downloading the jar in the background, when it's finished you will be alerted with another message box." + nl + nl + "Expect this to take several minutes.");
showMessage("Downloading the jar in the background, when it's finished "
+ "you will be alerted with another message box." + nl + nl +
"Expect this to take several minutes.");
while ((len = is.read(buffer)) > 0) {
fos.write(buffer, 0, len);
fos.flush();
@ -319,17 +329,19 @@ public class BytecodeViewer
System.out.println("Download finished!");
showMessage("Download successful! You can find the updated program at " + finalFile.getAbsolutePath());
} catch (FileNotFoundException e) {
try
{
InputStream is = new URL("https://github.com/Konloch/bytecode-viewer/releases/download/v" + version + "/BytecodeViewer." + version + ".jar").openConnection().getInputStream();
try {
InputStream is = new URL("https://github.com/Konloch/bytecode-viewer"
+ "/releases/download/v" + version + "/BytecodeViewer." + version + ".jar").openConnection().getInputStream();
FileOutputStream fos = new FileOutputStream(finalFile);
try {
System.out.println("Downloading from https://github.com/Konloch/bytecode-viewer/releases/download/v" + version + "/BytecodeViewer." + version + ".jar");
System.out.println("Downloading from https://github"
+ ".com/Konloch/bytecode-viewer/releases/download/v" + version + "/BytecodeViewer." + version + ".jar");
byte[] buffer = new byte[8192];
int len;
int downloaded = 0;
boolean flag = false;
showMessage("Downloading the jar in the background, when it's finished you will be alerted with another message box." + nl + nl + "Expect this to take several minutes.");
showMessage("Downloading the jar in the background, when it's "
+ "finished you will be alerted with another message box." + nl + nl + "Expect this to take several minutes.");
while ((len = is.read(buffer)) > 0) {
fos.write(buffer, 0, len);
fos.flush();
@ -356,12 +368,13 @@ public class BytecodeViewer
}
System.out.println("Download finished!");
showMessage("Download successful! You can find the updated program at " + finalFile.getAbsolutePath());
} catch (FileNotFoundException ex) {
showMessage("Unable to download, the zip file has not been uploaded yet, please try again in about 10 minutes.");
} catch (Exception ex) {
} catch (FileNotFoundException ex) {
showMessage("Unable to download, the zip file has not been uploaded yet, "
+ "please try again in about 10 minutes.");
} catch (Exception ex) {
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(ex);
}
} catch (Exception e) {
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e);
}
@ -381,7 +394,7 @@ public class BytecodeViewer
/**
* Pings back to bytecodeviewer.com to be added into the total running statistics
*/
private static Thread PingBack = new Thread() {
private static final Thread PingBack = new Thread() {
@Override
public void run() {
try {
@ -395,17 +408,14 @@ public class BytecodeViewer
/**
* Downloads & installs the krakatau & enjarify zips
*/
private static Thread InstallFatJar = new Thread() {
private static final Thread InstallFatJar = new Thread() {
@Override
public void run() {
try {
if(BytecodeViewer.OFFLINE_MODE)
{
if (BytecodeViewer.OFFLINE_MODE) {
Boot.dropKrakatau();
Boot.dropEnjarify();
}
else
{
} else {
Boot.populateUrlList();
Boot.populateLibsDirectory();
Boot.downloadZipsOnly();
@ -421,7 +431,7 @@ public class BytecodeViewer
/**
* Used to check incase booting failed for some reason, this kicks in as a fail safe
*/
private static Thread bootCheck = new Thread() {
private static final Thread bootCheck = new Thread() {
boolean finished = false;
@SuppressWarnings({"rawtypes", "unchecked"})
@ -433,14 +443,17 @@ public class BytecodeViewer
if (!Boot.completedboot && !Boot.downloading) {
if (Boot.libsDir() == null || Boot.libsDir().listFiles() == null || Boot.libsDir().listFiles().length <= 0) {
BytecodeViewer.showMessage(
"Github is loading extremely slow, BCV needs to download libraries from github in order" + nl +
"to work, please try ajusting your network settings or manually downloading these libraries" + nl +
"Github is loading extremely slow, BCV needs to download libraries from github in"
+ " order" + nl +
"to work, please try ajusting your network settings or manually "
+ "downloading these libraries" + nl +
"if this error persists.");
finished = true;
return;
}
Boot.setState("Bytecode Viewer Boot Screen (OFFLINE MODE) - Unable to connect to github, force booting...");
Boot.setState("Bytecode Viewer Boot Screen (OFFLINE MODE) - Unable to connect to github, "
+ "force booting...");
System.out.println("Unable to connect to github, force booting...");
List<String> libsList = new ArrayList<String>();
List<String> libsFileList = new ArrayList<String>();
@ -456,7 +469,8 @@ public class BytecodeViewer
if (s.endsWith(".jar")) {
File f = new File(s);
if (f.exists()) {
Boot.setState("Bytecode Viewer Boot Screen (OFFLINE MODE) - Force Loading Library " + f.getName());
Boot.setState("Bytecode Viewer Boot Screen (OFFLINE MODE) - Force Loading Library"
+ " " + f.getName());
System.out.println("Force loading library " + f.getName());
try {
@ -466,7 +480,8 @@ public class BytecodeViewer
} catch (Exception e) {
e.printStackTrace();
f.delete();
JOptionPane.showMessageDialog(null, "Error, Library " + f.getName() + " is corrupt, please restart to redownload it.",
JOptionPane.showMessageDialog(null, "Error, Library " + f.getName() + " is "
+ "corrupt, please restart to redownload it.",
"Error", JOptionPane.ERROR_MESSAGE);
}
}
@ -521,14 +536,17 @@ public class BytecodeViewer
*/
public static void main(String[] args) {
BytecodeViewer.args = args;
System.out.println("https://the.bytecode.club - Created by @Konloch - Bytecode Viewer " + VERSION +", Fat-Jar: " + FAT_JAR);
System.out.println("https://the.bytecode.club - Created by @Konloch - Bytecode Viewer " + VERSION + ", "
+ "Fat-Jar: " + FAT_JAR);
System.setSecurityManager(sm);
try {
UIManager.put("MenuItem.disabledAreNavigable", Boolean.FALSE);
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
if (PREVIEW_COPY && !CommandLineInput.containsCommand(args))
showMessage("WARNING: This is a preview/dev copy, you WON'T be alerted when " + VERSION + " is actually out if you use this." + nl +
"Make sure to watch the repo: https://github.com/Konloch/bytecode-viewer for " + VERSION + "'s release");
showMessage("WARNING: This is a preview/dev copy, you WON'T be alerted when " + VERSION + " is "
+ "actually out if you use this." + nl +
"Make sure to watch the repo: https://github.com/Konloch/bytecode-viewer for " + VERSION +
"'s release");
viewer = new MainViewerGUI();
Settings.loadSettings();
@ -541,10 +559,7 @@ public class BytecodeViewer
if (!FAT_JAR) {
bootCheck.start();
if (CLI == CommandLineInput.OPEN_FILE)
Boot.boot(args, false);
else
Boot.boot(args, true);
Boot.boot(args, CLI != CommandLineInput.OPEN_FILE);
} else
InstallFatJar.start();
@ -740,23 +755,23 @@ public class BytecodeViewer
cv.smali2 != null && cv.smali2.isEditable() ||
cv.smali3 != null && cv.smali3.isEditable()) {
actuallyTried = true;
Object smali[] = cv.getSmali();
Object[] smali = cv.getSmali();
if (smali != null) {
ClassNode origNode = (ClassNode) smali[0];
String smaliText = (String) smali[1];
byte[] smaliCompiled = the.bytecode.club.bytecodeviewer.compilers.Compiler.smali.compile(smaliText, origNode.name);
byte[] smaliCompiled =
the.bytecode.club.bytecodeviewer.compilers.Compiler.smali.compile(smaliText,
origNode.name);
if (smaliCompiled != null) {
try
{
try {
ClassNode newNode = JarUtils.getNode(smaliCompiled);
BytecodeViewer.updateNode(origNode, newNode);
}
catch(Exception e)
{
} catch (Exception e) {
e.printStackTrace();
}
} else {
BytecodeViewer.showMessage("There has been an error with assembling your Smali code, please check this. Class: " + origNode.name);
BytecodeViewer.showMessage("There has been an error with assembling your Smali code, "
+ "please check this. Class: " + origNode.name);
BytecodeViewer.viewer.setIcon(false);
return false;
}
@ -768,23 +783,23 @@ public class BytecodeViewer
cv.krakatau2 != null && cv.krakatau2.isEditable() ||
cv.krakatau3 != null && cv.krakatau3.isEditable()) {
actuallyTried = true;
Object krakatau[] = cv.getKrakatau();
Object[] krakatau = cv.getKrakatau();
if (krakatau != null) {
ClassNode origNode = (ClassNode) krakatau[0];
String krakatauText = (String) krakatau[1];
byte[] krakatauCompiled = the.bytecode.club.bytecodeviewer.compilers.Compiler.krakatau.compile(krakatauText, origNode.name);
byte[] krakatauCompiled =
the.bytecode.club.bytecodeviewer.compilers.Compiler.krakatau.compile(krakatauText,
origNode.name);
if (krakatauCompiled != null) {
try
{
try {
ClassNode newNode = JarUtils.getNode(krakatauCompiled);
BytecodeViewer.updateNode(origNode, newNode);
}
catch(Exception e)
{
} catch (Exception e) {
e.printStackTrace();
}
} else {
BytecodeViewer.showMessage("There has been an error with assembling your Krakatau Bytecode, please check this. Class: " + origNode.name);
BytecodeViewer.showMessage("There has been an error with assembling your Krakatau "
+ "Bytecode, please check this. Class: " + origNode.name);
BytecodeViewer.viewer.setIcon(false);
return false;
}
@ -795,23 +810,23 @@ public class BytecodeViewer
cv.java2 != null && cv.java2.isEditable() ||
cv.java3 != null && cv.java3.isEditable()) {
actuallyTried = true;
Object java[] = cv.getJava();
Object[] java = cv.getJava();
if (java != null) {
ClassNode origNode = (ClassNode) java[0];
String javaText = (String) java[1];
SystemErrConsole errConsole = new SystemErrConsole("Java Compile Issues");
errConsole.setText("Error compiling class: " + origNode.name + nl + "Keep in mind most decompilers cannot produce compilable classes" + nl + nl);
errConsole.setText("Error compiling class: " + origNode.name + nl + "Keep in mind most "
+ "decompilers cannot produce compilable classes" + nl + nl);
byte[] javaCompiled = the.bytecode.club.bytecodeviewer.compilers.Compiler.java.compile(javaText, origNode.name);
byte[] javaCompiled =
the.bytecode.club.bytecodeviewer.compilers.Compiler.java.compile(javaText,
origNode.name);
if (javaCompiled != null) {
try
{
try {
ClassNode newNode = JarUtils.getNode(javaCompiled);
BytecodeViewer.updateNode(origNode, newNode);
}
catch(Exception e)
{
} catch (Exception e) {
e.printStackTrace();
}
errConsole.finished();
@ -871,7 +886,8 @@ public class BytecodeViewer
boolean finished = false;
ArrayList<File> totalFiles = new ArrayList<File>();
totalFiles.add(f);
String dir = f.getAbsolutePath();//f.getAbsolutePath().substring(0, f.getAbsolutePath().length()-f.getName().length());
String dir = f.getAbsolutePath();//f.getAbsolutePath().substring(0, f.getAbsolutePath
// ().length()-f.getName().length());
while (!finished) {
boolean added = false;
@ -888,10 +904,12 @@ public class BytecodeViewer
if (!added) {
for (File child : totalFiles)
if (child.isFile()) {
String fileName = child.getAbsolutePath().substring(dir.length() + 1, child.getAbsolutePath().length()).replaceAll("\\\\", "\\/");
String fileName = child.getAbsolutePath().substring(dir.length() + 1
).replaceAll("\\\\", "\\/");
files.put(fileName, Files.readAllBytes(Paths.get(child.getAbsolutePath())));
files.put(fileName,
Files.readAllBytes(Paths.get(child.getAbsolutePath())));
}
finished = true;
}
@ -917,8 +935,10 @@ public class BytecodeViewer
} else if (fn.endsWith(".class")) {
try {
byte[] bytes = JarUtils.getBytes(new FileInputStream(f));
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")) {
String cafebabe = String.format("%02X", bytes[0]) + String.format("%02X",
bytes[1]) + String.format("%02X", bytes[2]) + String.format("%02X",
bytes[3]);
if (cafebabe.equalsIgnoreCase("cafebabe")) {
final ClassNode cn = JarUtils.getNode(bytes);
FileContainer container = new FileContainer(f);
@ -936,19 +956,22 @@ public class BytecodeViewer
try {
BytecodeViewer.viewer.setIcon(true);
File tempCopy = new File(tempDirectory+fs+MiscUtils.randomString(32)+".apk");
File tempCopy = new File(tempDirectory + fs + MiscUtils.randomString(32) +
".apk");
FileUtils.copyFile(f, tempCopy);
FileContainer container = new FileContainer(tempCopy, f.getName());
if (viewer.decodeAPKResources.isSelected()) {
File decodedResources = new File(tempDirectory + fs + MiscUtils.randomString(32) + ".apk");
File decodedResources =
new File(tempDirectory + fs + MiscUtils.randomString(32) + ".apk");
APKTool.decodeResources(tempCopy, decodedResources, container);
container.files = JarUtils.loadResources(decodedResources);
}
container.files.putAll(JarUtils.loadResources(tempCopy)); //copy and rename to prevent unicode filenames
container.files.putAll(JarUtils.loadResources(tempCopy)); //copy and rename
// to prevent unicode filenames
String name = getRandomizedName() + ".jar";
File output = new File(tempDirectory + fs + name);
@ -970,7 +993,8 @@ public class BytecodeViewer
try {
BytecodeViewer.viewer.setIcon(true);
File tempCopy = new File(tempDirectory+fs+MiscUtils.randomString(32)+".dex");
File tempCopy = new File(tempDirectory + fs + MiscUtils.randomString(32) +
".dex");
FileUtils.copyFile(f, tempCopy); //copy and rename to prevent unicode filenames
@ -1052,12 +1076,11 @@ public class BytecodeViewer
*
* @param ask if should require user input or not
*/
public static void resetWorkSpace(boolean ask)
{
if(ask)
{
public static void resetWorkSpace(boolean ask) {
if (ask) {
JOptionPane pane = new JOptionPane(
"Are you sure you want to reset the workspace?\n\rIt will also reset your file navigator and search.");
"Are you sure you want to reset the workspace?\n\rIt will also reset your file navigator and "
+ "search.");
Object[] options = new String[]{"Yes", "No"};
pane.setOptions(options);
JDialog dialog = pane.createDialog(viewer,
@ -1081,7 +1104,7 @@ public class BytecodeViewer
the.bytecode.club.bytecodeviewer.api.BytecodeViewer.getClassNodeLoader().clear();
}
private static List<String> killList = new ArrayList<String>();
private static final List<String> killList = new ArrayList<String>();
/**
* Add the recent file
@ -1100,8 +1123,8 @@ public class BytecodeViewer
killList.clear();
}
if (recentFiles.contains(f.getAbsolutePath())) // already added on the list
recentFiles.remove(f.getAbsolutePath());
// already added on the list
recentFiles.remove(f.getAbsolutePath());
if (recentFiles.size() >= maxRecentFiles)
recentFiles.remove(maxRecentFiles - 1); // zero indexing
@ -1110,7 +1133,7 @@ public class BytecodeViewer
resetRecentFilesMenu();
}
private static List<String> killList2 = new ArrayList<String>();
private static final List<String> killList2 = new ArrayList<String>();
/**
* Add to the recent plugin list
@ -1129,8 +1152,8 @@ public class BytecodeViewer
killList2.clear();
}
if (recentPlugins.contains(f.getAbsolutePath())) // already added on the list
recentPlugins.remove(f.getAbsolutePath());
// already added on the list
recentPlugins.remove(f.getAbsolutePath());
if (recentPlugins.size() >= maxRecentFiles)
recentPlugins.remove(maxRecentFiles - 1); // zero indexing
@ -1286,10 +1309,9 @@ public class BytecodeViewer
String extension = MiscUtils.extension(f.getAbsolutePath());
if (extension != null)
if (extension.equals("jar") || extension.equals("zip")
return extension.equals("jar") || extension.equals("zip")
|| extension.equals("class") || extension.equals("apk")
|| extension.equals("dex"))
return true;
|| extension.equals("dex");
return false;
}
@ -1407,19 +1429,15 @@ public class BytecodeViewer
}
}
public static File[] dumpTempFile(FileContainer container)
{
public static File[] dumpTempFile(FileContainer container) {
File[] files = new File[2];
//currently won't optimize if you've got two containers with the same name, will need to add this later
if(!LazyNameUtil.SAME_NAME_JAR_WORKSPACE)
{
if (krakatauTempJar != null && !krakatauTempJar.exists())
{
if (!LazyNameUtil.SAME_NAME_JAR_WORKSPACE) {
if (krakatauTempJar != null && !krakatauTempJar.exists()) {
needsReDump = true;
}
if (needsReDump && krakatauTempJar != null)
{
if (needsReDump && krakatauTempJar != null) {
krakatauTempDir = null;
krakatauTempJar = null;
}
@ -1439,8 +1457,7 @@ public class BytecodeViewer
else if (BytecodeViewer.viewer.panelGroup3.isSelected(BytecodeViewer.viewer.panel3KrakatauBytecode.getModel()))
passes = true;
if (krakatauTempJar != null || !passes)
{
if (krakatauTempJar != null || !passes) {
files[0] = krakatauTempJar;
files[1] = krakatauTempDir;
return files;
@ -1448,21 +1465,25 @@ public class BytecodeViewer
currentlyDumping = true;
needsReDump = false;
krakatauTempDir = new File(BytecodeViewer.tempDirectory + BytecodeViewer.fs + MiscUtils.randomString(32) + BytecodeViewer.fs);
krakatauTempDir =
new File(BytecodeViewer.tempDirectory + BytecodeViewer.fs + MiscUtils.randomString(32) + BytecodeViewer.fs);
krakatauTempDir.mkdir();
krakatauTempJar = new File(BytecodeViewer.tempDirectory + BytecodeViewer.fs + "temp" + MiscUtils.randomString(32) + ".jar");
//krakatauTempJar = new File(BytecodeViewer.tempDirectory + BytecodeViewer.fs + "temp" + MiscUtils.randomString(32) + ".jar."+container.name);
krakatauTempJar =
new File(BytecodeViewer.tempDirectory + BytecodeViewer.fs + "temp" + MiscUtils.randomString(32) + ".jar");
//krakatauTempJar = new File(BytecodeViewer.tempDirectory + BytecodeViewer.fs + "temp" + MiscUtils
// .randomString(32) + ".jar."+container.name);
JarUtils.saveAsJarClassesOnly(container.classes, krakatauTempJar.getAbsolutePath());
currentlyDumping = false;
}
else
{
} else {
currentlyDumping = true;
needsReDump = false;
krakatauTempDir = new File(BytecodeViewer.tempDirectory + BytecodeViewer.fs + MiscUtils.randomString(32) + BytecodeViewer.fs);
krakatauTempDir =
new File(BytecodeViewer.tempDirectory + BytecodeViewer.fs + MiscUtils.randomString(32) + BytecodeViewer.fs);
krakatauTempDir.mkdir();
krakatauTempJar = new File(BytecodeViewer.tempDirectory + BytecodeViewer.fs + "temp" + MiscUtils.randomString(32) + ".jar");
//krakatauTempJar = new File(BytecodeViewer.tempDirectory + BytecodeViewer.fs + "temp" + MiscUtils.randomString(32) + ".jar."+container.name);
krakatauTempJar =
new File(BytecodeViewer.tempDirectory + BytecodeViewer.fs + "temp" + MiscUtils.randomString(32) + ".jar");
//krakatauTempJar = new File(BytecodeViewer.tempDirectory + BytecodeViewer.fs + "temp" + MiscUtils
// .randomString(32) + ".jar."+container.name);
JarUtils.saveAsJarClassesOnly(container.classes, krakatauTempJar.getAbsolutePath());
currentlyDumping = false;
}
@ -1472,41 +1493,28 @@ public class BytecodeViewer
return files;
}
public synchronized static void rtCheck()
{
if(rt.equals(""))
{
if(RT_JAR.exists())
{
public synchronized static void rtCheck() {
if (rt.equals("")) {
if (RT_JAR.exists()) {
rt = RT_JAR.getAbsolutePath();
}
else if(RT_JAR_DUMPED.exists())
{
} else if (RT_JAR_DUMPED.exists()) {
rt = RT_JAR_DUMPED.getAbsolutePath();
}
else
{
try
{
} else {
try {
JRTExtractor.extractRT(RT_JAR_DUMPED.getAbsolutePath());
rt = RT_JAR_DUMPED.getAbsolutePath();
}
catch (Throwable t)
{
} catch (Throwable t) {
t.printStackTrace();
}
}
}
}
public static int fileContainersHash(ArrayList<FileContainer> fileContainers)
{
public static int fileContainersHash(ArrayList<FileContainer> fileContainers) {
StringBuilder block = new StringBuilder();
for(FileContainer container : fileContainers)
{
for (FileContainer container : fileContainers) {
block.append(container.name);
for(ClassNode node : container.classes)
{
for (ClassNode node : container.classes) {
block.append(node.name);
}
}

View file

@ -1,16 +1,13 @@
package the.bytecode.club.bytecodeviewer;
import java.io.File;
import me.konloch.kontainer.io.DiskWriter;
import org.apache.commons.cli.CommandLine;
import org.apache.commons.cli.CommandLineParser;
import org.apache.commons.cli.DefaultParser;
import org.apache.commons.cli.Options;
import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.tree.ClassNode;
import the.bytecode.club.bytecodeviewer.decompilers.Decompiler;
import the.bytecode.club.bytecodeviewer.util.JarUtils;
@ -72,7 +69,7 @@ public class CommandLineInput {
cmd.hasOption("o") ||
cmd.hasOption("t") ||
cmd.hasOption("nowait")
) {
) {
return true;
}
} catch (Exception e) {
@ -103,7 +100,8 @@ public class CommandLineInput {
"-decompiler <decompiler> Selects the decompiler, procyon by default",
"-i <input file> Selects the input file",
"-o <output file> Selects the output file",
"-t <target classname> Must either be the fully qualified classname or \"all\" to decompile all as zip",
"-t <target classname> Must either be the fully qualified classname or \"all\" to "
+ "decompile all as zip",
"-nowait Doesn't wait for the user to read the CLI messages"
})
System.out.println(s);
@ -149,8 +147,9 @@ public class CommandLineInput {
!decompiler.equalsIgnoreCase("krakatau-bytecode") &&
!decompiler.equalsIgnoreCase("jd-gui") &&
!decompiler.equalsIgnoreCase("smali")
) {
System.out.println("Error, no decompiler called '" + decompiler + "' found. Type -decompiler-list for the list");
) {
System.out.println("Error, no decompiler called '" + decompiler + "' found. Type -decompiler-list"
+ " for the list");
}
@ -175,7 +174,8 @@ public class CommandLineInput {
String target = cmd.getOptionValue("t");
if (cmd.getOptionValue("decompiler") == null) {
System.out.println("You can define another decompiler by appending -decompiler \"name\", by default procyon has been set.");
System.out.println("You can define another decompiler by appending -decompiler \"name\", by default "
+ "procyon has been set.");
decompiler = "procyon";
}
@ -183,7 +183,8 @@ public class CommandLineInput {
//if its zip/jar/apk/dex attempt unzip as whole zip
//if its just class allow any
File tempZip = new File(BytecodeViewer.tempDirectory + BytecodeViewer.fs + "temp_"+BytecodeViewer.getRandomizedName()+".jar");
File tempZip =
new File(BytecodeViewer.tempDirectory + BytecodeViewer.fs + "temp_" + BytecodeViewer.getRandomizedName() + ".jar");
if (tempZip.exists())
tempZip.delete();
@ -321,7 +322,8 @@ public class CommandLineInput {
}
System.out.println("Finished.");
System.out.println("Bytecode Viewer CLI v" + BytecodeViewer.VERSION + " by @Konloch - http://bytecodeviewer.com");
System.out.println("Bytecode Viewer CLI v" + BytecodeViewer.VERSION + " by @Konloch - "
+ "http://bytecodeviewer.com");
BytecodeViewer.canExit = true;
System.exit(0);
} catch (Exception e) {

File diff suppressed because one or more lines are too long

View file

@ -73,7 +73,7 @@ public class SecurityMan extends SecurityManager {
if (allow && !blocking) {
System.out.println("Allowing exec:" + cmd);
} else throw new SecurityException("BCV is awesome, blocking("+blocking+") exec " + cmd);
} else throw new SecurityException("BCV is awesome, blocking(" + blocking + ") exec " + cmd);
}
@Override
@ -123,9 +123,8 @@ public class SecurityMan extends SecurityManager {
@Override
public void checkExit(int status) {
if(!BytecodeViewer.canExit)
{
throw new SecurityException("BCV is awesome, blocking System.exit("+status+");");
if (!BytecodeViewer.canExit) {
throw new SecurityException("BCV is awesome, blocking System.exit(" + status + ");");
}
}

View file

@ -1,7 +1,6 @@
package the.bytecode.club.bytecodeviewer;
import javax.swing.JFrame;
import me.konloch.kontainer.io.DiskReader;
import me.konloch.kontainer.io.DiskWriter;
@ -34,86 +33,165 @@ public class Settings {
public static void saveSettings() {
try {
DiskWriter.replaceFile(BytecodeViewer.settingsName, "BCV: " + BytecodeViewer.VERSION, false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.rbr.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.rsy.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.din.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.dc4.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.das.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.hes.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.hdc.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.dgs.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.ner.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.den.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.rgn.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.bto.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.nns.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.uto.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.udv.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.rer.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.fdi.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.asc.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.decodeenumswitch.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.sugarenums.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.decodestringswitch.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.arrayiter.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.collectioniter.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.innerclasses.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.removeboilerplate.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.removeinnerclasssynthetics.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.decodelambdas.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.hidebridgemethods.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.liftconstructorinit.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.removedeadmethods.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.removebadgenerics.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.sugarasserts.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.sugarboxing.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.showversion.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.decodefinally.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.tidymonitors.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.lenient.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.dumpclasspath.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.comments.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.forcetopsort.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.forcetopsortaggress.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.stringbuffer.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.stringbuilder.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.silent.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.recover.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.eclipse.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.override.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.showinferrable.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.aexagg.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.forcecondpropagate.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.hideutf.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.hidelongstrings.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.commentmonitor.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.allowcorrecting.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.labelledblocks.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.j14classobj.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.hidelangimports.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.recoverytypeclash.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.recoverytypehints.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.forceturningifs.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.forloopaggcapture.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.forceexceptionprune.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.chckbxmntmShowDebugLine.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.chckbxmntmSimplifyMemberReferences.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.mnMergeVariables.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.chckbxmntmNewCheckItem_1.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.chckbxmntmNewCheckItem_2.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.chckbxmntmNewCheckItem_3.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.chckbxmntmNewCheckItem_4.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.chckbxmntmNewCheckItem_5.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.chckbxmntmNewCheckItem_6.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.chckbxmntmNewCheckItem_7.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.chckbxmntmNewCheckItem_8.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.chckbxmntmNewCheckItem_9.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.chckbxmntmNewCheckItem_10.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.chckbxmntmNewCheckItem_11.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.chckbxmntmAppendBrackets.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.debugHelpers.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.rbr.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.rsy.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.din.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.dc4.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.das.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.hes.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.hdc.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.dgs.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.ner.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.den.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.rgn.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.bto.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.nns.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.uto.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.udv.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.rer.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.fdi.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.asc.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.decodeenumswitch.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.sugarenums.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.decodestringswitch.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.arrayiter.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.collectioniter.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.innerclasses.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.removeboilerplate.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.removeinnerclasssynthetics.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.decodelambdas.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.hidebridgemethods.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.liftconstructorinit.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.removedeadmethods.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.removebadgenerics.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.sugarasserts.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.sugarboxing.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.showversion.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.decodefinally.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.tidymonitors.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.lenient.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.dumpclasspath.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.comments.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.forcetopsort.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.forcetopsortaggress.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.stringbuffer.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.stringbuilder.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.silent.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.recover.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.eclipse.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.override.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.showinferrable.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.aexagg.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.forcecondpropagate.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.hideutf.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.hidelongstrings.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.commentmonitor.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.allowcorrecting.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.labelledblocks.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.j14classobj.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.hidelangimports.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.recoverytypeclash.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.recoverytypehints.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.forceturningifs.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.forloopaggcapture.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.forceexceptionprune.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.chckbxmntmShowDebugLine.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.chckbxmntmSimplifyMemberReferences.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.mnMergeVariables.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.chckbxmntmNewCheckItem_1.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.chckbxmntmNewCheckItem_2.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.chckbxmntmNewCheckItem_3.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.chckbxmntmNewCheckItem_4.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.chckbxmntmNewCheckItem_5.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.chckbxmntmNewCheckItem_6.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.chckbxmntmNewCheckItem_7.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.chckbxmntmNewCheckItem_8.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.chckbxmntmNewCheckItem_9.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.chckbxmntmNewCheckItem_10.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.chckbxmntmNewCheckItem_11.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.chckbxmntmAppendBrackets.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.debugHelpers.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, "deprecated", false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.chckbxmntmNewCheckItem_12.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.chckbxmntmNewCheckItem_12.isSelected()), false);
if (BytecodeViewer.viewer.panelGroup1.isSelected(BytecodeViewer.viewer.panel1None.getModel()))
DiskWriter.writeNewLine(BytecodeViewer.settingsName, "0", false);
else if (BytecodeViewer.viewer.panelGroup1.isSelected(BytecodeViewer.viewer.panel1Proc.getModel()))
@ -189,36 +267,59 @@ public class Settings {
else if (BytecodeViewer.viewer.panelGroup3.isSelected(BytecodeViewer.viewer.asmText3.getModel()))
DiskWriter.writeNewLine(BytecodeViewer.settingsName, "11", false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.refreshOnChange.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.isMaximized), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.refreshOnChange.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.isMaximized),
false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, "deprecated", false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, "deprecated", false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, BytecodeViewer.lastDirectory, false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, BytecodeViewer.python, false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, BytecodeViewer.rt, false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.panel1Proc_E.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.panel1CFR_E.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.panel1Fern_E.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.panel1Krakatau_E.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.panel1Smali_E.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.panel2Proc_E.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.panel2CFR_E.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.panel2Fern_E.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.panel2Krakatau_E.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.panel2Smali_E.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.panel3Proc_E.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.panel3CFR_E.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.panel3Fern_E.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.panel3Krakatau_E.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.panel3Smali_E.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.decodeAPKResources.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.panel1Proc_E.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.panel1CFR_E.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.panel1Fern_E.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.panel1Krakatau_E.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.panel1Smali_E.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.panel2Proc_E.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.panel2CFR_E.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.panel2Fern_E.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.panel2Krakatau_E.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.panel2Smali_E.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.panel3Proc_E.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.panel3CFR_E.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.panel3Fern_E.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.panel3Krakatau_E.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.panel3Smali_E.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.decodeAPKResources.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, BytecodeViewer.library, false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.pingback), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.panel1JDGUI_E.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.panel2JDGUI_E.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.panel3JDGUI_E.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.fontSpinner.getValue()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.deleteForeignLibraries), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.panel1JDGUI_E.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.panel2JDGUI_E.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.panel3JDGUI_E.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.fontSpinner.getValue()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.deleteForeignLibraries), false);
if (BytecodeViewer.viewer.apkConversionGroup.isSelected(BytecodeViewer.viewer.apkConversionDex.getModel()))
DiskWriter.writeNewLine(BytecodeViewer.settingsName, "0", false);
else if (BytecodeViewer.viewer.apkConversionGroup.isSelected(BytecodeViewer.viewer.apkConversionEnjarify.getModel()))
@ -226,14 +327,21 @@ public class Settings {
DiskWriter.writeNewLine(BytecodeViewer.settingsName, BytecodeViewer.python3, false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, BytecodeViewer.javac, false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, BytecodeViewer.java, false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.compileOnSave.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.autoCompileOnRefresh.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.compileOnSave.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.autoCompileOnRefresh.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.warnForEditing), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.showFileInTabTitle.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.forcePureAsciiAsText.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.synchronizedViewing.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.showClassMethods.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.ren.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.showFileInTabTitle.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.forcePureAsciiAsText.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.synchronizedViewing.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.showClassMethods.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName,
String.valueOf(BytecodeViewer.viewer.ren.isSelected()), false);
} catch (Exception e) {
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e);
}
@ -339,7 +447,8 @@ public class Settings {
else if (decompiler == 7)
BytecodeViewer.viewer.panelGroup1.setSelected(BytecodeViewer.viewer.panel1Krakatau.getModel(), true);
else if (decompiler == 8)
BytecodeViewer.viewer.panelGroup1.setSelected(BytecodeViewer.viewer.panel1KrakatauBytecode.getModel(), true);
BytecodeViewer.viewer.panelGroup1.setSelected(BytecodeViewer.viewer.panel1KrakatauBytecode.getModel()
, true);
else if (decompiler == 9)
BytecodeViewer.viewer.panelGroup1.setSelected(BytecodeViewer.viewer.panel1JDGUI.getModel(), true);
else if (decompiler == 10)
@ -365,7 +474,8 @@ public class Settings {
else if (decompiler == 7)
BytecodeViewer.viewer.panelGroup2.setSelected(BytecodeViewer.viewer.panel2Krakatau.getModel(), true);
else if (decompiler == 8)
BytecodeViewer.viewer.panelGroup2.setSelected(BytecodeViewer.viewer.panel2KrakatauBytecode.getModel(), true);
BytecodeViewer.viewer.panelGroup2.setSelected(BytecodeViewer.viewer.panel2KrakatauBytecode.getModel()
, true);
else if (decompiler == 9)
BytecodeViewer.viewer.panelGroup2.setSelected(BytecodeViewer.viewer.panel2JDGUI.getModel(), true);
else if (decompiler == 10)
@ -391,7 +501,8 @@ public class Settings {
else if (decompiler == 7)
BytecodeViewer.viewer.panelGroup3.setSelected(BytecodeViewer.viewer.panel3Krakatau.getModel(), true);
else if (decompiler == 8)
BytecodeViewer.viewer.panelGroup3.setSelected(BytecodeViewer.viewer.panel3KrakatauBytecode.getModel(), true);
BytecodeViewer.viewer.panelGroup3.setSelected(BytecodeViewer.viewer.panel3KrakatauBytecode.getModel()
, true);
else if (decompiler == 9)
BytecodeViewer.viewer.panelGroup3.setSelected(BytecodeViewer.viewer.panel3JDGUI.getModel(), true);
else if (decompiler == 10)
@ -428,12 +539,14 @@ public class Settings {
BytecodeViewer.viewer.panel3Smali_E.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 105, false)));
BytecodeViewer.viewer.decodeAPKResources.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 106, false)));
BytecodeViewer.library = DiskReader.loadString(BytecodeViewer.settingsName, 107, false);
BytecodeViewer.pingback = Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 108, false));
BytecodeViewer.pingback = Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 108,
false));
BytecodeViewer.viewer.panel1JDGUI_E.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 109, false)));
BytecodeViewer.viewer.panel2JDGUI_E.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 110, false)));
BytecodeViewer.viewer.panel3JDGUI_E.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 111, false)));
BytecodeViewer.viewer.fontSpinner.setValue(Integer.parseInt(DiskReader.loadString(BytecodeViewer.settingsName, 112, false)));
BytecodeViewer.deleteForeignLibraries = Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 113, false));
BytecodeViewer.deleteForeignLibraries =
Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 113, false));
decompiler = Integer.parseInt(DiskReader.loadString(BytecodeViewer.settingsName, 114, false));
if (decompiler == 0)
BytecodeViewer.viewer.apkConversionGroup.setSelected(BytecodeViewer.viewer.apkConversionDex.getModel(), true);
@ -444,7 +557,8 @@ public class Settings {
BytecodeViewer.java = DiskReader.loadString(BytecodeViewer.settingsName, 117, false);
BytecodeViewer.viewer.compileOnSave.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 118, false)));
BytecodeViewer.viewer.autoCompileOnRefresh.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 119, false)));
BytecodeViewer.warnForEditing = Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 120, false));
BytecodeViewer.warnForEditing = Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName,
120, false));
BytecodeViewer.viewer.showFileInTabTitle.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 121, false)));
BytecodeViewer.displayParentInTab = BytecodeViewer.viewer.showFileInTabTitle.isSelected();
BytecodeViewer.viewer.forcePureAsciiAsText.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 122, false)));

View file

@ -1,7 +1,6 @@
package the.bytecode.club.bytecodeviewer.api;
import java.util.List;
import org.objectweb.asm.tree.AbstractInsnNode;
import org.objectweb.asm.tree.ClassNode;
import org.objectweb.asm.tree.FieldInsnNode;
@ -11,7 +10,6 @@ import org.objectweb.asm.tree.LocalVariableNode;
import org.objectweb.asm.tree.MethodInsnNode;
import org.objectweb.asm.tree.MethodNode;
import org.objectweb.asm.tree.TypeInsnNode;
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
/***************************************************************************
@ -146,7 +144,7 @@ public final class ASMUtil_OLD {
MethodNode m = (MethodNode) o;
if (m.localVariables != null) {
for (LocalVariableNode node : (List<LocalVariableNode>) m.localVariables) {
for (LocalVariableNode node : m.localVariables) {
node.desc = node.desc.replace(oldName, newName);
}
}

View file

@ -8,12 +8,10 @@ import java.util.Enumeration;
import java.util.List;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
import org.objectweb.asm.tree.ClassNode;
import the.bytecode.club.bytecodeviewer.util.JarUtils;
import the.bytecode.club.bytecodeviewer.decompilers.Decompiler;
import the.bytecode.club.bytecodeviewer.plugin.preinstalled.EZInjection;
import the.bytecode.club.bytecodeviewer.util.JarUtils;
/***************************************************************************
* Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite *
@ -82,7 +80,7 @@ public class BytecodeViewer {
List<Class<?>> ret = new ArrayList<Class<?>>();
while (e.hasMoreElements()) {
JarEntry je = (JarEntry) e.nextElement();
JarEntry je = e.nextElement();
if (je.isDirectory() || !je.getName().endsWith(".class"))
continue;
String className = je.getName().replace("/", ".").replace(".class", "");

View file

@ -8,7 +8,6 @@ import java.security.cert.Certificate;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.tree.ClassNode;
@ -36,7 +35,7 @@ import org.objectweb.asm.tree.ClassNode;
public final class ClassNodeLoader extends ClassLoader {
private HashMap<String, ClassNode> classes = new HashMap<String, ClassNode>();
private final HashMap<String, ClassNode> classes = new HashMap<String, ClassNode>();
/**
* Adds the provided class node to the class loader

View file

@ -5,11 +5,9 @@ import java.awt.Color;
import java.awt.Dimension;
import java.io.PrintWriter;
import java.io.StringWriter;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
import the.bytecode.club.bytecodeviewer.Resources;
@ -93,7 +91,7 @@ public class ExceptionUI extends JFrame {
", Fat Jar: " + BytecodeViewer.FAT_JAR +
", OS: " + System.getProperty("os.name") +
", Java: " + System.getProperty("java.version") +
BytecodeViewer.nl + BytecodeViewer.nl + sw.toString());
BytecodeViewer.nl + BytecodeViewer.nl + sw);
this.setLocationRelativeTo(null);
this.setVisible(true);
}

View file

@ -1,9 +1,7 @@
package the.bytecode.club.bytecodeviewer.api;
import java.util.ArrayList;
import org.objectweb.asm.tree.ClassNode;
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
/***************************************************************************

View file

@ -1,30 +1,24 @@
package the.bytecode.club.bytecodeviewer.api;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JFrame;
import javax.swing.JTextField;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import javax.swing.JScrollPane;
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import javax.swing.JTextArea;
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
import the.bytecode.club.bytecodeviewer.Resources;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.text.DefaultHighlighter;
import javax.swing.text.Highlighter;
import javax.swing.text.JTextComponent;
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
import the.bytecode.club.bytecodeviewer.Resources;
/***************************************************************************
* Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite *
@ -219,7 +213,7 @@ public class PluginConsole extends JFrame {
}
}
private DefaultHighlighter.DefaultHighlightPainter painter = new DefaultHighlighter.DefaultHighlightPainter(
private final DefaultHighlighter.DefaultHighlightPainter painter = new DefaultHighlighter.DefaultHighlightPainter(
new Color(255, 62, 150));
public void highlight(JTextComponent textComp, String pattern) {

View file

@ -5,7 +5,6 @@ import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import me.konloch.kontainer.io.DiskWriter;
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
import the.bytecode.club.bytecodeviewer.util.JarUtils;
@ -39,12 +38,17 @@ public class JavaCompiler extends Compiler {
@Override
public byte[] compile(String contents, String name) {
String fileStart = BytecodeViewer.tempDirectory + BytecodeViewer.fs + "temp" + MiscUtils.randomString(12) + BytecodeViewer.fs;
String fileStart2 = BytecodeViewer.tempDirectory + BytecodeViewer.fs + "temp" + MiscUtils.randomString(12) + BytecodeViewer.fs;
String fileStart =
BytecodeViewer.tempDirectory + BytecodeViewer.fs + "temp" + MiscUtils.randomString(12) + BytecodeViewer.fs;
String fileStart2 =
BytecodeViewer.tempDirectory + BytecodeViewer.fs + "temp" + MiscUtils.randomString(12) + BytecodeViewer.fs;
File java = new File(fileStart + BytecodeViewer.fs + name + ".java");
File clazz = new File(fileStart2 + BytecodeViewer.fs + name + ".class");
File cp = new File(BytecodeViewer.tempDirectory + BytecodeViewer.fs + "cpath_" + MiscUtils.randomString(12) + ".jar");
File tempD = new File(fileStart + BytecodeViewer.fs + name.substring(0, name.length() - name.split("/")[name.split("/").length - 1].length()));
File cp =
new File(BytecodeViewer.tempDirectory + BytecodeViewer.fs + "cpath_" + MiscUtils.randomString(12) +
".jar");
File tempD = new File(fileStart + BytecodeViewer.fs + name.substring(0,
name.length() - name.split("/")[name.split("/").length - 1].length()));
tempD.mkdirs();
new File(fileStart2).mkdirs();
@ -78,7 +82,8 @@ public class JavaCompiler extends Compiler {
pb = new ProcessBuilder(
BytecodeViewer.javac,
"-d", fileStart2,
"-classpath", cp.getAbsolutePath() + System.getProperty("path.separator") + BytecodeViewer.library,
"-classpath",
cp.getAbsolutePath() + System.getProperty("path.separator") + BytecodeViewer.library,
java.getAbsolutePath()
);
}
@ -86,26 +91,19 @@ public class JavaCompiler extends Compiler {
Process process = pb.start();
BytecodeViewer.createdProcesses.add(process);
Thread failSafe = new Thread()
{
Thread failSafe = new Thread() {
@Override
public void run()
{
public void run() {
long started = System.currentTimeMillis();
while(System.currentTimeMillis()-started <= 10_000)
{
try
{
while (System.currentTimeMillis() - started <= 10_000) {
try {
Thread.sleep(100);
}
catch (InterruptedException e)
{
} catch (InterruptedException e) {
e.printStackTrace();
}
}
if(process.isAlive())
{
if (process.isAlive()) {
System.out.println("Force killing javac process, assuming it's gotten stuck");
process.destroyForcibly().destroy();
}
@ -120,8 +118,7 @@ public class JavaCompiler extends Compiler {
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
String line;
while ((line = br.readLine()) != null)
{
while ((line = br.readLine()) != null) {
log += BytecodeViewer.nl + line;
}
br.close();

View file

@ -4,7 +4,6 @@ import java.io.BufferedReader;
import java.io.File;
import java.io.InputStream;
import java.io.InputStreamReader;
import me.konloch.kontainer.io.DiskWriter;
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
import the.bytecode.club.bytecodeviewer.util.JarUtils;
@ -30,87 +29,90 @@ import the.bytecode.club.bytecodeviewer.util.MiscUtils;
/**
* Krakatau Java assembler, requires Python 2.7
*
* @author Konloch
*
* @author Konloch
*/
public class KrakatauAssembler extends Compiler {
@Override
public byte[] compile(String contents, String name) {
if(BytecodeViewer.python.equals("")) {
BytecodeViewer.showMessage("You need to set your Python (or PyPy for speed) 2.7 executable path.");
BytecodeViewer.viewer.pythonC();
}
if(BytecodeViewer.python.equals("")) {
BytecodeViewer.showMessage("You need to set Python!");
return null;
}
@Override
public byte[] compile(String contents, String name) {
if (BytecodeViewer.python.equals("")) {
BytecodeViewer.showMessage("You need to set your Python (or PyPy for speed) 2.7 executable path.");
BytecodeViewer.viewer.pythonC();
}
String origName = name;
name = MiscUtils.randomString(20);
if (BytecodeViewer.python.equals("")) {
BytecodeViewer.showMessage("You need to set Python!");
return null;
}
File tempD = new File(BytecodeViewer.tempDirectory + BytecodeViewer.fs + MiscUtils.randomString(32) + BytecodeViewer.fs);
tempD.mkdir();
File tempJ = new File(tempD.getAbsolutePath() + BytecodeViewer.fs+name+".j");
DiskWriter.replaceFile(tempJ.getAbsolutePath(), contents, true);
final File tempDirectory = new File(BytecodeViewer.tempDirectory + BytecodeViewer.fs + MiscUtils.randomString(32) + BytecodeViewer.fs);
tempDirectory.mkdir();
final File tempJar = new File(BytecodeViewer.tempDirectory + BytecodeViewer.fs + "temp"+MiscUtils.randomString(32)+".jar");
JarUtils.saveAsJar(BytecodeViewer.getLoadedClasses(), tempJar.getAbsolutePath());
BytecodeViewer.sm.stopBlocking();
String origName = name;
name = MiscUtils.randomString(20);
File tempD =
new File(BytecodeViewer.tempDirectory + BytecodeViewer.fs + MiscUtils.randomString(32) + BytecodeViewer.fs);
tempD.mkdir();
File tempJ = new File(tempD.getAbsolutePath() + BytecodeViewer.fs + name + ".j");
DiskWriter.replaceFile(tempJ.getAbsolutePath(), contents, true);
final File tempDirectory =
new File(BytecodeViewer.tempDirectory + BytecodeViewer.fs + MiscUtils.randomString(32) + BytecodeViewer.fs);
tempDirectory.mkdir();
final File tempJar =
new File(BytecodeViewer.tempDirectory + BytecodeViewer.fs + "temp" + MiscUtils.randomString(32) +
".jar");
JarUtils.saveAsJar(BytecodeViewer.getLoadedClasses(), tempJar.getAbsolutePath());
BytecodeViewer.sm.stopBlocking();
String log = "";
try {
ProcessBuilder pb = new ProcessBuilder(
BytecodeViewer.python,
"-O", //love you storyyeller <3
BytecodeViewer.krakatauWorkingDirectory + BytecodeViewer.fs + "assemble.py",
"-out",
tempDirectory.getAbsolutePath(),
tempJ.getAbsolutePath()
);
try {
ProcessBuilder pb = new ProcessBuilder(
BytecodeViewer.python,
"-O", //love you storyyeller <3
BytecodeViewer.krakatauWorkingDirectory + BytecodeViewer.fs + "assemble.py",
"-out",
tempDirectory.getAbsolutePath(),
tempJ.getAbsolutePath()
);
Process process = pb.start();
BytecodeViewer.createdProcesses.add(process);
//Read out dir output
InputStream is = process.getInputStream();
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
String line;
while ((line = br.readLine()) != null) {
log += BytecodeViewer.nl + line;
}
br.close();
log += BytecodeViewer.nl+BytecodeViewer.nl+"Error:"+BytecodeViewer.nl+BytecodeViewer.nl;
is = process.getErrorStream();
isr = new InputStreamReader(is);
br = new BufferedReader(isr);
while ((line = br.readLine()) != null) {
log += BytecodeViewer.nl + line;
}
br.close();
int exitValue = process.waitFor();
log += BytecodeViewer.nl+BytecodeViewer.nl+"Exit Value is " + exitValue;
System.out.println(log);
Process process = pb.start();
BytecodeViewer.createdProcesses.add(process);
byte[] b = org.apache.commons.io.FileUtils.readFileToByteArray(new File(tempDirectory.getAbsolutePath() + BytecodeViewer.fs + origName + ".class"));
tempDirectory.delete();
tempJar.delete();
return b;
} catch(Exception e) {
e.printStackTrace();
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(log);
} finally {
BytecodeViewer.sm.setBlocking();
}
return null;
}
//Read out dir output
InputStream is = process.getInputStream();
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
String line;
while ((line = br.readLine()) != null) {
log += BytecodeViewer.nl + line;
}
br.close();
log += BytecodeViewer.nl + BytecodeViewer.nl + "Error:" + BytecodeViewer.nl + BytecodeViewer.nl;
is = process.getErrorStream();
isr = new InputStreamReader(is);
br = new BufferedReader(isr);
while ((line = br.readLine()) != null) {
log += BytecodeViewer.nl + line;
}
br.close();
int exitValue = process.waitFor();
log += BytecodeViewer.nl + BytecodeViewer.nl + "Exit Value is " + exitValue;
System.out.println(log);
byte[] b = org.apache.commons.io.FileUtils.readFileToByteArray(new File(tempDirectory.getAbsolutePath() + BytecodeViewer.fs + origName + ".class"));
tempDirectory.delete();
tempJar.delete();
return b;
} catch (Exception e) {
e.printStackTrace();
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(log);
} finally {
BytecodeViewer.sm.setBlocking();
}
return null;
}
}

View file

@ -1,7 +1,6 @@
package the.bytecode.club.bytecodeviewer.compilers;
import java.io.File;
import me.konloch.kontainer.io.DiskWriter;
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
import the.bytecode.club.bytecodeviewer.util.Dex2Jar;
@ -55,7 +54,8 @@ public class SmaliAssembler extends Compiler {
}
try {
com.googlecode.d2j.smali.SmaliCmd.main(new String[]{tempSmaliFolder.getAbsolutePath()});//, "-o", tempDex.getAbsolutePath()});
com.googlecode.d2j.smali.SmaliCmd.main(new String[]{tempSmaliFolder.getAbsolutePath()});//, "-o", tempDex
// .getAbsolutePath()});
} catch (Exception e) {
e.printStackTrace();
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e);

View file

@ -1,11 +1,10 @@
package the.bytecode.club.bytecodeviewer.decompilers;
import org.objectweb.asm.tree.ClassNode;
import org.objectweb.asm.util.Textifier;
import org.objectweb.asm.util.TraceClassVisitor;
import java.io.PrintWriter;
import java.io.StringWriter;
import org.objectweb.asm.tree.ClassNode;
import org.objectweb.asm.util.Textifier;
import org.objectweb.asm.util.TraceClassVisitor;
/***************************************************************************
* Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite *
@ -31,15 +30,15 @@ import java.io.StringWriter;
* @author Thiakil
*/
public class ASMTextifierDecompiler extends Decompiler {
@Override
public String decompileClassNode(ClassNode cn, byte[] b) {
StringWriter writer = new StringWriter();
cn.accept(new TraceClassVisitor(null, new Textifier(), new PrintWriter(writer)));
return writer.toString();
}
@Override
public String decompileClassNode(ClassNode cn, byte[] b) {
StringWriter writer = new StringWriter();
cn.accept(new TraceClassVisitor(null, new Textifier(), new PrintWriter(writer)));
return writer.toString();
}
@Override
public void decompileToZip(String sourceJar, String zipName) {
@Override
public void decompileToZip(String sourceJar, String zipName) {
}
}
}

View file

@ -14,11 +14,8 @@ import java.util.LinkedList;
import java.util.Random;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
import me.konloch.kontainer.io.DiskReader;
import org.objectweb.asm.tree.ClassNode;
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
import the.bytecode.club.bytecodeviewer.util.MiscUtils;
@ -50,36 +47,33 @@ public class CFRDecompiler extends Decompiler {
private static final String[] WINDOWS_IS_GREAT = new String[]
{
"CON",
"PRN",
"AUX",
"NUL",
"COM1",
"COM2",
"COM3",
"COM4",
"COM5",
"COM6",
"COM7",
"COM8",
"COM9",
"LPT1",
"LPT2",
"LPT3",
"LPT4",
"LPT5",
"LPT6",
"LPT7",
"LPT8",
"LPT9"
"CON",
"PRN",
"AUX",
"NUL",
"COM1",
"COM2",
"COM3",
"COM4",
"COM5",
"COM6",
"COM7",
"COM8",
"COM9",
"LPT1",
"LPT2",
"LPT3",
"LPT4",
"LPT5",
"LPT6",
"LPT7",
"LPT8",
"LPT9"
};
public static String windowsFun(String base)
{
for(String s : WINDOWS_IS_GREAT)
{
if(base.contains(s.toLowerCase()))
{
public static String windowsFun(String base) {
for (String s : WINDOWS_IS_GREAT) {
if (base.contains(s.toLowerCase())) {
base = base.replace(s.toLowerCase(), "BCV");
}
}
@ -126,23 +120,21 @@ public class CFRDecompiler extends Decompiler {
org.benf.cfr.reader.Main.main(generateMainMethod(tempClass.getAbsolutePath(), fuckery));
}*/
try
{
try {
org.benf.cfr.reader.Main.main(generateMainMethod(tempClass.getAbsolutePath(), fuckery));
}
catch(StackOverflowError | Exception e)
{
} catch (StackOverflowError | Exception e) {
StringWriter sw = new StringWriter();
e.printStackTrace(new PrintWriter(sw));
e.printStackTrace();
exception = "Bytecode Viewer Version: " + BytecodeViewer.VERSION + BytecodeViewer.nl + BytecodeViewer.nl + sw.toString();
exception =
"Bytecode Viewer Version: " + BytecodeViewer.VERSION + BytecodeViewer.nl + BytecodeViewer.nl + sw;
}
tempClass.delete();
File file = new File(fuckery);
if(file.exists())
if (file.exists())
return findFile(file.listFiles());
return "CFR error! Send the stacktrace to Konloch at http://the.bytecode.club or konloch@gmail.com" + BytecodeViewer.nl + BytecodeViewer.nl + "Suggested Fix: Click refresh class, if it fails again try another decompiler." + BytecodeViewer.nl + BytecodeViewer.nl + exception;
@ -175,13 +167,17 @@ public class CFRDecompiler extends Decompiler {
e.printStackTrace(new PrintWriter(sw));
e.printStackTrace();
String exception = "Bytecode Viewer Version: " + BytecodeViewer.VERSION + BytecodeViewer.nl + BytecodeViewer.nl + sw.toString();
return "CFR error! Send the stacktrace to Konloch at http://the.bytecode.club or konloch@gmail.com" + BytecodeViewer.nl + BytecodeViewer.nl + "Suggested Fix: Click refresh class, if it fails again try another decompiler." + BytecodeViewer.nl + BytecodeViewer.nl + exception;
String exception =
"Bytecode Viewer Version: " + BytecodeViewer.VERSION + BytecodeViewer.nl + BytecodeViewer.nl + sw;
return "CFR error! Send the stacktrace to Konloch at http://the.bytecode.club or konloch@gmail"
+ ".com" + BytecodeViewer.nl + BytecodeViewer.nl + "Suggested Fix: Click refresh class, "
+ "if it fails again try another decompiler." + BytecodeViewer.nl + BytecodeViewer.nl + exception;
}
return s;
}
}
return "CFR error!" + BytecodeViewer.nl + BytecodeViewer.nl + "Suggested Fix: Click refresh class, if it fails again try another decompiler.";
return "CFR error!" + BytecodeViewer.nl + BytecodeViewer.nl + "Suggested Fix: Click refresh class, if it "
+ "fails again try another decompiler.";
}
public String[] generateMainMethod(String filePath, String outputPath) {
@ -301,8 +297,7 @@ public class CFRDecompiler extends Decompiler {
byte[] buffer = new byte[1024];
@Override
public void decompileToZip(String sourceJar, String zipName)
{
public void decompileToZip(String sourceJar, String zipName) {
File tempZip = new File(sourceJar);
String fileStart = BytecodeViewer.tempDirectory + BytecodeViewer.fs;

View file

@ -1,7 +1,6 @@
package the.bytecode.club.bytecodeviewer.decompilers;
import org.objectweb.asm.tree.ClassNode;
import the.bytecode.club.bytecodeviewer.decompilers.bytecode.ClassNodeDecompiler;
/***************************************************************************

View file

@ -5,15 +5,12 @@ import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;
import me.konloch.kontainer.io.DiskReader;
import org.apache.commons.lang3.ArrayUtils;
import org.objectweb.asm.tree.ClassNode;
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
import the.bytecode.club.bytecodeviewer.util.MiscUtils;
import the.bytecode.club.bytecodeviewer.Resources;
import the.bytecode.club.bytecodeviewer.util.MiscUtils;
/***************************************************************************
* Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite *
@ -49,16 +46,14 @@ public class FernFlowerDecompiler extends Decompiler {
File f = new File(BytecodeViewer.tempDirectory + BytecodeViewer.fs + "temp" + BytecodeViewer.fs);
f.mkdir();
try
{
try {
org.jetbrains.java.decompiler.main.decompiler.ConsoleDecompiler.main(generateMainMethod(tempZip.getAbsolutePath(), BytecodeViewer.tempDirectory + "./temp/"));
}
catch(StackOverflowError | Exception e)
{
} catch (StackOverflowError | Exception e) {
}
File tempZip2 = new File(BytecodeViewer.tempDirectory + BytecodeViewer.fs + "temp" + BytecodeViewer.fs + tempZip.getName());
File tempZip2 =
new File(BytecodeViewer.tempDirectory + BytecodeViewer.fs + "temp" + BytecodeViewer.fs + tempZip.getName());
if (tempZip2.exists())
tempZip2.renameTo(new File(zipName));
@ -67,7 +62,7 @@ public class FernFlowerDecompiler extends Decompiler {
@Override
public String decompileClassNode(final ClassNode cn, byte[] b) {
String start = BytecodeViewer.tempDirectory + BytecodeViewer.fs+MiscUtils.getUniqueName("", ".class");
String start = BytecodeViewer.tempDirectory + BytecodeViewer.fs + MiscUtils.getUniqueName("", ".class");
final File tempClass = new File(start + ".class");
@ -83,7 +78,8 @@ public class FernFlowerDecompiler extends Decompiler {
e.printStackTrace(new PrintWriter(sw));
e.printStackTrace();
exception = "Bytecode Viewer Version: " + BytecodeViewer.VERSION + BytecodeViewer.nl + BytecodeViewer.nl + sw.toString();
exception =
"Bytecode Viewer Version: " + BytecodeViewer.VERSION + BytecodeViewer.nl + BytecodeViewer.nl + sw;
}
@ -91,7 +87,8 @@ public class FernFlowerDecompiler extends Decompiler {
try {
ProcessBuilder pb = new ProcessBuilder(ArrayUtils.addAll(
new String[]{BytecodeViewer.getJavaCommand(), "-jar", Resources.findLibrary("fernflower")},
generateMainMethod(tempClass.getAbsolutePath(), new File(BytecodeViewer.tempDirectory).getAbsolutePath())
generateMainMethod(tempClass.getAbsolutePath(),
new File(BytecodeViewer.tempDirectory).getAbsolutePath())
));
BytecodeViewer.sm.stopBlocking();
Process p = pb.start();
@ -102,21 +99,17 @@ public class FernFlowerDecompiler extends Decompiler {
} finally {
BytecodeViewer.sm.setBlocking();
}
}
else
{
try
{
} else {
try {
org.jetbrains.java.decompiler.main.decompiler.ConsoleDecompiler.main(generateMainMethod(tempClass.getAbsolutePath(),
new File(BytecodeViewer.tempDirectory).getAbsolutePath()));
}
catch(StackOverflowError | Exception e)
{
} catch (StackOverflowError | Exception e) {
StringWriter sw = new StringWriter();
e.printStackTrace(new PrintWriter(sw));
e.printStackTrace();
exception = "Bytecode Viewer Version: " + BytecodeViewer.VERSION + BytecodeViewer.nl + BytecodeViewer.nl + sw.toString();
exception =
"Bytecode Viewer Version: " + BytecodeViewer.VERSION + BytecodeViewer.nl + BytecodeViewer.nl + sw;
}
}
@ -136,7 +129,7 @@ public class FernFlowerDecompiler extends Decompiler {
e.printStackTrace(new PrintWriter(sw));
e.printStackTrace();
exception += BytecodeViewer.nl + BytecodeViewer.nl + sw.toString();
exception += BytecodeViewer.nl + BytecodeViewer.nl + sw;
}
}
return "FernFlower error! Send the stacktrace to Konloch at http://the.bytecode.club or konloch@gmail.com" + BytecodeViewer.nl + BytecodeViewer.nl + "Suggested Fix: Click refresh class, if it fails again try another decompiler." + BytecodeViewer.nl + BytecodeViewer.nl + exception;

View file

@ -2,18 +2,17 @@ package the.bytecode.club.bytecodeviewer.decompilers;
import jadx.api.JadxArgs;
import jadx.api.JadxDecompiler;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.Random;
import me.konloch.kontainer.io.DiskReader;
import org.objectweb.asm.tree.ClassNode;
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
import the.bytecode.club.bytecodeviewer.util.MiscUtils;
import java.io.*;
import java.util.Deque;
import java.util.LinkedList;
import java.util.Random;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
/***************************************************************************
* Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite *
* Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com *
@ -38,8 +37,7 @@ import java.util.zip.ZipOutputStream;
* @author Konloch
*/
public class JADXDecompiler extends Decompiler
{
public class JADXDecompiler extends Decompiler {
@Override
public String decompileClassNode(ClassNode cn, byte[] b) {
String fileStart = BytecodeViewer.tempDirectory + BytecodeViewer.fs;
@ -58,8 +56,7 @@ public class JADXDecompiler extends Decompiler
}
File fuckery = new File(fuckery(fileStart));
try
{
try {
JadxArgs args = new JadxArgs();
args.getInputFiles().add(tempClass);
args.setOutDir(fuckery);
@ -67,19 +64,18 @@ public class JADXDecompiler extends Decompiler
JadxDecompiler jadx = new JadxDecompiler(args);
jadx.load();
jadx.save();
}
catch(StackOverflowError | Exception e)
{
} catch (StackOverflowError | Exception e) {
StringWriter sw = new StringWriter();
e.printStackTrace(new PrintWriter(sw));
e.printStackTrace();
exception = "Bytecode Viewer Version: " + BytecodeViewer.VERSION + BytecodeViewer.nl + BytecodeViewer.nl + sw.toString();
exception =
"Bytecode Viewer Version: " + BytecodeViewer.VERSION + BytecodeViewer.nl + BytecodeViewer.nl + sw;
}
tempClass.delete();
if(fuckery.exists())
if (fuckery.exists())
return findFile(fuckery.listFiles());
return "JADX error! Send the stacktrace to Konloch at http://the.bytecode.club or konloch@gmail.com" + BytecodeViewer.nl + BytecodeViewer.nl + "Suggested Fix: Click refresh class, if it fails again try another decompiler." + BytecodeViewer.nl + BytecodeViewer.nl + exception;
@ -114,18 +110,21 @@ public class JADXDecompiler extends Decompiler
e.printStackTrace(new PrintWriter(sw));
e.printStackTrace();
String exception = "Bytecode Viewer Version: " + BytecodeViewer.VERSION + BytecodeViewer.nl + BytecodeViewer.nl + sw.toString();
return "JADX error! Send the stacktrace to Konloch at http://the.bytecode.club or konloch@gmail.com" + BytecodeViewer.nl + BytecodeViewer.nl + "Suggested Fix: Click refresh class, if it fails again try another decompiler." + BytecodeViewer.nl + BytecodeViewer.nl + exception;
String exception =
"Bytecode Viewer Version: " + BytecodeViewer.VERSION + BytecodeViewer.nl + BytecodeViewer.nl + sw;
return "JADX error! Send the stacktrace to Konloch at http://the.bytecode.club or konloch@gmail"
+ ".com" + BytecodeViewer.nl + BytecodeViewer.nl + "Suggested Fix: Click refresh class, "
+ "if it fails again try another decompiler." + BytecodeViewer.nl + BytecodeViewer.nl + exception;
}
return s;
}
}
return "CFR error!" + BytecodeViewer.nl + BytecodeViewer.nl + "Suggested Fix: Click refresh class, if it fails again try another decompiler.";
return "CFR error!" + BytecodeViewer.nl + BytecodeViewer.nl + "Suggested Fix: Click refresh class, if it "
+ "fails again try another decompiler.";
}
@Override
public void decompileToZip(String sourceJar, String zipName)
{
public void decompileToZip(String sourceJar, String zipName) {
}
}

View file

@ -6,18 +6,15 @@ import java.io.IOException;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.io.StringWriter;
import jd.cli.loader.DirectoryLoader;
import jd.cli.preferences.CommonPreferences;
import jd.cli.printer.text.PlainTextPrinter;
import jd.cli.util.ClassFileUtil;
import jd.core.process.DecompilerImpl;
import me.konloch.kontainer.io.DiskReader;
import org.objectweb.asm.tree.ClassNode;
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
import the.bytecode.club.bytecodeviewer.util.MiscUtils;
import jd.cli.printer.text.PlainTextPrinter;
/***************************************************************************
* Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite *
@ -50,7 +47,8 @@ public class JDGUIDecompiler extends Decompiler {
public String decompileClassNode(ClassNode cn, byte[] b) {
String exception = "";
try {
final File tempDirectory = new File(BytecodeViewer.tempDirectory + BytecodeViewer.fs + MiscUtils.randomString(32) + BytecodeViewer.fs);
final File tempDirectory =
new File(BytecodeViewer.tempDirectory + BytecodeViewer.fs + MiscUtils.randomString(32) + BytecodeViewer.fs);
tempDirectory.mkdir();
final File tempClass = new File(tempDirectory.getAbsolutePath() + BytecodeViewer.fs + cn.name + ".class");
final File tempJava = new File(tempDirectory.getAbsolutePath() + BytecodeViewer.fs + cn.name + ".java");
@ -76,7 +74,8 @@ public class JDGUIDecompiler extends Decompiler {
}
String pathToClass = tempClass.getAbsolutePath().replace('/', File.separatorChar).replace('\\', File.separatorChar);
String pathToClass = tempClass.getAbsolutePath().replace('/', File.separatorChar).replace('\\',
File.separatorChar);
String directoryPath = ClassFileUtil.ExtractDirectoryPath(pathToClass);
String internalPath = ClassFileUtil.ExtractInternalPath(directoryPath, pathToClass);
@ -112,7 +111,8 @@ public class JDGUIDecompiler extends Decompiler {
e.printStackTrace(new PrintWriter(sw));
e.printStackTrace();
exception = "Bytecode Viewer Version: " + BytecodeViewer.VERSION + BytecodeViewer.nl + BytecodeViewer.nl + sw.toString();
exception =
"Bytecode Viewer Version: " + BytecodeViewer.VERSION + BytecodeViewer.nl + BytecodeViewer.nl + sw;
}
return "JD-GUI error! Send the stacktrace to Konloch at http://the.bytecode.club or konloch@gmail.com" + BytecodeViewer.nl + BytecodeViewer.nl + "Suggested Fix: Click refresh class, if it fails again try another decompiler." + BytecodeViewer.nl + BytecodeViewer.nl + exception;
}

View file

@ -6,11 +6,8 @@ import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.io.StringWriter;
import me.konloch.kontainer.io.DiskReader;
import org.objectweb.asm.tree.ClassNode;
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
import the.bytecode.club.bytecodeviewer.util.JarUtils;
import the.bytecode.club.bytecodeviewer.util.MiscUtils;
@ -49,8 +46,7 @@ public class KrakatauDecompiler extends Decompiler {
return ";" + BytecodeViewer.library;
}
public String decompileClassNode(File krakatauTempJar, File krakatauTempDir, ClassNode cn, byte[] b)
{
public String decompileClassNode(File krakatauTempJar, File krakatauTempDir, ClassNode cn, byte[] b) {
if (BytecodeViewer.python.equals("")) {
BytecodeViewer.showMessage("You need to set your Python (or PyPy for speed) 2.7 executable path.");
BytecodeViewer.viewer.pythonC();
@ -58,7 +54,8 @@ public class KrakatauDecompiler extends Decompiler {
BytecodeViewer.rtCheck();
if (BytecodeViewer.rt.equals("")) {
BytecodeViewer.showMessage("You need to set your JRE RT Library.\r\n(C:\\Program Files (x86)\\Java\\jre7\\lib\\rt.jar)");
BytecodeViewer.showMessage("You need to set your JRE RT Library.\r\n(C:\\Program Files (x86)"
+ "\\Java\\jre7\\lib\\rt.jar)");
BytecodeViewer.viewer.rtC();
}
@ -72,7 +69,8 @@ public class KrakatauDecompiler extends Decompiler {
return "Set your paths";
}
String s = "Bytecode Viewer Version: " + BytecodeViewer.VERSION + BytecodeViewer.nl + BytecodeViewer.nl + "Please send this to konloch@gmail.com. " + BytecodeViewer.nl + BytecodeViewer.nl;
String s = "Bytecode Viewer Version: " + BytecodeViewer.VERSION + BytecodeViewer.nl + BytecodeViewer.nl +
"Please send this to konloch@gmail.com. " + BytecodeViewer.nl + BytecodeViewer.nl;
BytecodeViewer.sm.stopBlocking();
try {
@ -122,7 +120,7 @@ public class KrakatauDecompiler extends Decompiler {
StringWriter sw = new StringWriter();
e.printStackTrace(new PrintWriter(sw));
e.printStackTrace();
s += BytecodeViewer.nl + "Bytecode Viewer Version: " + BytecodeViewer.VERSION + BytecodeViewer.nl + BytecodeViewer.nl + sw.toString();
s += BytecodeViewer.nl + "Bytecode Viewer Version: " + BytecodeViewer.VERSION + BytecodeViewer.nl + BytecodeViewer.nl + sw;
} finally {
BytecodeViewer.sm.setBlocking();
}
@ -131,14 +129,14 @@ public class KrakatauDecompiler extends Decompiler {
}
@Override
public String decompileClassNode(ClassNode cn, byte[] b)
{
public String decompileClassNode(ClassNode cn, byte[] b) {
if (BytecodeViewer.python.equals("")) {
BytecodeViewer.showMessage("You need to set your Python (or PyPy for speed) 2.7 executable path.");
BytecodeViewer.viewer.pythonC();
}
if (BytecodeViewer.rt.equals("")) {
BytecodeViewer.showMessage("You need to set your JRE RT Library.\r\n(C:\\Program Files (x86)\\Java\\jre7\\lib\\rt.jar)");
BytecodeViewer.showMessage("You need to set your JRE RT Library.\r\n(C:\\Program Files (x86)"
+ "\\Java\\jre7\\lib\\rt.jar)");
BytecodeViewer.viewer.rtC();
}
@ -152,11 +150,15 @@ public class KrakatauDecompiler extends Decompiler {
return "Set your paths";
}
String s = "Bytecode Viewer Version: " + BytecodeViewer.VERSION + BytecodeViewer.nl + BytecodeViewer.nl + "Please send this to konloch@gmail.com. " + BytecodeViewer.nl + BytecodeViewer.nl;
String s = "Bytecode Viewer Version: " + BytecodeViewer.VERSION + BytecodeViewer.nl + BytecodeViewer.nl +
"Please send this to konloch@gmail.com. " + BytecodeViewer.nl + BytecodeViewer.nl;
final File tempDirectory = new File(BytecodeViewer.tempDirectory + BytecodeViewer.fs + MiscUtils.randomString(32) + BytecodeViewer.fs);
final File tempDirectory =
new File(BytecodeViewer.tempDirectory + BytecodeViewer.fs + MiscUtils.randomString(32) + BytecodeViewer.fs);
tempDirectory.mkdir();
final File tempJar = new File(BytecodeViewer.tempDirectory + BytecodeViewer.fs + "temp" + MiscUtils.randomString(32) + ".jar");
final File tempJar =
new File(BytecodeViewer.tempDirectory + BytecodeViewer.fs + "temp" + MiscUtils.randomString(32) +
".jar");
JarUtils.saveAsJarClassesOnly(BytecodeViewer.getLoadedClasses(), tempJar.getAbsolutePath());
BytecodeViewer.sm.stopBlocking();
@ -210,7 +212,7 @@ public class KrakatauDecompiler extends Decompiler {
StringWriter sw = new StringWriter();
e.printStackTrace(new PrintWriter(sw));
e.printStackTrace();
s += BytecodeViewer.nl + "Bytecode Viewer Version: " + BytecodeViewer.VERSION + BytecodeViewer.nl + BytecodeViewer.nl + sw.toString();
s += BytecodeViewer.nl + "Bytecode Viewer Version: " + BytecodeViewer.VERSION + BytecodeViewer.nl + BytecodeViewer.nl + sw;
} finally {
BytecodeViewer.sm.setBlocking();
}
@ -225,7 +227,8 @@ public class KrakatauDecompiler extends Decompiler {
}
BytecodeViewer.rtCheck();
if (BytecodeViewer.rt.equals("")) {
BytecodeViewer.showMessage("You need to set your JRE RT Library.\r\n(C:\\Program Files (x86)\\Java\\jre7\\lib\\rt.jar)");
BytecodeViewer.showMessage("You need to set your JRE RT Library.\r\n(C:\\Program Files (x86)"
+ "\\Java\\jre7\\lib\\rt.jar)");
BytecodeViewer.viewer.rtC();
}

View file

@ -6,11 +6,8 @@ import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.io.StringWriter;
import me.konloch.kontainer.io.DiskReader;
import org.objectweb.asm.tree.ClassNode;
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
import the.bytecode.club.bytecodeviewer.util.JarUtils;
import the.bytecode.club.bytecodeviewer.util.MiscUtils;
@ -53,7 +50,8 @@ public class KrakatauDisassembler extends Decompiler {
return "Set your paths";
}
String s = "Bytecode Viewer Version: " + BytecodeViewer.VERSION + BytecodeViewer.nl + BytecodeViewer.nl + "Please send this to konloch@gmail.com. " + BytecodeViewer.nl + BytecodeViewer.nl;
String s = "Bytecode Viewer Version: " + BytecodeViewer.VERSION + BytecodeViewer.nl + BytecodeViewer.nl +
"Please send this to konloch@gmail.com. " + BytecodeViewer.nl + BytecodeViewer.nl;
BytecodeViewer.sm.stopBlocking();
try {
@ -101,7 +99,7 @@ public class KrakatauDisassembler extends Decompiler {
StringWriter sw = new StringWriter();
e.printStackTrace(new PrintWriter(sw));
e.printStackTrace();
s += BytecodeViewer.nl + "Bytecode Viewer Version: " + BytecodeViewer.VERSION + BytecodeViewer.nl + BytecodeViewer.nl + sw.toString();
s += BytecodeViewer.nl + "Bytecode Viewer Version: " + BytecodeViewer.VERSION + BytecodeViewer.nl + BytecodeViewer.nl + sw;
} finally {
BytecodeViewer.sm.setBlocking();
}
@ -120,11 +118,15 @@ public class KrakatauDisassembler extends Decompiler {
return "Set your paths";
}
String s = "Bytecode Viewer Version: " + BytecodeViewer.VERSION + BytecodeViewer.nl + BytecodeViewer.nl + "Please send this to konloch@gmail.com. " + BytecodeViewer.nl + BytecodeViewer.nl;
String s = "Bytecode Viewer Version: " + BytecodeViewer.VERSION + BytecodeViewer.nl + BytecodeViewer.nl +
"Please send this to konloch@gmail.com. " + BytecodeViewer.nl + BytecodeViewer.nl;
final File tempDirectory = new File(BytecodeViewer.tempDirectory + BytecodeViewer.fs + MiscUtils.randomString(32) + BytecodeViewer.fs);
final File tempDirectory =
new File(BytecodeViewer.tempDirectory + BytecodeViewer.fs + MiscUtils.randomString(32) + BytecodeViewer.fs);
tempDirectory.mkdir();
final File tempJar = new File(BytecodeViewer.tempDirectory + BytecodeViewer.fs + "temp" + MiscUtils.randomString(32) + ".jar");
final File tempJar =
new File(BytecodeViewer.tempDirectory + BytecodeViewer.fs + "temp" + MiscUtils.randomString(32) +
".jar");
JarUtils.saveAsJarClassesOnly(BytecodeViewer.getLoadedClasses(), tempJar.getAbsolutePath());
BytecodeViewer.sm.stopBlocking();
@ -173,7 +175,7 @@ public class KrakatauDisassembler extends Decompiler {
StringWriter sw = new StringWriter();
e.printStackTrace(new PrintWriter(sw));
e.printStackTrace();
s += BytecodeViewer.nl + "Bytecode Viewer Version: " + BytecodeViewer.VERSION + BytecodeViewer.nl + BytecodeViewer.nl + sw.toString();
s += BytecodeViewer.nl + "Bytecode Viewer Version: " + BytecodeViewer.VERSION + BytecodeViewer.nl + BytecodeViewer.nl + sw;
} finally {
BytecodeViewer.sm.setBlocking();
}

View file

@ -1,5 +1,17 @@
package the.bytecode.club.bytecodeviewer.decompilers;
import com.strobel.assembler.InputTypeLoader;
import com.strobel.assembler.metadata.Buffer;
import com.strobel.assembler.metadata.ITypeLoader;
import com.strobel.assembler.metadata.JarTypeLoader;
import com.strobel.assembler.metadata.MetadataSystem;
import com.strobel.assembler.metadata.TypeDefinition;
import com.strobel.assembler.metadata.TypeReference;
import com.strobel.core.StringUtilities;
import com.strobel.decompiler.DecompilationOptions;
import com.strobel.decompiler.DecompilerSettings;
import com.strobel.decompiler.PlainTextOutput;
import com.strobel.decompiler.languages.java.JavaFormattingOptions;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileOutputStream;
@ -18,22 +30,7 @@ import java.util.jar.JarEntry;
import java.util.jar.JarFile;
import java.util.zip.ZipException;
import java.util.zip.ZipOutputStream;
import org.objectweb.asm.tree.ClassNode;
import com.strobel.core.StringUtilities;
import com.strobel.decompiler.DecompilationOptions;
import com.strobel.decompiler.DecompilerSettings;
import com.strobel.decompiler.PlainTextOutput;
import com.strobel.decompiler.languages.java.JavaFormattingOptions;
import com.strobel.assembler.InputTypeLoader;
import com.strobel.assembler.metadata.Buffer;
import com.strobel.assembler.metadata.ITypeLoader;
import com.strobel.assembler.metadata.JarTypeLoader;
import com.strobel.assembler.metadata.MetadataSystem;
import com.strobel.assembler.metadata.TypeDefinition;
import com.strobel.assembler.metadata.TypeReference;
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
import the.bytecode.club.bytecodeviewer.util.EncodeUtils;
import the.bytecode.club.bytecodeviewer.util.MiscUtils;
@ -142,7 +139,8 @@ public class ProcyonDecompiler extends Decompiler {
e.printStackTrace(new PrintWriter(sw));
e.printStackTrace();
exception = "Bytecode Viewer Version: " + BytecodeViewer.VERSION + BytecodeViewer.nl + BytecodeViewer.nl + sw.toString();
exception =
"Bytecode Viewer Version: " + BytecodeViewer.VERSION + BytecodeViewer.nl + BytecodeViewer.nl + sw;
}
return "Procyon error! Send the stacktrace to Konloch at http://the.bytecode.club or konloch@gmail.com" + BytecodeViewer.nl + BytecodeViewer.nl + "Suggested Fix: Click refresh class, if it fails again try another decompiler." + BytecodeViewer.nl + BytecodeViewer.nl + exception;
}
@ -164,8 +162,8 @@ public class ProcyonDecompiler extends Decompiler {
try (JarFile jfile = new JarFile(inFile);
FileOutputStream dest = new FileOutputStream(outFile);
BufferedOutputStream buffDest = new BufferedOutputStream(dest);
ZipOutputStream out = new ZipOutputStream(buffDest);) {
byte data[] = new byte[1024];
ZipOutputStream out = new ZipOutputStream(buffDest)) {
byte[] data = new byte[1024];
DecompilerSettings settings = getDecompilerSettings();
LuytenTypeLoader typeLoader = new LuytenTypeLoader();
MetadataSystem metadataSystem = new MetadataSystem(typeLoader);

View file

@ -1,17 +1,17 @@
package the.bytecode.club.bytecodeviewer.decompilers;
import java.io.*;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;
import me.konloch.kontainer.io.DiskReader;
import org.apache.commons.io.FileUtils;
import org.objectweb.asm.tree.ClassNode;
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
import the.bytecode.club.bytecodeviewer.util.Dex2Jar;
import the.bytecode.club.bytecodeviewer.util.FileContainer;
import the.bytecode.club.bytecodeviewer.util.MiscUtils;
import the.bytecode.club.bytecodeviewer.util.ZipUtils;
/***************************************************************************
* Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite *
@ -63,32 +63,26 @@ public class SmaliDisassembler extends Decompiler {
Dex2Jar.saveAsDex(tempClass, tempDex, true);
try
{
try {
com.googlecode.d2j.smali.BaksmaliCmd.main(new String[]{tempDex.getAbsolutePath()});
}
catch(Exception e)
{
} catch (Exception e) {
StringWriter sw = new StringWriter();
e.printStackTrace(new PrintWriter(sw));
e.printStackTrace();
exception += "Bytecode Viewer Version: " + BytecodeViewer.VERSION + BytecodeViewer.nl + BytecodeViewer.nl + sw.toString();
exception += "Bytecode Viewer Version: " + BytecodeViewer.VERSION + BytecodeViewer.nl + BytecodeViewer.nl + sw;
}
File rename = new File(tempDex.getName().replaceFirst("\\.dex", "-out"));
try
{
try {
FileUtils.moveDirectory(rename, tempSmali);
}
catch (IOException e)
{
} catch (IOException e) {
StringWriter sw = new StringWriter();
e.printStackTrace(new PrintWriter(sw));
e.printStackTrace();
exception += "Bytecode Viewer Version: " + BytecodeViewer.VERSION + BytecodeViewer.nl + BytecodeViewer.nl + sw.toString();
exception += "Bytecode Viewer Version: " + BytecodeViewer.VERSION + BytecodeViewer.nl + BytecodeViewer.nl + sw;
}
File outputSmali = null;
@ -112,15 +106,16 @@ public class SmaliDisassembler extends Decompiler {
e.printStackTrace(new PrintWriter(sw));
e.printStackTrace();
exception += "Bytecode Viewer Version: " + BytecodeViewer.VERSION + BytecodeViewer.nl + BytecodeViewer.nl + sw.toString();
exception += "Bytecode Viewer Version: " + BytecodeViewer.VERSION + BytecodeViewer.nl + BytecodeViewer.nl + sw;
}
return "Smali Disassembler error! Send the stacktrace to Konloch at http://the.bytecode.club or konloch@gmail.com" + BytecodeViewer.nl + BytecodeViewer.nl + "Suggested Fix: Click refresh class, if it fails again try another decompiler." + BytecodeViewer.nl + BytecodeViewer.nl + exception;
return "Smali Disassembler error! Send the stacktrace to Konloch at http://the.bytecode.club or konloch@gmail"
+ ".com" + BytecodeViewer.nl + BytecodeViewer.nl + "Suggested Fix: Click refresh class, if it fails "
+ "again try another decompiler." + BytecodeViewer.nl + BytecodeViewer.nl + exception;
}
@Override
public String decompileClassNode(ClassNode cn, byte[] b)
{
public String decompileClassNode(ClassNode cn, byte[] b) {
return null;
}

View file

@ -2,14 +2,12 @@ package the.bytecode.club.bytecodeviewer.decompilers.bytecode;
import java.util.ArrayList;
import java.util.List;
import org.objectweb.asm.Attribute;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.tree.ClassNode;
import org.objectweb.asm.tree.FieldNode;
import org.objectweb.asm.tree.InnerClassNode;
import org.objectweb.asm.tree.MethodNode;
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
import the.bytecode.club.bytecodeviewer.decompilers.Decompiler;

View file

@ -2,7 +2,6 @@ package the.bytecode.club.bytecodeviewer.decompilers.bytecode;
import java.util.ArrayList;
import java.util.List;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.Type;
import org.objectweb.asm.tree.FieldNode;

View file

@ -1,20 +1,5 @@
package the.bytecode.club.bytecodeviewer.decompilers.bytecode;
import java.util.Arrays;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.tree.AbstractInsnNode;
import org.objectweb.asm.tree.FieldInsnNode;
import org.objectweb.asm.tree.IincInsnNode;
import org.objectweb.asm.tree.InsnNode;
import org.objectweb.asm.tree.JumpInsnNode;
import org.objectweb.asm.tree.LabelNode;
import org.objectweb.asm.tree.LdcInsnNode;
import org.objectweb.asm.tree.MethodInsnNode;
import org.objectweb.asm.tree.MultiANewArrayInsnNode;
import org.objectweb.asm.tree.TypeInsnNode;
import org.objectweb.asm.tree.VarInsnNode;
import eu.bibl.banalysis.filter.InstructionFilter;
import eu.bibl.banalysis.filter.OpcodeFilter;
import eu.bibl.banalysis.filter.insn.FieldInstructionFilter;
@ -26,6 +11,19 @@ import eu.bibl.banalysis.filter.insn.MethodInstructionFilter;
import eu.bibl.banalysis.filter.insn.MultiANewArrayInstructionFilter;
import eu.bibl.banalysis.filter.insn.TypeInstructionFilter;
import eu.bibl.banalysis.filter.insn.VarInstructionFilter;
import java.util.Arrays;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.tree.AbstractInsnNode;
import org.objectweb.asm.tree.FieldInsnNode;
import org.objectweb.asm.tree.IincInsnNode;
import org.objectweb.asm.tree.InsnNode;
import org.objectweb.asm.tree.JumpInsnNode;
import org.objectweb.asm.tree.LabelNode;
import org.objectweb.asm.tree.LdcInsnNode;
import org.objectweb.asm.tree.MethodInsnNode;
import org.objectweb.asm.tree.MultiANewArrayInsnNode;
import org.objectweb.asm.tree.TypeInsnNode;
import org.objectweb.asm.tree.VarInsnNode;
/***************************************************************************
* Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite *
@ -124,7 +122,7 @@ public class InstructionPattern implements Opcodes {
/**
* @return Last pattern sequence match equivilent from the inputted
* {@link AbstractInsnNode}s.
* {@link AbstractInsnNode}s.
*/
public AbstractInsnNode[] getLastMatch() {
return lastMatch;

View file

@ -1,5 +1,6 @@
package the.bytecode.club.bytecodeviewer.decompilers.bytecode;
import eu.bibl.banalysis.asm.desc.OpcodeInfo;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
@ -10,14 +11,27 @@ import java.util.HashMap;
import java.util.List;
import java.util.ListIterator;
import java.util.Map;
import org.apache.commons.lang3.StringEscapeUtils;
import org.objectweb.asm.Type;
import org.objectweb.asm.tree.*;
import org.objectweb.asm.tree.analysis.Frame;
import org.objectweb.asm.tree.AbstractInsnNode;
import org.objectweb.asm.tree.FieldInsnNode;
import org.objectweb.asm.tree.FrameNode;
import org.objectweb.asm.tree.IincInsnNode;
import org.objectweb.asm.tree.InsnNode;
import org.objectweb.asm.tree.IntInsnNode;
import org.objectweb.asm.tree.InvokeDynamicInsnNode;
import org.objectweb.asm.tree.JumpInsnNode;
import org.objectweb.asm.tree.LabelNode;
import org.objectweb.asm.tree.LdcInsnNode;
import org.objectweb.asm.tree.LineNumberNode;
import org.objectweb.asm.tree.LookupSwitchInsnNode;
import org.objectweb.asm.tree.MethodInsnNode;
import org.objectweb.asm.tree.MethodNode;
import org.objectweb.asm.tree.MultiANewArrayInsnNode;
import org.objectweb.asm.tree.TableSwitchInsnNode;
import org.objectweb.asm.tree.TypeInsnNode;
import org.objectweb.asm.tree.VarInsnNode;
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
import eu.bibl.banalysis.asm.desc.OpcodeInfo;
/***************************************************************************
* Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite *
@ -46,8 +60,8 @@ public class InstructionPrinter {
/**
* The MethodNode to print
**/
private MethodNode mNode;
private TypeAndName[] args;
private final MethodNode mNode;
private final TypeAndName[] args;
protected int[] pattern;
protected boolean match;
@ -138,7 +152,7 @@ public class InstructionPrinter {
line = printMultiANewArrayInsNode((MultiANewArrayInsnNode) ain);
} else {
line += "UNADDED OPCODE: " + nameOpcode(ain.getOpcode()) + " "
+ ain.toString();
+ ain;
}
if (!line.equals("")) {
if (match)
@ -255,32 +269,27 @@ public class InstructionPrinter {
}
}
protected String printIincInsnNode(IincInsnNode iin)
{
protected String printIincInsnNode(IincInsnNode iin) {
return nameOpcode(iin.getOpcode()) + " " + iin.var + " " + iin.incr;
}
protected String printTableSwitchInsnNode(TableSwitchInsnNode tin)
{
protected String printTableSwitchInsnNode(TableSwitchInsnNode tin) {
String line = nameOpcode(tin.getOpcode()) + " \n";
List<?> labels = tin.labels;
int count = 0;
for (int i = tin.min; i < tin.max + 1; i++)
{
for (int i = tin.min; i < tin.max + 1; i++) {
line += " val: " + i + " -> " + "L" + resolveLabel((LabelNode) labels.get(count++)) + "\n";
}
line += " default" + " -> L" + resolveLabel(tin.dflt) + "";
return line;
}
protected String printLookupSwitchInsnNode(LookupSwitchInsnNode lin)
{
protected String printLookupSwitchInsnNode(LookupSwitchInsnNode lin) {
String line = nameOpcode(lin.getOpcode()) + ": \n";
List<?> keys = lin.keys;
List<?> labels = lin.labels;
for (int i = 0; i < keys.size(); i++)
{
for (int i = 0; i < keys.size(); i++) {
int key = (Integer) keys.get(i);
LabelNode label = (LabelNode) labels.get(i);
line += " val: " + key + " -> " + "L" + resolveLabel(label) + "\n";
@ -293,7 +302,7 @@ public class InstructionPrinter {
protected String printInvokeDynamicInsNode(InvokeDynamicInsnNode idin) {
StringBuilder sb = new StringBuilder();
sb.append(nameOpcode(idin.getOpcode()) + " " + idin.bsm.getOwner() + '.' + idin.bsm.getName() + idin.bsm.getDesc()
+ " : " + idin.name + idin.desc);
+ " : " + idin.name + idin.desc);
if (idin.bsmArgs != null) {
for (Object o : idin.bsmArgs) {
@ -305,10 +314,9 @@ public class InstructionPrinter {
return sb.toString();
}
protected String printMultiANewArrayInsNode(MultiANewArrayInsnNode mana)
{
protected String printMultiANewArrayInsNode(MultiANewArrayInsnNode mana) {
StringBuilder sb = new StringBuilder();
sb.append(nameOpcode(mana.getOpcode()) + " " + mana.dims + " : " + mana.desc);
sb.append(nameOpcode(mana.getOpcode()) + " " + mana.dims + " : " + mana.desc);
return sb.toString();
}

View file

@ -2,7 +2,6 @@ package the.bytecode.club.bytecodeviewer.decompilers.bytecode;
import java.util.ArrayList;
import java.util.List;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.tree.AbstractInsnNode;
import org.objectweb.asm.tree.FrameNode;

View file

@ -3,7 +3,6 @@ package the.bytecode.club.bytecodeviewer.decompilers.bytecode;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.Type;
import org.objectweb.asm.tree.AnnotationNode;
@ -11,9 +10,7 @@ import org.objectweb.asm.tree.ClassNode;
import org.objectweb.asm.tree.LocalVariableNode;
import org.objectweb.asm.tree.MethodNode;
import org.objectweb.asm.tree.TryCatchBlockNode;
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
import the.bytecode.club.bytecodeviewer.decompilers.bytecode.TypeAndName;
/***************************************************************************
* Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite *

View file

@ -1,19 +1,15 @@
package the.bytecode.club.bytecodeviewer.gui;
import javax.swing.JFrame;
import java.awt.CardLayout;
import java.awt.Color;
import java.awt.Font;
import java.awt.Toolkit;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
import the.bytecode.club.bytecodeviewer.Resources;
import java.awt.Color;
import javax.swing.JScrollPane;
/***************************************************************************
* Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite *
* Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com *
@ -61,7 +57,9 @@ public class AboutWindow extends JFrame {
public void setVisible(boolean b) {
super.setVisible(b);
textArea.setFont(new Font(Font.MONOSPACED, Font.PLAIN, (int) BytecodeViewer.viewer.fontSpinner.getValue()));
textArea.setText("Bytecode Viewer " + BytecodeViewer.VERSION + " is an open source program developed and maintained by Konloch (konloch@gmail.com) 100% free and open sourced licensed under GPL v3 CopyLeft\r\n\r\n" +
textArea.setText("Bytecode Viewer " + BytecodeViewer.VERSION + " is an open source program developed and "
+ "maintained by Konloch (konloch@gmail.com) 100% free and open sourced licensed under GPL v3 "
+ "CopyLeft\r\n\r\n" +
"Settings:" + BytecodeViewer.nl +
" Preview Copy: " + BytecodeViewer.PREVIEW_COPY + BytecodeViewer.nl +
" Fat Jar: " + BytecodeViewer.FAT_JAR + BytecodeViewer.nl +
@ -80,9 +78,11 @@ public class AboutWindow extends JFrame {
" -help Displays the help menu" + BytecodeViewer.nl +
" -list Displays the available decompilers" + BytecodeViewer.nl +
" -decompiler <decompiler> Selects the decompiler, procyon by default" + BytecodeViewer.nl +
" -i <input file> Selects the input file (Jar, Class, APK, ZIP, DEX all work automatically)" + BytecodeViewer.nl +
" -i <input file> Selects the input file (Jar, Class, APK, ZIP, DEX all work "
+ "automatically)" + BytecodeViewer.nl +
" -o <output file> Selects the output file (Java or Java-Bytecode)" + BytecodeViewer.nl +
" -t <target classname> Must either be the fully qualified classname or \"all\" to decompile all as zip" + BytecodeViewer.nl +
" -t <target classname> Must either be the fully qualified classname or \"all\" to decompile"
+ " all as zip" + BytecodeViewer.nl +
" -nowait Doesn't wait for the user to read the CLI messages" + BytecodeViewer.nl + BytecodeViewer.nl +
"Keybinds:" + BytecodeViewer.nl +
" CTRL + O: Open/add new jar/class/apk" + BytecodeViewer.nl +
@ -91,7 +91,13 @@ public class AboutWindow extends JFrame {
" CTRL + T: Compile" + BytecodeViewer.nl +
" CTRL + S: Save classes as zip" + BytecodeViewer.nl +
" CTRL + R: Run (EZ-Inject) - dynamically load the classes and invoke a main class" +
"\r\n\r\nCode from various projects has been used, including but not limited to:\r\n J-RET by WaterWolf\r\n JHexPane by Sam Koivu\r\n RSynaxPane by Robert Futrell\r\n Commons IO by Apache\r\n ASM by OW2\r\n FernFlower by Stiver\r\n Procyon by Mstrobel\r\n CFR by Lee Benfield\r\n CFIDE by Bibl\r\n Smali by JesusFreke\r\n Dex2Jar by pxb1..?\r\n Krakatau by Storyyeller\r\n JD-GUI + JD-Core by The Java-Decompiler Team\r\n Enjarify by Storyyeller\r\n\r\nIf you're interested in Java Reverse Engineering, join The Bytecode Club - https://the.bytecode.club");
"\r\n\r\nCode from various projects has been used, including but not limited to:\r\n J-RET by "
+ "WaterWolf\r\n JHexPane by Sam Koivu\r\n RSynaxPane by Robert Futrell\r\n Commons IO by "
+ "Apache\r\n ASM by OW2\r\n FernFlower by Stiver\r\n Procyon by Mstrobel\r\n CFR by Lee "
+ "Benfield\r\n CFIDE by Bibl\r\n Smali by JesusFreke\r\n Dex2Jar by pxb1..?\r\n Krakatau by "
+ "Storyyeller\r\n JD-GUI + JD-Core by The Java-Decompiler Team\r\n Enjarify by "
+ "Storyyeller\r\n\r\nIf you're interested in Java Reverse Engineering, join The Bytecode Club - "
+ "https://the.bytecode.club");
}

View file

@ -1,48 +1,37 @@
package the.bytecode.club.bytecodeviewer.gui;
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
import javax.swing.*;
import java.awt.*;
import java.awt.Color;
import javax.swing.SwingUtilities;
/**
* @author Konloch
*/
public class DelayTabbedPaneThread extends Thread
{
public class DelayTabbedPaneThread extends Thread {
public boolean stopped = false;
private TabbedPane pane;
private final TabbedPane pane;
public DelayTabbedPaneThread(TabbedPane pane)
{
public DelayTabbedPaneThread(TabbedPane pane) {
this.pane = pane;
}
@Override
public void run()
{
try
{
public void run() {
try {
sleep(200);
}
catch (InterruptedException e)
{
} catch (InterruptedException e) {
e.printStackTrace();
}
if(!stopped)
{
SwingUtilities.invokeLater(new Runnable()
{
if (!stopped) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run()
{
if(stopped)
public void run() {
if (stopped)
return;
pane.label.setOpaque(true);
pane.label.setBackground(Color.MAGENTA);
pane.label.updateUI();
}
}
});
}
}

View file

@ -1,20 +1,17 @@
package the.bytecode.club.bytecodeviewer.gui;
import javax.swing.JFrame;
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
import the.bytecode.club.bytecodeviewer.util.JarUtils;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.BoxLayout;
import javax.swing.JScrollPane;
import javax.swing.JLabel;
import javax.swing.JTextArea;
/***************************************************************************
* Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite *
* Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com *

View file

@ -1,6 +1,45 @@
package the.bytecode.club.bytecodeviewer.gui;
import com.sun.java.swing.plaf.windows.WindowsTreeUI;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Component;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.font.FontRenderContext;
import java.awt.geom.Rectangle2D;
import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Enumeration;
import java.util.Iterator;
import java.util.Map.Entry;
import javax.swing.AbstractAction;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.JScrollPane;
import javax.swing.JTextField;
import javax.swing.JTree;
import javax.swing.event.TreeSelectionEvent;
import javax.swing.event.TreeSelectionListener;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.DefaultTreeCellRenderer;
import javax.swing.tree.MutableTreeNode;
import javax.swing.tree.TreeNode;
import javax.swing.tree.TreePath;
import org.objectweb.asm.tree.ClassNode;
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
import the.bytecode.club.bytecodeviewer.Resources;
@ -9,18 +48,6 @@ import the.bytecode.club.bytecodeviewer.util.FileContainer;
import the.bytecode.club.bytecodeviewer.util.FileDrop;
import the.bytecode.club.bytecodeviewer.util.LazyNameUtil;
import javax.swing.*;
import javax.swing.event.TreeSelectionEvent;
import javax.swing.event.TreeSelectionListener;
import javax.swing.tree.*;
import java.awt.*;
import java.awt.event.*;
import java.awt.font.FontRenderContext;
import java.awt.geom.Rectangle2D;
import java.io.File;
import java.util.*;
import java.util.Map.Entry;
/***************************************************************************
* Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite *
* Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com *
@ -70,7 +97,7 @@ public class FileNavigationPane extends VisibleComponent implements
final String qt = quickSearch.getText();
quickSearch.setText("");
if(qt.isEmpty()) //NOPE
if (qt.isEmpty()) //NOPE
return;
@ -99,16 +126,16 @@ public class FileNavigationPane extends VisibleComponent implements
for (int c = 0; c < curNode.getChildCount(); c++) {
final MyTreeNode child = (MyTreeNode) curNode.getChildAt(c);
System.out.println(pathName + ":" + ((String) child.getUserObject()));
System.out.println(pathName + ":" + child.getUserObject());
if (((String) child.getUserObject()).equals(pathName)) {
if (child.getUserObject().equals(pathName)) {
curNode = child;
if (isLast) {
System.out.println("Found! " + curNode);
found++;
if(found >= 30)
{
BytecodeViewer.showMessage("Uh oh, there could be more results but you've triggered the 30 classes at once limit. Try refining your search.");
if (found >= 30) {
BytecodeViewer.showMessage("Uh oh, there could be more results but you've "
+ "triggered the 30 classes at once limit. Try refining your search.");
return;
}
final TreePath pathn = new TreePath(curNode.getPath());
@ -134,7 +161,7 @@ public class FileNavigationPane extends VisibleComponent implements
MyTreeNode node = enums.nextElement();
if (node.isLeaf()) {
if (((String) (node.getUserObject())).toLowerCase().contains(path[path.length - 1].toLowerCase())) {
TreeNode pathArray[] = node.getPath();
TreeNode[] pathArray = node.getPath();
int k = 0;
StringBuilder fullPath = new StringBuilder();
while (pathArray != null
@ -150,9 +177,10 @@ public class FileNavigationPane extends VisibleComponent implements
if (fullPathString != null && fullPathString.toLowerCase().contains(qt.toLowerCase())) {
System.out.println("Found! " + node);
found++;
if(found >= 30)
{
BytecodeViewer.showMessage("Uh oh, there could be more results but you've triggered the 30 classes at once limit. Try refining your search.");
if (found >= 30) {
BytecodeViewer.showMessage("Uh oh, there could be more results but you've"
+ " triggered the 30 classes at once limit. Try refining your "
+ "search.");
return;
}
final TreePath pathn = new TreePath(node.getPath());
@ -303,27 +331,20 @@ public class FileNavigationPane extends VisibleComponent implements
@Override
public void keyPressed(KeyEvent e) {
System.out.println((int)e.getKeyChar());
if (e.getKeyCode() == KeyEvent.VK_ENTER)
{
if (e.getSource() instanceof MyTree)
{
System.out.println((int) e.getKeyChar());
if (e.getKeyCode() == KeyEvent.VK_ENTER) {
if (e.getSource() instanceof MyTree) {
MyTree tree = (MyTree) e.getSource();
openPath(tree.getSelectionPath());
}
}
else if((int)e.getKeyChar() != 0 &&(int)e.getKeyChar() != 8 &&(int)e.getKeyChar() != 127 && (int)e.getKeyChar() != 65535 && !e.isControlDown() && !e.isAltDown())
{
} else if ((int) e.getKeyChar() != 0 && (int) e.getKeyChar() != 8 && (int) e.getKeyChar() != 127 && (int) e.getKeyChar() != 65535 && !e.isControlDown() && !e.isAltDown()) {
quickSearch.grabFocus();
quickSearch.setText("" + e.getKeyChar());
cancel = true;
}
else if(e.isControlDown() && (int)e.getKeyChar() == 6) //ctrl + f
} else if (e.isControlDown() && (int) e.getKeyChar() == 6) //ctrl + f
{
quickSearch.grabFocus();
}
else
{
} else {
cancel = true;
}
}
@ -608,8 +629,7 @@ public class FileNavigationPane extends VisibleComponent implements
tree.updateUI();
}
public void openPath(TreePath path)
{
public void openPath(TreePath path) {
if (path == null || path.getPathCount() == 1) {
return;
}
@ -625,26 +645,25 @@ public class FileNavigationPane extends VisibleComponent implements
String cheapHax = path.getPathComponent(1).toString();
FileContainer container = null;
for(FileContainer c : BytecodeViewer.files)
{
if(c.name.equals(cheapHax))
for (FileContainer c : BytecodeViewer.files) {
if (c.name.equals(cheapHax))
container = c;
}
String name = nameBuffer.toString();
if (name.endsWith(".class"))
{
if (name.endsWith(".class")) {
final ClassNode cn = BytecodeViewer.getClassNode(container, name.substring(0, name.length() - ".class".length()));
final ClassNode cn = BytecodeViewer.getClassNode(container, name.substring(0,
name.length() - ".class".length()));
if (cn != null) {
openClassFileToWorkSpace(container, nameBuffer.toString(), cn);
}
else
{
openFileToWorkSpace(container, nameBuffer.toString(), BytecodeViewer.getFileContents(nameBuffer.toString()));
} else {
openFileToWorkSpace(container, nameBuffer.toString(),
BytecodeViewer.getFileContents(nameBuffer.toString()));
}
} else {
openFileToWorkSpace(container, nameBuffer.toString(), BytecodeViewer.getFileContents(nameBuffer.toString()));
openFileToWorkSpace(container, nameBuffer.toString(),
BytecodeViewer.getFileContents(nameBuffer.toString()));
}
}
@ -667,7 +686,8 @@ public class FileNavigationPane extends VisibleComponent implements
selected, expanded, leaf, row, hasFocus);
if (value != null && value instanceof the.bytecode.club.bytecodeviewer.gui.FileNavigationPane.MyTreeNode) {
the.bytecode.club.bytecodeviewer.gui.FileNavigationPane.MyTreeNode node = (the.bytecode.club.bytecodeviewer.gui.FileNavigationPane.MyTreeNode) value;
the.bytecode.club.bytecodeviewer.gui.FileNavigationPane.MyTreeNode node =
(the.bytecode.club.bytecodeviewer.gui.FileNavigationPane.MyTreeNode) value;
String name = node.toString().toLowerCase();
if (name.endsWith(".jar") || name.endsWith(".war")) {
@ -684,7 +704,8 @@ public class FileNavigationPane extends VisibleComponent implements
setIcon(Resources.cplusplusIcon);
} else if (name.endsWith(".apk") || name.endsWith(".dex")) {
setIcon(Resources.androidIcon);
} else if (name.endsWith(".png") || name.endsWith(".jpg") || name.endsWith(".jpeg") || name.endsWith(".bmp") || name.endsWith(".gif")) {
} else if (name.endsWith(".png") || name.endsWith(".jpg") || name.endsWith(".jpeg") || name.endsWith(
".bmp") || name.endsWith(".gif")) {
setIcon(Resources.imageIcon);
} else if (name.endsWith(".class")) {
setIcon(Resources.classIcon);

View file

@ -1,5 +1,6 @@
package the.bytecode.club.bytecodeviewer.gui;
import com.jhe.hexed.JHexEditor;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.event.ActionEvent;
@ -13,7 +14,7 @@ import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.nio.charset.Charset;
import java.nio.charset.CharsetEncoder;
import java.nio.charset.StandardCharsets;
import javax.imageio.ImageIO;
import javax.swing.ImageIcon;
import javax.swing.JButton;
@ -25,17 +26,13 @@ import javax.swing.JTextField;
import javax.swing.text.DefaultHighlighter;
import javax.swing.text.Highlighter;
import javax.swing.text.JTextComponent;
import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea;
import org.fife.ui.rsyntaxtextarea.SyntaxConstants;
import org.fife.ui.rtextarea.RTextScrollPane;
import org.imgscalr.Scalr;
import com.jhe.hexed.JHexEditor;
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
import the.bytecode.club.bytecodeviewer.util.FileContainer;
import the.bytecode.club.bytecodeviewer.Resources;
import the.bytecode.club.bytecodeviewer.util.FileContainer;
/***************************************************************************
* Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite *
@ -66,7 +63,7 @@ public class FileViewer extends Viewer {
private static final long serialVersionUID = 6103372882168257164L;
String name;
private byte[] contents;
private final byte[] contents;
RSyntaxTextArea panelArea = new RSyntaxTextArea();
JPanel panel = new JPanel(new BorderLayout());
JPanel panel2 = new JPanel(new BorderLayout());
@ -114,9 +111,11 @@ public class FileViewer extends Viewer {
public void mouseWheelMoved(MouseWheelEvent e) {
int notches = e.getWheelRotation();
if (notches < 0) {
image = Scalr.resize(image, Scalr.Method.SPEED, image.getWidth() + 10, image.getHeight() + 10);
image = Scalr.resize(image, Scalr.Method.SPEED, image.getWidth() + 10,
image.getHeight() + 10);
} else {
image = Scalr.resize(image, Scalr.Method.SPEED, image.getWidth() - 10, image.getHeight() - 10);
image = Scalr.resize(image, Scalr.Method.SPEED, image.getWidth() - 10,
image.getHeight() - 10);
}
panel2.removeAll();
JLabel label = new JLabel("", new ImageIcon(image), JLabel.CENTER);
@ -128,9 +127,7 @@ public class FileViewer extends Viewer {
} catch (Exception e) {
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e);
}
}
else if(BytecodeViewer.viewer.forcePureAsciiAsText.isSelected())
{
} else if (BytecodeViewer.viewer.forcePureAsciiAsText.isSelected()) {
JHexEditor hex = new JHexEditor(contents);
panel2.add(hex);
return;
@ -207,7 +204,7 @@ public class FileViewer extends Viewer {
panel2.add(scrollPane);
}
static CharsetEncoder asciiEncoder = Charset.forName("US-ASCII").newEncoder(); // or "ISO-8859-1" for ISO Latin 1
static CharsetEncoder asciiEncoder = StandardCharsets.US_ASCII.newEncoder(); // or "ISO-8859-1" for ISO Latin 1
public static boolean isPureAscii(String v) {
return asciiEncoder.canEncode(v);
@ -357,7 +354,7 @@ public class FileViewer extends Viewer {
}
}
private DefaultHighlighter.DefaultHighlightPainter painter = new DefaultHighlighter.DefaultHighlightPainter(
private final DefaultHighlighter.DefaultHighlightPainter painter = new DefaultHighlighter.DefaultHighlightPainter(
new Color(255, 62, 150));
public void highlight(JTextComponent textComp, String pattern) {

View file

@ -1,11 +1,10 @@
package the.bytecode.club.bytecodeviewer.gui;
import javax.swing.JFrame;
import java.awt.Dimension;
import javax.swing.JTabbedPane;
import java.awt.BorderLayout;
import java.awt.Dimension;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTabbedPane;
import the.bytecode.club.bytecodeviewer.Resources;
/***************************************************************************

View file

@ -1,19 +1,15 @@
package the.bytecode.club.bytecodeviewer.gui;
import javax.swing.JFrame;
import java.awt.Dimension;
import javax.swing.JCheckBox;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JFrame;
import the.bytecode.club.bytecodeviewer.Resources;
import the.bytecode.club.bytecodeviewer.plugin.PluginManager;
import the.bytecode.club.bytecodeviewer.plugin.preinstalled.MaliciousCodeScanner;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
/***************************************************************************
* Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite *
* Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com *

View file

@ -18,19 +18,29 @@ package the.bytecode.club.bytecodeviewer.gui;
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
***************************************************************************/
import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea;
import org.fife.ui.rtextarea.RTextScrollPane;
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
import the.bytecode.club.bytecodeviewer.util.MethodParser;
import javax.swing.*;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.InputEvent;
import java.awt.event.MouseWheelEvent;
import java.awt.event.MouseWheelListener;
import java.util.regex.Matcher;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JViewport;
import javax.swing.ListCellRenderer;
import javax.swing.event.CaretEvent;
import javax.swing.event.CaretListener;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import java.awt.*;
import java.awt.event.*;
import java.util.regex.Matcher;
import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea;
import org.fife.ui.rtextarea.RTextScrollPane;
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
import the.bytecode.club.bytecodeviewer.util.MethodParser;
import static the.bytecode.club.bytecodeviewer.gui.TabbedPane.BLANK;
@ -41,8 +51,7 @@ import static the.bytecode.club.bytecodeviewer.gui.TabbedPane.BLANK;
* @author DreamSworK
*/
public abstract class PaneUpdaterThread extends Thread
{
public abstract class PaneUpdaterThread extends Thread {
public ClassViewer viewer;
public RSyntaxTextArea panelArea;
public RTextScrollPane scrollPane;
@ -56,32 +65,26 @@ public abstract class PaneUpdaterThread extends Thread
public void run() {
doShit();
synchronizePane();
//attachCtrlMouseWheelZoom(scrollPane, panelArea); //freezes the UI for some reason, probably cause BCV is doing dumb shit with the swing thread
//attachCtrlMouseWheelZoom(scrollPane, panelArea); //freezes the UI for some reason, probably cause BCV is
// doing dumb shit with the swing thread
}
public void attachCtrlMouseWheelZoom(RTextScrollPane scrollPane, RSyntaxTextArea panelArea)
{
if(scrollPane == null)
public void attachCtrlMouseWheelZoom(RTextScrollPane scrollPane, RSyntaxTextArea panelArea) {
if (scrollPane == null)
return;
scrollPane.addMouseWheelListener(new MouseWheelListener()
{
scrollPane.addMouseWheelListener(new MouseWheelListener() {
@Override
public void mouseWheelMoved(MouseWheelEvent e)
{
if(panelArea == null || panelArea.getText().isEmpty())
public void mouseWheelMoved(MouseWheelEvent e) {
if (panelArea == null || panelArea.getText().isEmpty())
return;
if ((e.getModifiersEx() & InputEvent.CTRL_DOWN_MASK) != 0)
{
if ((e.getModifiersEx() & InputEvent.CTRL_DOWN_MASK) != 0) {
Font font = panelArea.getFont();
int size = font.getSize();
if(e.getWheelRotation() > 0)
{ //Up
if (e.getWheelRotation() > 0) { //Up
panelArea.setFont(new Font(font.getName(), font.getStyle(), --size >= 2 ? --size : 2));
}
else
{ //Down
} else { //Down
panelArea.setFont(new Font(font.getName(), font.getStyle(), ++size));
}
}
@ -90,37 +93,27 @@ public abstract class PaneUpdaterThread extends Thread
});
}
public final CaretListener caretListener = new CaretListener()
{
public final CaretListener caretListener = new CaretListener() {
@Override
public void caretUpdate(CaretEvent e)
{
public void caretUpdate(CaretEvent e) {
MethodParser methods = viewer.methods.get(paneId);
if (methods != null)
{
if (methods != null) {
int methodLine = methods.findActiveMethod(panelArea.getCaretLineNumber());
if (methodLine != -1)
{
if (BytecodeViewer.viewer.showClassMethods.isSelected())
{
if (methodsList != null)
{
if (methodLine != (int) methodsList.getSelectedItem())
{
if (methodLine != -1) {
if (BytecodeViewer.viewer.showClassMethods.isSelected()) {
if (methodsList != null) {
if (methodLine != (int) methodsList.getSelectedItem()) {
methodsList.setSelectedItem(methodLine);
}
}
}
if (BytecodeViewer.viewer.synchronizedViewing.isSelected())
{
if (BytecodeViewer.viewer.synchronizedViewing.isSelected()) {
int panes = 2;
if(viewer.panel3 != null)
if (viewer.panel3 != null)
panes = 3;
for (int i = 0; i < panes; i++)
{
if (i != paneId)
{
for (int i = 0; i < panes; i++) {
if (i != paneId) {
ClassViewer.selectMethod(viewer, i, methods.getMethod(methodLine));
}
}
@ -134,7 +127,7 @@ public abstract class PaneUpdaterThread extends Thread
@Override
public void stateChanged(ChangeEvent e) {
int panes = 2;
if(viewer.panel3 != null)
if (viewer.panel3 != null)
panes = 3;
if (BytecodeViewer.viewer.synchronizedViewing.isSelected()) {
@ -142,7 +135,8 @@ public abstract class PaneUpdaterThread extends Thread
int caretLine = panelArea.getCaretLineNumber();
int maxViewLine = ClassViewer.getMaxViewLine(panelArea);
int activeViewLine = ClassViewer.getViewLine(panelArea);
int activeLine = (activeViewLine == maxViewLine && caretLine > maxViewLine) ? caretLine : activeViewLine;
int activeLine = (activeViewLine == maxViewLine && caretLine > maxViewLine) ? caretLine :
activeViewLine;
int activeLineDelta = -1;
MethodParser.Method activeMethod = null;
MethodParser activeMethods = viewer.methods.get(paneId);
@ -155,22 +149,20 @@ public abstract class PaneUpdaterThread extends Thread
}
}
for (int i = 0; i < panes; i++) {
if (i != paneId)
{
if (i != paneId) {
int setLine = -1;
RSyntaxTextArea area = null;
switch(i)
{
case 0:
area = viewer.t1.panelArea;
break;
case 1:
area = viewer.t2.panelArea;
break;
case 2:
area = viewer.t3.panelArea;
break;
switch (i) {
case 0:
area = viewer.t1.panelArea;
break;
case 1:
area = viewer.t2.panelArea;
break;
case 2:
area = viewer.t3.panelArea;
break;
}
if (area != null) {
@ -185,8 +177,7 @@ public abstract class PaneUpdaterThread extends Thread
}
}
}
}
else if (activeLine != ClassViewer.getViewLine(area)) {
} else if (activeLine != ClassViewer.getViewLine(area)) {
setLine = activeLine;
}
if (setLine >= 0) {
@ -200,14 +191,13 @@ public abstract class PaneUpdaterThread extends Thread
}
};
class MethodsRenderer extends JLabel implements ListCellRenderer<Object>
{
class MethodsRenderer extends JLabel implements ListCellRenderer<Object> {
public MethodsRenderer() {
setOpaque(true);
}
public Component getListCellRendererComponent(JList<?> list, Object value, int index, boolean isSelected, boolean cellHasFocus)
{
public Component getListCellRendererComponent(JList<?> list, Object value, int index, boolean isSelected,
boolean cellHasFocus) {
MethodParser methods = viewer.methods.get(paneId);
MethodParser.Method method = methods.getMethod((Integer) value);
setText(method.toString());
@ -215,27 +205,23 @@ public abstract class PaneUpdaterThread extends Thread
}
}
public void synchronizePane()
{
public void synchronizePane() {
JViewport viewport = scrollPane.getViewport();
viewport.addChangeListener(viewportListener);
panelArea.addCaretListener(caretListener);
final MethodParser methods = viewer.methods.get(paneId);
for (int i = 0; i < panelArea.getLineCount(); i++)
{
for (int i = 0; i < panelArea.getLineCount(); i++) {
String lineText = ClassViewer.getLineText(panelArea, i);
Matcher regexMatcher = MethodParser.regex.matcher(lineText);
if (regexMatcher.find())
{
if (regexMatcher.find()) {
String methodName = regexMatcher.group("name");
String methodParams = regexMatcher.group("params");
methods.addMethod(i, methodName, methodParams);
}
}
if (BytecodeViewer.viewer.showClassMethods.isSelected())
{
if (BytecodeViewer.viewer.showClassMethods.isSelected()) {
if (!methods.isEmpty()) {
methodsList = new JComboBox<>();
for (Integer line : methods.getMethodsLines()) {
@ -248,20 +234,19 @@ public abstract class PaneUpdaterThread extends Thread
int line = (int) methodsList.getSelectedItem();
RSyntaxTextArea area = null;
switch(paneId)
{
case 0:
area = viewer.t1.panelArea;
break;
case 1:
area = viewer.t2.panelArea;
break;
case 2:
area = viewer.t3.panelArea;
break;
switch (paneId) {
case 0:
area = viewer.t1.panelArea;
break;
case 1:
area = viewer.t2.panelArea;
break;
case 2:
area = viewer.t3.panelArea;
break;
}
if(area != null)
if (area != null)
ClassViewer.selectMethod(area, line);
}
});

View file

@ -1,21 +1,17 @@
package the.bytecode.club.bytecodeviewer.gui;
import java.awt.Dimension;
import javax.swing.JFrame;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTextField;
import the.bytecode.club.bytecodeviewer.Resources;
import the.bytecode.club.bytecodeviewer.plugin.PluginManager;
import the.bytecode.club.bytecodeviewer.plugin.preinstalled.ReplaceStrings;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.JCheckBox;
/***************************************************************************
* Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite *
* Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com *
@ -84,7 +80,8 @@ public class ReplaceStringsOptions extends JFrame {
final JCheckBox chckbxNewCheckBox = new JCheckBox(
"Replace All Contains");
chckbxNewCheckBox
.setToolTipText("If it's unticked, it will check if the string equals, if its ticked it will check if it contains, then replace the original LDC part of the string.");
.setToolTipText("If it's unticked, it will check if the string equals, if its ticked it will check if"
+ " it contains, then replace the original LDC part of the string.");
chckbxNewCheckBox.setBounds(6, 7, 232, 23);
getContentPane().add(chckbxNewCheckBox);
btnNewButton.addActionListener(new ActionListener() {
@ -99,7 +96,7 @@ public class ReplaceStringsOptions extends JFrame {
}
private static final long serialVersionUID = -2662514582647810868L;
private JTextField textField;
private JTextField textField_1;
private JTextField textField_2;
private final JTextField textField;
private final JTextField textField_1;
private final JTextField textField_2;
}

View file

@ -1,27 +1,20 @@
package the.bytecode.club.bytecodeviewer.gui;
import javax.swing.JFrame;
import java.awt.Dimension;
import javax.swing.JCheckBox;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JTextField;
import org.objectweb.asm.tree.ClassNode;
import org.objectweb.asm.tree.MethodNode;
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
import the.bytecode.club.bytecodeviewer.Resources;
import the.bytecode.club.bytecodeviewer.plugin.PluginManager;
import the.bytecode.club.bytecodeviewer.plugin.preinstalled.EZInjection;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import javax.swing.JTextField;
import org.objectweb.asm.tree.ClassNode;
import org.objectweb.asm.tree.MethodNode;
import javax.swing.JLabel;
/***************************************************************************
* Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite *
* Copyright (C) 2014 Kalen 'Konloch' Kinloch - http://bytecodeviewer.com *
@ -157,8 +150,8 @@ public class RunOptions extends JFrame {
}
private static final long serialVersionUID = -2662514582647810868L;
private JTextField txtThebytecodeclubexamplemainlstring;
private JCheckBox debugMethodCalls;
private JTextField textField;
private JTextField textField_1;
private final JTextField txtThebytecodeclubexamplemainlstring;
private final JCheckBox debugMethodCalls;
private final JTextField textField;
private final JTextField textField_1;
}

View file

@ -8,7 +8,6 @@ import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.util.regex.Pattern;
import java.util.regex.PatternSyntaxException;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JButton;
import javax.swing.JCheckBox;
@ -21,11 +20,16 @@ import javax.swing.event.TreeSelectionEvent;
import javax.swing.event.TreeSelectionListener;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.TreePath;
import org.objectweb.asm.tree.ClassNode;
import the.bytecode.club.bytecodeviewer.*;
import the.bytecode.club.bytecodeviewer.searching.*;
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
import the.bytecode.club.bytecodeviewer.searching.BackgroundSearchThread;
import the.bytecode.club.bytecodeviewer.searching.FieldCallSearch;
import the.bytecode.club.bytecodeviewer.searching.LDCSearch;
import the.bytecode.club.bytecodeviewer.searching.MethodCallSearch;
import the.bytecode.club.bytecodeviewer.searching.RegexInsnFinder;
import the.bytecode.club.bytecodeviewer.searching.RegexSearch;
import the.bytecode.club.bytecodeviewer.searching.SearchResultNotifier;
import the.bytecode.club.bytecodeviewer.searching.SearchTypeDetails;
import the.bytecode.club.bytecodeviewer.util.FileChangeNotifier;
import the.bytecode.club.bytecodeviewer.util.FileContainer;
@ -55,8 +59,7 @@ import the.bytecode.club.bytecodeviewer.util.FileContainer;
*/
@SuppressWarnings("rawtypes")
public class SearchingPane extends VisibleComponent
{
public class SearchingPane extends VisibleComponent {
private static final long serialVersionUID = -1098524689236993932L;
@ -71,19 +74,16 @@ public class SearchingPane extends VisibleComponent
JComboBox searchRadiusBox;
public JButton search = new JButton("Search");
BackgroundSearchThread t = new BackgroundSearchThread(true)
{
BackgroundSearchThread t = new BackgroundSearchThread(true) {
@Override
public void doSearch()
{
public void doSearch() {
// empty
}
};
@SuppressWarnings("unchecked")
public SearchingPane(final FileChangeNotifier fcn)
{
public SearchingPane(final FileChangeNotifier fcn) {
super("Search");
this.fcn = fcn;
@ -97,8 +97,7 @@ public class SearchingPane extends VisibleComponent
searchRadiusOpt.add(new JLabel("Search from "), BorderLayout.WEST);
DefaultComboBoxModel model = new DefaultComboBoxModel();
for (final SearchRadius st : SearchRadius.values())
{
for (final SearchRadius st : SearchRadius.values()) {
model.addElement(st);
}
@ -109,19 +108,16 @@ public class SearchingPane extends VisibleComponent
searchOpts.add(searchRadiusOpt);
model = new DefaultComboBoxModel();
for (final SearchType st : SearchType.values())
{
for (final SearchType st : SearchType.values()) {
model.addElement(st);
}
typeBox = new JComboBox(model);
final JPanel searchOptPanel = new JPanel();
final ItemListener il = new ItemListener()
{
final ItemListener il = new ItemListener() {
@Override
public void itemStateChanged(final ItemEvent arg0)
{
public void itemStateChanged(final ItemEvent arg0) {
searchOptPanel.removeAll();
searchType = (SearchType) typeBox.getSelectedItem();
searchOptPanel.add(searchType.details.getPanel());
@ -147,11 +143,9 @@ public class SearchingPane extends VisibleComponent
optionPanel.add(p2, BorderLayout.CENTER);
search.addActionListener(new ActionListener()
{
search.addActionListener(new ActionListener() {
@Override
public void actionPerformed(final ActionEvent arg0)
{
public void actionPerformed(final ActionEvent arg0) {
search();
}
});
@ -165,27 +159,25 @@ public class SearchingPane extends VisibleComponent
getContentPane().add(new JScrollPane(optionPanel), BorderLayout.NORTH);
getContentPane().add(new JScrollPane(tree), BorderLayout.CENTER);
this.tree.addTreeSelectionListener(new TreeSelectionListener()
{
this.tree.addTreeSelectionListener(new TreeSelectionListener() {
@Override
public void valueChanged(final TreeSelectionEvent arg0)
{
if(arg0.getPath().getPathComponent(0).equals("Results"))
public void valueChanged(final TreeSelectionEvent arg0) {
if (arg0.getPath().getPathComponent(0).equals("Results"))
return;
String cheapHax = arg0.getPath().getPathComponent(1).toString();
String path = arg0.getPath().getPathComponent(1).toString();
String containerName = path.split(">",2)[0];
String className = path.split(">",2)[1].split("\\.")[0];
String containerName = path.split(">", 2)[0];
String className = path.split(">", 2)[1].split("\\.")[0];
FileContainer container = BytecodeViewer.getFileContainer(containerName);
final ClassNode fN = container.getClassNode(className);
if (fN != null)
{
MainViewerGUI.getComponent(FileNavigationPane.class).openClassFileToWorkSpace(container, className + ".class", fN);
if (fN != null) {
MainViewerGUI.getComponent(FileNavigationPane.class).openClassFileToWorkSpace(container,
className + ".class", fN);
}
}
});
@ -194,8 +186,7 @@ public class SearchingPane extends VisibleComponent
}
public void search()
{
public void search() {
treeRoot.removeAllChildren();
searchType = (SearchType) typeBox.getSelectedItem();
final SearchRadius radius = (SearchRadius) searchRadiusBox
@ -213,7 +204,8 @@ public class SearchingPane extends VisibleComponent
public void doSearch() {
try {
Pattern.compile(RegexInsnFinder.processRegex(RegexSearch.searchText.getText()), Pattern.MULTILINE);
Pattern.compile(RegexInsnFinder.processRegex(RegexSearch.searchText.getText()),
Pattern.MULTILINE);
} catch (PatternSyntaxException ex) {
BytecodeViewer.showMessage("You have an error in your regex syntax.");
}
@ -236,7 +228,8 @@ public class SearchingPane extends VisibleComponent
t.start();
} else { // this should really never be called.
BytecodeViewer
.showMessage("You currently have a search performing in the background, please wait for that to finish.");
.showMessage("You currently have a search performing in the background, please wait for that "
+ "to finish.");
}
} else if (radius == SearchRadius.Current_Class) {
final Viewer cv = MainViewerGUI.getComponent(WorkPane.class).getCurrentViewer();
@ -260,7 +253,7 @@ public class SearchingPane extends VisibleComponent
}
public enum SearchRadius {
All_Classes, Current_Class;
All_Classes, Current_Class
}
public void resetWorkspace() {

View file

@ -1,16 +1,8 @@
package the.bytecode.club.bytecodeviewer.gui;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JFrame;
import javax.swing.JTextField;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import javax.swing.JScrollPane;
import java.awt.BorderLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
@ -18,16 +10,18 @@ import java.awt.event.KeyListener;
import java.io.IOException;
import java.io.OutputStream;
import java.io.PrintStream;
import javax.swing.JTextArea;
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
import the.bytecode.club.bytecodeviewer.Resources;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.text.DefaultHighlighter;
import javax.swing.text.Highlighter;
import javax.swing.text.JTextComponent;
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
import the.bytecode.club.bytecodeviewer.Resources;
/***************************************************************************
* Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite *
@ -60,7 +54,7 @@ public class SystemErrConsole extends JFrame {
JScrollPane scrollPane = new JScrollPane();
public JCheckBox check = new JCheckBox("Exact");
final JTextField field = new JTextField();
private PrintStream originalOut;
private final PrintStream originalOut;
public SystemErrConsole(String title) {
this.setIconImages(Resources.iconList);
@ -154,7 +148,7 @@ public class SystemErrConsole extends JFrame {
if (s.startsWith("File '")) {
String[] split = s.split("'");
String start = split[0] + "'" + split[1] + "', ";
s = s.substring(start.length(), s.length());
s = s.substring(start.length());
}
replace += s + BytecodeViewer.nl;
}
@ -255,7 +249,7 @@ public class SystemErrConsole extends JFrame {
}
}
private DefaultHighlighter.DefaultHighlightPainter painter = new DefaultHighlighter.DefaultHighlightPainter(
private final DefaultHighlighter.DefaultHighlightPainter painter = new DefaultHighlighter.DefaultHighlightPainter(
new Color(255, 62, 150));
public void highlight(JTextComponent textComp, String pattern) {
@ -311,8 +305,8 @@ public class SystemErrConsole extends JFrame {
}
class CustomOutputStream extends OutputStream {
private StringBuilder sb = new StringBuilder();
private JTextArea textArea;
private final StringBuilder sb = new StringBuilder();
private final JTextArea textArea;
public CustomOutputStream(JTextArea textArea) {
this.textArea = textArea;
@ -324,7 +318,7 @@ public class SystemErrConsole extends JFrame {
@Override
public void write(int b) throws IOException {
sb.append(String.valueOf((char) b));
sb.append((char) b);
}
}

View file

@ -1,14 +1,18 @@
package the.bytecode.club.bytecodeviewer.gui;
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
import java.awt.*;
import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Component;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import javax.swing.AbstractButton;
import javax.swing.BorderFactory;
import javax.swing.JButton;
@ -18,6 +22,7 @@ import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.JTabbedPane;
import javax.swing.plaf.basic.BasicButtonUI;
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
/***************************************************************************
* Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite *
@ -46,15 +51,15 @@ import javax.swing.plaf.basic.BasicButtonUI;
public class TabbedPane extends JPanel {
private static final long serialVersionUID = -4774885688297538774L;
public static final Color BLANK = new Color(0,0,0,0);
public static final Color BLANK = new Color(0, 0, 0, 0);
private final JTabbedPane pane;
public final JLabel label;
private final JButton button = new TabButton();
private static long zero = System.currentTimeMillis();
private long startedDragging = 0;
private final long startedDragging = 0;
private boolean dragging = false;
private DelayTabbedPaneThread probablyABadIdea;
private TabbedPane THIS = this;
private final TabbedPane THIS = this;
public String tabName;
public String fileContainerName;
@ -149,10 +154,21 @@ public class TabbedPane extends JPanel {
}
}
@Override public void mouseEntered(MouseEvent arg0) { }
@Override public void mouseExited(MouseEvent arg0) { }
@Override public void mousePressed(MouseEvent arg0) { }
@Override public void mouseReleased(MouseEvent e) { }
@Override
public void mouseEntered(MouseEvent arg0) {
}
@Override
public void mouseExited(MouseEvent arg0) {
}
@Override
public void mousePressed(MouseEvent arg0) {
}
@Override
public void mouseReleased(MouseEvent e) {
}
});
/*this.addMouseListener(new MouseListener() {
@Override public void mouseClicked(MouseEvent e) {}
@ -194,46 +210,37 @@ public class TabbedPane extends JPanel {
});*/
}
private void stopDragging(int mouseX, int mouseY)
{
if(System.currentTimeMillis()-startedDragging >= 210)
{
private void stopDragging(int mouseX, int mouseY) {
if (System.currentTimeMillis() - startedDragging >= 210) {
Rectangle bounds = new Rectangle(1, 1, mouseX, mouseY);
System.out.println("debug-5: " + mouseX+", " + mouseY);
System.out.println("debug-5: " + mouseX + ", " + mouseY);
int totalTabs = BytecodeViewer.viewer.workPane.tabs.getTabCount();
int index = -1;
for(int i = 0; i < totalTabs; i++)
{
for (int i = 0; i < totalTabs; i++) {
Component c = BytecodeViewer.viewer.workPane.tabs.getTabComponentAt(i);
if(c != null && bounds.intersects(c.getBounds()))
{
if (c != null && bounds.intersects(c.getBounds())) {
index = i; //replace this tabs position
}
}
if(index == -1)
{
for (int i = 0; i < totalTabs; i++)
{
if (index == -1) {
for (int i = 0; i < totalTabs; i++) {
Component c = BytecodeViewer.viewer.workPane.tabs.getTabComponentAt(i);
//do some check to see if it's past the X or Y
if(c != null)
{
if (c != null) {
System.out.println("debug-6: " + c.getBounds());
}
}
}
if(index != -1)
{
if (index != -1) {
BytecodeViewer.viewer.workPane.tabs.remove(this);
BytecodeViewer.viewer.workPane.tabs.setTabComponentAt(index, this);
}
}
dragging = false;
label.setBackground(BLANK);
if(probablyABadIdea != null)
{
if (probablyABadIdea != null) {
probablyABadIdea.stopped = true;
}
label.updateUI();
@ -276,8 +283,7 @@ public class TabbedPane extends JPanel {
// paint the cross
@Override
protected void paintComponent(final Graphics g)
{
protected void paintComponent(final Graphics g) {
super.paintComponent(g);
final Graphics2D g2 = (Graphics2D) g.create();
// shift the image for pressed buttons

View file

@ -1,7 +1,6 @@
package the.bytecode.club.bytecodeviewer.gui;
import javax.swing.JPanel;
import org.objectweb.asm.tree.ClassNode;
import the.bytecode.club.bytecodeviewer.util.FileContainer;

View file

@ -1,9 +1,7 @@
package the.bytecode.club.bytecodeviewer.gui;
import javax.swing.JInternalFrame;
import org.objectweb.asm.tree.ClassNode;
import the.bytecode.club.bytecodeviewer.util.FileChangeNotifier;
import the.bytecode.club.bytecodeviewer.util.FileContainer;

View file

@ -1,15 +1,25 @@
package the.bytecode.club.bytecodeviewer.gui;
import java.awt.*;
import java.awt.event.*;
import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.FlowLayout;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ContainerEvent;
import java.awt.event.ContainerListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.util.HashMap;
import javax.swing.*;
import javax.swing.JButton;
import javax.swing.JMenuItem;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.JTabbedPane;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
import org.objectweb.asm.tree.ClassNode;
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
import the.bytecode.club.bytecodeviewer.util.FileChangeNotifier;
import the.bytecode.club.bytecodeviewer.util.FileContainer;
@ -34,293 +44,284 @@ import the.bytecode.club.bytecodeviewer.util.FileContainer;
/**
* The pane that contains all of the classes as tabs.
*
*
* @author Konloch
* @author WaterWolf
*
*/
public class WorkPane extends VisibleComponent implements ActionListener {
private static final long serialVersionUID = 6542337997679487946L;
private static final long serialVersionUID = 6542337997679487946L;
FileChangeNotifier fcn;
public JTabbedPane tabs;
FileChangeNotifier fcn;
public JTabbedPane tabs;
JPanel buttonPanel;
JButton refreshClass;
JPanel buttonPanel;
JButton refreshClass;
HashMap<String, Integer> workingOn = new HashMap<String, Integer>();
HashMap<String, Integer> workingOn = new HashMap<String, Integer>();
public static int SyntaxFontHeight = 12;
public static int SyntaxFontHeight = 12;
public WorkPane(final FileChangeNotifier fcn) {
super("WorkPanel");
setTitle("Work Space");
public WorkPane(final FileChangeNotifier fcn) {
super("WorkPanel");
setTitle("Work Space");
this.tabs = new JTabbedPane();
this.fcn = fcn;
this.tabs = new JTabbedPane();
this.fcn = fcn;
JPopupMenu pop_up = new JPopupMenu()
{
@Override
public void setVisible(boolean b) {
super.setVisible(b);
}
};
JMenuItem closealltab = new JMenuItem("Close All But This");
JMenuItem closetab = new JMenuItem("Close Tab");
closetab.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
JPopupMenu pop_up = new JPopupMenu() {
@Override
public void setVisible(boolean b) {
super.setVisible(b);
}
};
JMenuItem closealltab = new JMenuItem("Close All But This");
JMenuItem closetab = new JMenuItem("Close Tab");
closetab.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
/*String name = e.getActionCommand().split(": ")[1];
final int i = pane.indexOfTab(name);
if (i != -1)
pane.remove(i);*/
}
});
closealltab.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
String name = e.getActionCommand().split(": ")[1];
System.out.println("debug-3: "+name);
boolean removedAll = false;
while (!removedAll) {
int thisID = tabs.indexOfTab(name);
if (tabs.getTabCount() <= 1) {
removedAll = true;
return;
}
if (thisID != 0)
tabs.remove(0);
else
tabs.remove(1);
}
}
});
tabs.addMouseListener(new MouseListener() {
@Override public void mouseClicked(MouseEvent e) {}
@Override public void mouseEntered(MouseEvent arg0) {
}
@Override public void mouseExited(MouseEvent arg0) {
}
@Override public void mousePressed(MouseEvent e) {
if(e.getButton() == 3)
{
if(BytecodeViewer.BLOCK_TAB_MENU)
return;
}
});
closealltab.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
String name = e.getActionCommand().split(": ")[1];
System.out.println("debug-3: " + name);
boolean removedAll = false;
while (!removedAll) {
int thisID = tabs.indexOfTab(name);
if (tabs.getTabCount() <= 1) {
removedAll = true;
return;
}
if (thisID != 0)
tabs.remove(0);
else
tabs.remove(1);
}
}
});
tabs.addMouseListener(new MouseListener() {
@Override
public void mouseClicked(MouseEvent e) {
}
Rectangle bounds = new Rectangle(1, 1, e.getX(), e.getY());
Point point = tabs.getMousePosition();
System.out.println("debug-1: " +point);
for(int i = 0; i < BytecodeViewer.viewer.workPane.tabs.getTabCount(); i++)
{
Component c = BytecodeViewer.viewer.workPane.tabs.getTabComponentAt(i);
if(c != null && bounds.intersects(c.getBounds()))
{
pop_up.setVisible(true);
closealltab.setText("Close All But This: " + ((TabbedPane)c).tabName);
closetab.setText("Close Tab: " + ((TabbedPane)c).tabName);
//do something with this shit
//BytecodeViewer.viewer.workPane.tabs.setSelectedIndex(i);
}
else
{
pop_up.setVisible(false);
}
}
@Override
public void mouseEntered(MouseEvent arg0) {
}
System.out.println("debug-2: " +e.getX()+", "+e.getY());
}
}
@Override public void mouseReleased(MouseEvent e) {
}
});
@Override
public void mouseExited(MouseEvent arg0) {
}
pop_up.add(closealltab);
pop_up.add(closetab);
@Override
public void mousePressed(MouseEvent e) {
if (e.getButton() == 3) {
if (BytecodeViewer.BLOCK_TAB_MENU)
return;
Rectangle bounds = new Rectangle(1, 1, e.getX(), e.getY());
Point point = tabs.getMousePosition();
System.out.println("debug-1: " + point);
for (int i = 0; i < BytecodeViewer.viewer.workPane.tabs.getTabCount(); i++) {
Component c = BytecodeViewer.viewer.workPane.tabs.getTabComponentAt(i);
if (c != null && bounds.intersects(c.getBounds())) {
pop_up.setVisible(true);
closealltab.setText("Close All But This: " + ((TabbedPane) c).tabName);
closetab.setText("Close Tab: " + ((TabbedPane) c).tabName);
//do something with this shit
//BytecodeViewer.viewer.workPane.tabs.setSelectedIndex(i);
} else {
pop_up.setVisible(false);
}
}
System.out.println("debug-2: " + e.getX() + ", " + e.getY());
}
}
@Override
public void mouseReleased(MouseEvent e) {
}
});
pop_up.add(closealltab);
pop_up.add(closetab);
if(!BytecodeViewer.BLOCK_TAB_MENU)
tabs.setComponentPopupMenu(pop_up);
if (!BytecodeViewer.BLOCK_TAB_MENU)
tabs.setComponentPopupMenu(pop_up);
getContentPane().setLayout(new BorderLayout());
getContentPane().setLayout(new BorderLayout());
getContentPane().add(tabs, BorderLayout.CENTER);
getContentPane().add(tabs, BorderLayout.CENTER);
buttonPanel = new JPanel(new FlowLayout());
buttonPanel = new JPanel(new FlowLayout());
refreshClass = new JButton("Refresh");
refreshClass.addActionListener(this);
refreshClass = new JButton("Refresh");
refreshClass.addActionListener(this);
buttonPanel.add(refreshClass);
buttonPanel.add(refreshClass);
buttonPanel.setVisible(false);
getContentPane().add(buttonPanel, BorderLayout.SOUTH);
buttonPanel.setVisible(false);
getContentPane().add(buttonPanel, BorderLayout.SOUTH);
tabs.addContainerListener(new ContainerListener() {
tabs.addContainerListener(new ContainerListener() {
@Override
public void componentAdded(final ContainerEvent e) {
}
@Override
public void componentAdded(final ContainerEvent e) {
}
@Override
public void componentRemoved(final ContainerEvent e) {
final Component c = e.getChild();
if (c instanceof ClassViewer) {
String containerName = ((ClassViewer) c).container.name+">";
String fileName = ((ClassViewer) c).name;
@Override
public void componentRemoved(final ContainerEvent e) {
final Component c = e.getChild();
if (c instanceof ClassViewer) {
String containerName = ((ClassViewer) c).container.name + ">";
String fileName = ((ClassViewer) c).name;
if(fileName.startsWith(containerName))
{
workingOn.remove(fileName);
}
else
{
workingOn.remove(containerName+fileName);
}
}
if (c instanceof FileViewer)
{
String containerName = ((FileViewer) c).container.name+">";
String fileName = ((FileViewer) c).name;
if (fileName.startsWith(containerName)) {
workingOn.remove(fileName);
} else {
workingOn.remove(containerName + fileName);
}
}
if (c instanceof FileViewer) {
String containerName = ((FileViewer) c).container.name + ">";
String fileName = ((FileViewer) c).name;
if(fileName.startsWith(containerName))
{
workingOn.remove(fileName);
}
else
{
workingOn.remove(containerName+fileName);
}
}
}
if (fileName.startsWith(containerName)) {
workingOn.remove(fileName);
} else {
workingOn.remove(containerName + fileName);
}
}
}
});
tabs.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(final ChangeEvent arg0) {
buttonPanel.setVisible(tabs.getSelectedIndex() != -1);
}
});
});
tabs.addChangeListener(new ChangeListener() {
@Override
public void stateChanged(final ChangeEvent arg0) {
buttonPanel.setVisible(tabs.getSelectedIndex() != -1);
}
});
this.setVisible(true);
this.setVisible(true);
}
}
int tabCount = 0;
int tabCount = 0;
public void addWorkingFile(final FileContainer container, String name, final ClassNode cn) {
String workingName = container.name+">"+name;
String containerName = name;
public void addWorkingFile(final FileContainer container, String name, final ClassNode cn) {
String workingName = container.name + ">" + name;
String containerName = name;
if(BytecodeViewer.displayParentInTab)
containerName = container.name+">"+name;
if (BytecodeViewer.displayParentInTab)
containerName = container.name + ">" + name;
if (!workingOn.containsKey(workingName)) {
final JPanel tabComp = new ClassViewer(container, containerName, cn);
tabs.add(tabComp);
final int tabCount = tabs.indexOfComponent(tabComp);
workingOn.put(workingName, tabCount);
TabbedPane tabbedPane = new TabbedPane(container.name, name,tabs);
((ClassViewer) tabComp).tabbedPane = tabbedPane;
tabs.setTabComponentAt(tabCount, tabbedPane);
tabs.setSelectedIndex(tabCount);
} else {
tabs.setSelectedIndex(workingOn.get(workingName));
}
}
public void addFile(final FileContainer container, String name, byte[] contents) {
String workingName = container.name+">"+name;
if (!workingOn.containsKey(workingName)) {
final JPanel tabComp = new ClassViewer(container, containerName, cn);
tabs.add(tabComp);
final int tabCount = tabs.indexOfComponent(tabComp);
workingOn.put(workingName, tabCount);
TabbedPane tabbedPane = new TabbedPane(container.name, name, tabs);
((ClassViewer) tabComp).tabbedPane = tabbedPane;
tabs.setTabComponentAt(tabCount, tabbedPane);
tabs.setSelectedIndex(tabCount);
} else {
tabs.setSelectedIndex(workingOn.get(workingName));
}
}
if(BytecodeViewer.displayParentInTab)
name = container.name+">"+name;
public void addFile(final FileContainer container, String name, byte[] contents) {
String workingName = container.name + ">" + name;
if(contents == null) //a directory
return;
if (!workingOn.containsKey(workingName)) {
final Component tabComp = new FileViewer(container, name, contents);
tabs.add(tabComp);
final int tabCount = tabs.indexOfComponent(tabComp);
workingOn.put(workingName, tabCount);
if (BytecodeViewer.displayParentInTab)
name = container.name + ">" + name;
TabbedPane tabbedPane = new TabbedPane(null, name,tabs);
((FileViewer) tabComp).tabbedPane = tabbedPane;
tabs.setTabComponentAt(tabCount, tabbedPane);
tabs.setSelectedIndex(tabCount);
} else {
try
{
tabs.setSelectedIndex(workingOn.get(workingName));
}
catch(java.lang.IndexOutOfBoundsException e)
{
//workingOn.remove(workingName);
e.printStackTrace();
}
catch(Exception e)
{
e.printStackTrace();
}
}
}
if (contents == null) //a directory
return;
@Override
public void openClassFile(final FileContainer container, final String name, final ClassNode cn) {
addWorkingFile(container, name, cn);
}
if (!workingOn.containsKey(workingName)) {
final Component tabComp = new FileViewer(container, name, contents);
tabs.add(tabComp);
final int tabCount = tabs.indexOfComponent(tabComp);
workingOn.put(workingName, tabCount);
@Override
public void openFile(final FileContainer container, final String name, byte[] content) {
addFile(container, name, content);
}
TabbedPane tabbedPane = new TabbedPane(null, name, tabs);
((FileViewer) tabComp).tabbedPane = tabbedPane;
tabs.setTabComponentAt(tabCount, tabbedPane);
tabs.setSelectedIndex(tabCount);
} else {
try {
tabs.setSelectedIndex(workingOn.get(workingName));
} catch (java.lang.IndexOutOfBoundsException e) {
//workingOn.remove(workingName);
e.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}
}
}
public Viewer getCurrentViewer() {
return (Viewer) tabs.getSelectedComponent();
}
@Override
public void openClassFile(final FileContainer container, final String name, final ClassNode cn) {
addWorkingFile(container, name, cn);
}
public java.awt.Component[] getLoadedViewers() {
return (java.awt.Component[])tabs.getComponents();
}
@Override
public void actionPerformed(final ActionEvent arg0) {
Thread t = new Thread() {
public void run() {
if(BytecodeViewer.viewer.autoCompileOnRefresh.isSelected())
try {
if(!BytecodeViewer.compile(false))
return;
} catch(java.lang.NullPointerException e) {
}
final JButton src = (JButton) arg0.getSource();
if (src == refreshClass) {
final Component tabComp = tabs.getSelectedComponent();
if (tabComp != null) {
if(tabComp instanceof ClassViewer) {
src.setEnabled(false);
BytecodeViewer.viewer.setIcon(true);
((ClassViewer) tabComp).startPaneUpdater(src);
BytecodeViewer.viewer.setIcon(false);
} else if(tabComp instanceof FileViewer) {
src.setEnabled(false);
BytecodeViewer.viewer.setIcon(true);
((FileViewer) tabComp).refresh(src);
BytecodeViewer.viewer.setIcon(false);
}
}
}
}
};
t.start();
}
@Override
public void openFile(final FileContainer container, final String name, byte[] content) {
addFile(container, name, content);
}
public void resetWorkspace() {
tabs.removeAll();
tabs.updateUI();
}
public Viewer getCurrentViewer() {
return (Viewer) tabs.getSelectedComponent();
}
public java.awt.Component[] getLoadedViewers() {
return tabs.getComponents();
}
@Override
public void actionPerformed(final ActionEvent arg0) {
Thread t = new Thread() {
public void run() {
if (BytecodeViewer.viewer.autoCompileOnRefresh.isSelected())
try {
if (!BytecodeViewer.compile(false))
return;
} catch (java.lang.NullPointerException e) {
}
final JButton src = (JButton) arg0.getSource();
if (src == refreshClass) {
final Component tabComp = tabs.getSelectedComponent();
if (tabComp != null) {
if (tabComp instanceof ClassViewer) {
src.setEnabled(false);
BytecodeViewer.viewer.setIcon(true);
((ClassViewer) tabComp).startPaneUpdater(src);
BytecodeViewer.viewer.setIcon(false);
} else if (tabComp instanceof FileViewer) {
src.setEnabled(false);
BytecodeViewer.viewer.setIcon(true);
((FileViewer) tabComp).refresh(src);
BytecodeViewer.viewer.setIcon(false);
}
}
}
}
};
t.start();
}
public void resetWorkspace() {
tabs.removeAll();
tabs.updateUI();
}
}

View file

@ -1,7 +1,6 @@
package the.bytecode.club.bytecodeviewer.obfuscators;
import java.util.ArrayList;
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
import the.bytecode.club.bytecodeviewer.util.MiscUtils;
@ -53,7 +52,7 @@ public abstract class JavaObfuscator extends Thread {
public static int MAX_STRING_LENGTH = 25;
public static int MIN_STRING_LENGTH = 5;
private ArrayList<String> names = new ArrayList<String>();
private final ArrayList<String> names = new ArrayList<String>();
protected String generateUniqueName(int length) {
boolean found = false;

View file

@ -1,7 +1,6 @@
package the.bytecode.club.bytecodeviewer.obfuscators;
import org.objectweb.asm.tree.ClassNode;
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
import the.bytecode.club.bytecodeviewer.api.ASMUtil_OLD;

View file

@ -2,7 +2,6 @@ package the.bytecode.club.bytecodeviewer.obfuscators;
import org.objectweb.asm.tree.ClassNode;
import org.objectweb.asm.tree.FieldNode;
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
import the.bytecode.club.bytecodeviewer.api.ASMUtil_OLD;

View file

@ -3,7 +3,6 @@ package the.bytecode.club.bytecodeviewer.obfuscators;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.tree.ClassNode;
import org.objectweb.asm.tree.MethodNode;
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
import the.bytecode.club.bytecodeviewer.api.ASMUtil_OLD;

View file

@ -2,7 +2,6 @@ package the.bytecode.club.bytecodeviewer.obfuscators.mapping;
import java.util.ArrayList;
import java.util.List;
import the.bytecode.club.bytecodeviewer.obfuscators.mapping.data.FieldMappingData;
import the.bytecode.club.bytecodeviewer.obfuscators.mapping.data.MappingData;
import the.bytecode.club.bytecodeviewer.obfuscators.mapping.data.MethodMappingData;

View file

@ -4,7 +4,6 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import the.bytecode.club.bytecodeviewer.obfuscators.mapping.data.FieldMappingData;
import the.bytecode.club.bytecodeviewer.obfuscators.mapping.data.MappingData;
import the.bytecode.club.bytecodeviewer.obfuscators.mapping.data.MethodMappingData;
@ -37,7 +36,7 @@ public class RefactorMapper extends Remapper {
protected final Map<String, FieldMappingData> sortedFields;
protected final List<String> mappingList;
private StringBuilder builder;
private final StringBuilder builder;
public RefactorMapper(HookMap hookMap) {
sortedClasses = new HashMap<>();
@ -70,7 +69,7 @@ public class RefactorMapper extends Remapper {
@Override
public String map(String type) {
if (sortedClasses.containsKey(type)) {
String map = new String(type + " --> " + sortedClasses.get(type).getRefactoredName() + "\n");
String map = type + " --> " + sortedClasses.get(type).getRefactoredName() + "\n";
if (!mappingList.contains(map))
mappingList.add(map);
@ -83,7 +82,8 @@ public class RefactorMapper extends Remapper {
public String mapFieldName(String owner, String name, String desc) {
String obfKey = owner + "$$$$" + name + "$$$$" + desc;
if (sortedFields.containsKey(obfKey)) {
String map = new String(owner + "." + name + " --> " + owner + sortedFields.get(obfKey).getName().getRefactoredName() + "\n");
String map =
owner + "." + name + " --> " + owner + sortedFields.get(obfKey).getName().getRefactoredName() + "\n";
if (!mappingList.contains(map))
mappingList.add(map);
name = sortedFields.get(obfKey).getName().getRefactoredName();
@ -95,7 +95,8 @@ public class RefactorMapper extends Remapper {
public String mapMethodName(String owner, String name, String desc) {
String obfKey = owner + "$$$$" + name + "$$$$" + desc;
if (sortedMethods.containsKey(obfKey)) {
String map = new String(owner + "." + name + " --> " + owner + sortedMethods.get(obfKey).getMethodName().getRefactoredName() + "\n");
String map =
owner + "." + name + " --> " + owner + sortedMethods.get(obfKey).getMethodName().getRefactoredName() + "\n";
if (!mappingList.contains(map))
mappingList.add(map);
name = sortedMethods.get(obfKey).getMethodName().getRefactoredName();

View file

@ -2,11 +2,9 @@ package the.bytecode.club.bytecodeviewer.obfuscators.mapping;
import java.util.HashMap;
import java.util.Map;
import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.tree.ClassNode;
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
/***************************************************************************
@ -52,7 +50,7 @@ public class Refactorer {
String oldName = cn.name;
ClassReader cr = new ClassReader(getClassNodeBytes(cn));
ClassWriter cw = new ClassWriter(cr, 0);
RemappingClassAdapter rca = new RemappingClassAdapter(cw, (RefactorMapper) mapper);
RemappingClassAdapter rca = new RemappingClassAdapter(cw, mapper);
cr.accept(rca, ClassReader.EXPAND_FRAMES);
cr = new ClassReader(cw.toByteArray());
cn = new ClassNode();

View file

@ -48,40 +48,39 @@ import org.objectweb.asm.signature.SignatureWriter;
*
* @author Eugene Kuleshov
*/
public abstract class Remapper extends org.objectweb.asm.commons.Remapper
{
public abstract class Remapper extends org.objectweb.asm.commons.Remapper {
public String mapDesc(String desc) {
Type t = Type.getType(desc);
switch (t.getSort()) {
case Type.ARRAY:
String s = mapDesc(t.getElementType().getDescriptor());
for (int i = 0; i < t.getDimensions(); ++i) {
s = '[' + s;
}
return s;
case Type.OBJECT:
String newType = map(t.getInternalName());
if (newType != null) {
return 'L' + newType + ';';
}
case Type.ARRAY:
String s = mapDesc(t.getElementType().getDescriptor());
for (int i = 0; i < t.getDimensions(); ++i) {
s = '[' + s;
}
return s;
case Type.OBJECT:
String newType = map(t.getInternalName());
if (newType != null) {
return 'L' + newType + ';';
}
}
return desc;
}
private Type mapType(Type t) {
switch (t.getSort()) {
case Type.ARRAY:
String s = mapDesc(t.getElementType().getDescriptor());
for (int i = 0; i < t.getDimensions(); ++i) {
s = '[' + s;
}
return Type.getType(s);
case Type.OBJECT:
s = map(t.getInternalName());
return s != null ? Type.getObjectType(s) : t;
case Type.METHOD:
return Type.getMethodType(mapMethodDesc(t.getDescriptor()));
case Type.ARRAY:
String s = mapDesc(t.getElementType().getDescriptor());
for (int i = 0; i < t.getDimensions(); ++i) {
s = '[' + s;
}
return Type.getType(s);
case Type.OBJECT:
s = map(t.getInternalName());
return s != null ? Type.getObjectType(s) : t;
case Type.METHOD:
return Type.getMethodType(mapMethodDesc(t.getDescriptor()));
}
return t;
}

View file

@ -91,10 +91,7 @@ public class FieldMappingData {
} else if (!fieldOwner.equals(other.fieldOwner))
return false;
if (name == null) {
if (other.name != null)
return false;
} else if (!name.equals(other.name))
return false;
return true;
return other.name == null;
} else return name.equals(other.name);
}
}

View file

@ -74,10 +74,7 @@ public class MappingData {
} else if (!obfuscatedName.equals(other.obfuscatedName))
return false;
if (refactoredName == null) {
if (other.refactoredName != null)
return false;
} else if (!refactoredName.equals(other.refactoredName))
return false;
return true;
return other.refactoredName == null;
} else return refactoredName.equals(other.refactoredName);
}
}

View file

@ -91,10 +91,7 @@ public class MethodMappingData {
} else if (!methodName.equals(other.methodName))
return false;
if (methodOwner == null) {
if (other.methodOwner != null)
return false;
} else if (!methodOwner.equals(other.methodOwner))
return false;
return true;
return other.methodOwner == null;
} else return methodOwner.equals(other.methodOwner);
}
}

View file

@ -3,7 +3,6 @@ package the.bytecode.club.bytecodeviewer.obfuscators.rename;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.tree.ClassNode;
import org.objectweb.asm.tree.MethodNode;
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
import the.bytecode.club.bytecodeviewer.obfuscators.JavaObfuscator;
import the.bytecode.club.bytecodeviewer.obfuscators.mapping.data.MappingData;

View file

@ -2,7 +2,6 @@ package the.bytecode.club.bytecodeviewer.obfuscators.rename;
import org.objectweb.asm.tree.ClassNode;
import org.objectweb.asm.tree.FieldNode;
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
import the.bytecode.club.bytecodeviewer.obfuscators.JavaObfuscator;
import the.bytecode.club.bytecodeviewer.obfuscators.mapping.data.FieldMappingData;
@ -45,7 +44,8 @@ public class RenameFields extends JavaObfuscator {
String newName = generateUniqueName(stringLength);
BytecodeViewer.refactorer.getHooks().addField(new FieldMappingData(c.name, new MappingData(f.name, newName), f.desc));
BytecodeViewer.refactorer.getHooks().addField(new FieldMappingData(c.name, new MappingData(f.name,
newName), f.desc));
/*ASMUtil_OLD.renameFieldNode(c.name, f.name, f.desc, null, newName, null);
f.name = newName;*/

View file

@ -3,7 +3,6 @@ package the.bytecode.club.bytecodeviewer.obfuscators.rename;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.tree.ClassNode;
import org.objectweb.asm.tree.MethodNode;
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
import the.bytecode.club.bytecodeviewer.obfuscators.JavaObfuscator;
import the.bytecode.club.bytecodeviewer.obfuscators.mapping.data.MappingData;
@ -68,7 +67,8 @@ public class RenameMethods extends JavaObfuscator {
&& !m.name.equals("<clinit>")) {
String newName = generateUniqueName(stringLength);
BytecodeViewer.refactorer.getHooks().addMethod(new MethodMappingData(c.name, new MappingData(m.name, newName), m.desc));
BytecodeViewer.refactorer.getHooks().addMethod(new MethodMappingData(c.name,
new MappingData(m.name, newName), m.desc));
/*ASMUtil_OLD.renameMethodNode(c.name, m.name, m.desc,
null, newName, null);*/

View file

@ -1,7 +1,6 @@
package the.bytecode.club.bytecodeviewer.plugin;
import java.io.File;
import the.bytecode.club.bytecodeviewer.api.Plugin;
/***************************************************************************
@ -26,7 +25,7 @@ import the.bytecode.club.bytecodeviewer.api.Plugin;
* @author Bibl (don't ban me pls)
* @created 1 Jun 2015
*/
public abstract interface PluginLaunchStrategy {
public interface PluginLaunchStrategy {
public abstract Plugin run(File file) throws Throwable;
Plugin run(File file) throws Throwable;
}

View file

@ -4,17 +4,15 @@ import java.io.File;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import javax.swing.filechooser.FileFilter;
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
import the.bytecode.club.bytecodeviewer.util.MiscUtils;
import the.bytecode.club.bytecodeviewer.api.Plugin;
import the.bytecode.club.bytecodeviewer.plugin.strategies.CompiledJavaPluginLaunchStrategy;
import the.bytecode.club.bytecodeviewer.plugin.strategies.GroovyPluginLaunchStrategy;
import the.bytecode.club.bytecodeviewer.plugin.strategies.JavaPluginLaunchStrategy;
import the.bytecode.club.bytecodeviewer.plugin.strategies.PythonPluginLaunchStrategy;
import the.bytecode.club.bytecodeviewer.plugin.strategies.RubyPluginLaunchStrategy;
import the.bytecode.club.bytecodeviewer.util.MiscUtils;
/***************************************************************************
* Bytecode Viewer (BCV) - Java & Android Reverse Engineering Suite *
@ -45,7 +43,8 @@ import the.bytecode.club.bytecodeviewer.plugin.strategies.RubyPluginLaunchStrate
*/
public final class PluginManager {
private static final Map<String, PluginLaunchStrategy> launchStrategies = new HashMap<String, PluginLaunchStrategy>();
private static final Map<String, PluginLaunchStrategy> launchStrategies = new HashMap<String,
PluginLaunchStrategy>();
private static final PluginFileFilter filter = new PluginFileFilter();
private static Plugin pluginInstance;
@ -76,7 +75,8 @@ public final class PluginManager {
pluginInstance = newPluginInstance;
pluginInstance.start(); // start the thread
} else if (!pluginInstance.isFinished()) {
BytecodeViewer.showMessage("There is currently another plugin running right now, please wait for that to finish executing.");
BytecodeViewer.showMessage("There is currently another plugin running right now, please wait for that to "
+ "finish executing.");
}
}
@ -91,7 +91,8 @@ public final class PluginManager {
PluginLaunchStrategy strategy = launchStrategies.get(ext);
if (strategy == null) {
throw new RuntimeException(String.format("No launch strategy for extension %s (%s)", ext, f.getAbsolutePath()));
throw new RuntimeException(String.format("No launch strategy for extension %s (%s)", ext,
f.getAbsolutePath()));
}
Plugin p = strategy.run(f);

View file

@ -1,9 +1,7 @@
package the.bytecode.club.bytecodeviewer.plugin.preinstalled;
import java.util.ArrayList;
import org.objectweb.asm.tree.ClassNode;
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
import the.bytecode.club.bytecodeviewer.api.Plugin;

View file

@ -1,21 +1,17 @@
package the.bytecode.club.bytecodeviewer.plugin.preinstalled;
import com.mxgraph.swing.mxGraphComponent;
import com.mxgraph.view.mxGraph;
import java.awt.Font;
import java.awt.font.FontRenderContext;
import java.awt.geom.AffineTransform;
import java.util.ArrayList;
import javax.swing.JFrame;
import javax.swing.UIManager;
import org.objectweb.asm.tree.AbstractInsnNode;
import org.objectweb.asm.tree.ClassNode;
import org.objectweb.asm.tree.MethodInsnNode;
import org.objectweb.asm.tree.MethodNode;
import com.mxgraph.swing.mxGraphComponent;
import com.mxgraph.view.mxGraph;
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
import the.bytecode.club.bytecodeviewer.Resources;
import the.bytecode.club.bytecodeviewer.api.Plugin;
@ -87,16 +83,18 @@ public class CodeSequenceDiagram extends Plugin {
int testY = 0;
double magicNumber = 5.8;
for (MethodNode m : (ArrayList<MethodNode>) c.methods) {
for (MethodNode m : c.methods) {
String mIdentifier = c.name + "." + m.name + m.desc;
Object node = graph.insertVertex(parent, null, mIdentifier, testX, testY, mIdentifier.length() * magicNumber, 30);
Object node = graph.insertVertex(parent, null, mIdentifier, testX, testY,
mIdentifier.length() * magicNumber, 30);
Object attach = node;
testX += (int) (font.getStringBounds(mIdentifier, frc).getWidth()) + 60;
for (AbstractInsnNode i : m.instructions.toArray()) {
if (i instanceof MethodInsnNode) {
MethodInsnNode mi = (MethodInsnNode) i;
String identifier = mi.owner + "." + mi.name + mi.desc;
Object node2 = graph.insertVertex(parent, null, identifier, testX, testY, identifier.length() * 5, 30);
Object node2 = graph.insertVertex(parent, null, identifier, testX, testY,
identifier.length() * 5, 30);
testX += (int) (font.getStringBounds(identifier, frc).getWidth()) + 60;
graph.insertEdge(parent, null, null, attach, node2);
attach = node2;

View file

@ -4,14 +4,12 @@ import java.io.PrintWriter;
import java.io.StringWriter;
import java.lang.reflect.Method;
import java.util.ArrayList;
import org.objectweb.asm.Opcodes;
import org.objectweb.asm.tree.ClassNode;
import org.objectweb.asm.tree.FieldNode;
import org.objectweb.asm.tree.LdcInsnNode;
import org.objectweb.asm.tree.MethodInsnNode;
import org.objectweb.asm.tree.MethodNode;
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
import the.bytecode.club.bytecodeviewer.api.BytecodeHook;
import the.bytecode.club.bytecodeviewer.api.Plugin;
@ -49,13 +47,18 @@ import the.bytecode.club.bytecodeviewer.gui.GraphicialReflectionKit;
public class EZInjection extends Plugin {
public static ArrayList<BytecodeHook> hookArray = new ArrayList<BytecodeHook>();
private static String version = "1.0";
private static PluginConsole gui = new PluginConsole("EZ Injection v" + version);
private boolean accessModifiers, injectHooks, invokeMethod, useProxy,
launchKit, console;
private static final String version = "1.0";
private static final PluginConsole gui = new PluginConsole("EZ Injection v" + version);
private final boolean accessModifiers;
private final boolean injectHooks;
private final boolean invokeMethod;
private final boolean useProxy;
private final boolean launchKit;
private final boolean console;
public static boolean sandboxSystem, sandboxRuntime, printCmdL;
private static boolean debugHooks, all = false;
private String invokeMethodInformation, proxy;
private final String invokeMethodInformation;
private final String proxy;
private static String[] debugClasses;
@ -231,7 +234,8 @@ public class EZInjection extends Plugin {
MethodInsnNode mn = (MethodInsnNode) m.instructions
.get(1);
if (mn.owner
.equals(EZInjection.class.getName().replace(".", "/")))//"the/bytecode/club/bytecodeviewer/plugins/EZInjection")) // already been injected
.equals(EZInjection.class.getName().replace(".", "/")))//"the/bytecode/club
// /bytecodeviewer/plugins/EZInjection")) // already been injected
inject = false;
}
if (inject) {
@ -239,7 +243,8 @@ public class EZInjection extends Plugin {
m.instructions
.insert(new MethodInsnNode(
Opcodes.INVOKESTATIC,
EZInjection.class.getName().replace(".", "/"),//"the/bytecode/club/bytecodeviewer/plugins/EZInjection",
EZInjection.class.getName().replace(".", "/"),//"the/bytecode/club
// /bytecodeviewer/plugins/EZInjection",
"hook", "(Ljava/lang/String;)V"));
m.instructions.insert(new LdcInsnNode(classNode.name
+ "." + m.name + m.desc));

Some files were not shown because too many files have changed in this diff Show more