01/11/2015 - Improved the Refresh Class function to be used as the
default compile function.
01/11/2015 - Implemented better error handling for decompiling class
files.
01/15/2015 - CTRL + O will open the add file interface.
01/15/2015 - CTRL + N will open the net workspace interface.
01/15/2015 - It will now save the last directory you opened.
01/15/2015 - Some how the URL for the auto updater change log got
changed, this has been fixed.
01/15/2015 - Slightly updated the change log display, it'll now show all
the changes since your version.
01/16/2015 - Made EZ-Injection UI look a bit nicer.
01/27/2015 - Decided to scrap the  JVM Sandbox POC and use the Security
Manager.
01/27/2015 - BCV now blocks exec and won't allow any ports to be bound.
This commit is contained in:
Kalen Kinloch 2015-01-27 12:10:21 -08:00
parent 2713a8b129
commit bc9cfe13f3
12 changed files with 358 additions and 300 deletions

View file

@ -256,7 +256,7 @@ Changelog:
01/09/2015 - Added add entire directory. 01/09/2015 - Added add entire directory.
01/09/2015 - Fixed import .DEX files. 01/09/2015 - Fixed import .DEX files.
01/10/2015 - Finished Smali Editing. 01/10/2015 - Finished Smali Editing.
01/10/2015 - Fixed a class opening issue with sychronization. 01/10/2015 - Fixed a class opening issue with synchronization.
01/11/2015 - Threaded all of the save functions. 01/11/2015 - Threaded all of the save functions.
01/11/2015 - Removed all instances of the setCursor to busy. 01/11/2015 - Removed all instances of the setCursor to busy.
01/11/2015 - Added are you sure you wish to overwrite this existing file to all the other save functions. 01/11/2015 - Added are you sure you wish to overwrite this existing file to all the other save functions.
@ -264,3 +264,14 @@ Changelog:
01/11/2015 - Updated CFR to CFR_0.94.jar 01/11/2015 - Updated CFR to CFR_0.94.jar
01/11/2015 - Updated to the latest version of FernFlower. 01/11/2015 - Updated to the latest version of FernFlower.
01/11/2015 - Fixed an extension appending issue with save Java file. 01/11/2015 - Fixed an extension appending issue with save Java file.
--- 2.7.0 ---:
01/11/2015 - Improved the Refresh Class function to be used as the default compile function.
01/11/2015 - Implemented better error handling for decompiling class files.
01/15/2015 - CTRL + O will open the add file interface.
01/15/2015 - CTRL + N will open the net workspace interface.
01/15/2015 - It will now save the last directory you opened.
01/15/2015 - Some how the URL for the auto updater change log got changed, this has been fixed.
01/15/2015 - Slightly updated the change log display, it'll now show all the changes since your version.
01/16/2015 - Made EZ-Injection UI look a bit nicer.
01/27/2015 - Decided to scrap the JVM Sandbox POC and use the Security Manager.
01/27/2015 - BCV now blocks exec and won't allow any ports to be bound.

View file

@ -5,13 +5,18 @@ import java.awt.event.ActionEvent;
import java.awt.event.ActionListener; import java.awt.event.ActionListener;
import java.awt.image.BufferedImage; import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File; import java.io.File;
import java.io.FileDescriptor;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.net.InetAddress;
import java.net.URI; import java.net.URI;
import java.net.URL; import java.net.URL;
import java.security.Permission;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map.Entry; import java.util.Map.Entry;
@ -75,6 +80,12 @@ import the.bytecode.club.bytecodeviewer.plugins.PluginManager;
* Option to make the bytecode pane automatically scroll to where the source code pane is * Option to make the bytecode pane automatically scroll to where the source code pane is
* Replacing all string field calls with the string instance - would require EZ-Injection to run code? * Replacing all string field calls with the string instance - would require EZ-Injection to run code?
* Spiffy up the plugin console with red text optional, would require JTextPane, not JTextArea. * Spiffy up the plugin console with red text optional, would require JTextPane, not JTextArea.
* Add robot to malware scanner
* Add right click on tab > close other tabs > close this tab
* Try automatic insert return null for all runtime.exec methods via ASM3; //maybe just do AMS5 then obfuscate the dex2jar shit.
*
* Look at Desktop.getDesktop().open();
* refine POC and just use sec man
* *
* ----Beta 1.0.0-----: * ----Beta 1.0.0-----:
* 10/4/2014 - Designed a POC GUI, still needs a lot of work. * 10/4/2014 - Designed a POC GUI, still needs a lot of work.
@ -282,11 +293,26 @@ import the.bytecode.club.bytecodeviewer.plugins.PluginManager;
* 01/11/2015 - Updated CFR to CFR_0.94.jar * 01/11/2015 - Updated CFR to CFR_0.94.jar
* 01/11/2015 - Updated to the latest version of FernFlower. * 01/11/2015 - Updated to the latest version of FernFlower.
* 01/11/2015 - Fixed an extension appending issue with save Java file. * 01/11/2015 - Fixed an extension appending issue with save Java file.
* -----2.7.0-----:
* 01/11/2015 - Improved the Refresh Class function to be used as the default compile function.
* 01/11/2015 - Implemented better error handling for decompiling class files.
* 01/15/2015 - CTRL + O will open the add file interface.
* 01/15/2015 - CTRL + N will open the net workspace interface.
* 01/15/2015 - It will now save the last directory you opened.
* 01/15/2015 - Some how the URL for the auto updater change log got changed, this has been fixed.
* 01/15/2015 - Slightly updated the change log display, it'll now show all the changes since your version.
* 01/16/2015 - Made EZ-Injection UI look a bit nicer.
* 01/27/2015 - Decided to scrap the JVM Sandbox POC and use the Security Manager.
* 01/27/2015 - BCV now blocks exec and won't allow any ports to be bound.
* *
* @author Konloch * @author Konloch
* *
*/ */
/**
* Store the inst object and original class bytes, then allow optional real time toggling?
*/
public class BytecodeViewer { public class BytecodeViewer {
public static MainViewerGUI viewer = null; public static MainViewerGUI viewer = null;
@ -302,55 +328,40 @@ public class BytecodeViewer {
private static ArrayList<String> recentFiles = DiskReader.loadArrayList(filesName, false); private static ArrayList<String> recentFiles = DiskReader.loadArrayList(filesName, false);
private static ArrayList<String> recentPlugins = DiskReader.loadArrayList(pluginsName, false); private static ArrayList<String> recentPlugins = DiskReader.loadArrayList(pluginsName, false);
public static boolean runningObfuscation = false; public static boolean runningObfuscation = false;
public static String version = "2.6.0"; public static String version = "2.7.0";
private static long start = System.currentTimeMillis(); private static long start = System.currentTimeMillis();
public static String lastDirectory = "";
public static void main(String[] args) { private static Thread versionChecker = new Thread() {
System.out.println("https://the.bytecode.club - Created by @Konloch - Bytecode Viewer " + version);
iconList = new ArrayList<BufferedImage>();
int size = 16;
for (int i = 0; i < 24; i++) {
iconList.add(resize(icon, size, size));
size += 2;
}
cleanup();
Runtime.getRuntime().addShutdownHook(new Thread() {
@Override
public void run() {
Settings.saveGUI();
cleanup();
}
});
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Exception e) {
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e);
}
viewer = new MainViewerGUI();
Settings.loadGUI();
resetRecentFilesMenu();
Thread versionChecker = new Thread() {
@Override @Override
public void run() { public void run() {
try { 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(); final String version = r.readSingle();
try {
int simplemaths = Integer.parseInt(version.replace(".", ""));
int simplemaths2 = Integer.parseInt(BytecodeViewer.version.replace(".", ""));
if(simplemaths2 > simplemaths)
return; //developer version
} catch(Exception e) {
}
if (!BytecodeViewer.version.equals(version)) { if (!BytecodeViewer.version.equals(version)) {
r = new HTTPRequest(new URL("https://raw.githubusercontent.com/Konloch/bytecode-viewer/master/VERSION")); r = new HTTPRequest(new URL("https://raw.githubusercontent.com/Konloch/bytecode-viewer/master/README.txt"));
String[] readme = r.read(); String[] readme = r.read();
String changelog = "Unable to load change log, please try again later."+nl; String changelog = "Unable to load change log, please try again later."+nl;
boolean trigger = false; boolean trigger = false;
boolean finalTrigger = false;
for(String st : readme) { for(String st : readme) {
if(st.equals("--- "+version+" ---:")) { if(st.equals("--- "+BytecodeViewer.version+" ---:")) {
changelog = ""; changelog = "";
trigger = true; trigger = true;
} else if(trigger == true) { } else if(trigger) {
if(st.startsWith("--- ")) if(st.startsWith("--- "))
trigger = false; finalTrigger = true;
else
if(finalTrigger)
changelog += st + nl; changelog += st + nl;
} }
} }
@ -361,7 +372,7 @@ public class BytecodeViewer {
+ version + version
+ nl + nl
+ nl + nl
+ "Version " + version + "'s Change Log:" + "Changes since your version:"
+ nl + nl
+ changelog + changelog
+ nl + nl
@ -478,16 +489,103 @@ public class BytecodeViewer {
} }
}; };
/**
* Grab the byte array from the loaded Class object
* @param clazz
* @return
* @throws IOException
*/
public static byte[] getClassFile(Class<?> clazz) throws IOException {
InputStream is = clazz.getResourceAsStream( "/" + clazz.getName().replace('.', '/') + ".class");
ByteArrayOutputStream baos = new ByteArrayOutputStream();
int r = 0;
byte[] buffer = new byte[8192];
while((r=is.read(buffer))>=0) {
baos.write(buffer, 0, r);
}
return baos.toByteArray();
}
public static void main(String[] args) {
SecurityManager sm = new SecurityManager() {
@Override
public void checkExec(String cmd) {
throw new SecurityException("BCV is awesome.");
}
@Override
public void checkListen(int port) {
throw new SecurityException("BCV is awesome.");
}
@Override
public void checkPermission(Permission perm) { //expand eventually
}
@Override
public void checkPermission(Permission perm, Object context) {//expand eventually
}
@Override public void checkAccess(Thread t) {}
@Override public void checkAccept(String host, int port) {}
@Override public void checkAccess(ThreadGroup g) {}
@Override public void checkAwtEventQueueAccess() {}
@Override public void checkConnect(String host, int port) {}
@Override public void checkConnect(String host, int port, Object context) {}
@Override public void checkCreateClassLoader() {}
@Override public void checkDelete(String file) {}
@Override public void checkExit(int status) {}
@Override public void checkLink(String lib) {}
@Override public void checkMemberAccess(Class<?> clazz, int which) {}
@Override public void checkMulticast(InetAddress maddr) {}
@Override public void checkMulticast(InetAddress maddr, byte ttl) {}
@Override public void checkPackageAccess(String pkg) {}
@Override public void checkPackageDefinition(String pkg) {}
@Override public void checkPrintJobAccess() {}
@Override public void checkPropertiesAccess() {}
@Override public void checkPropertyAccess(String key) {}
@Override public void checkRead(FileDescriptor fd) {}
@Override public void checkRead(String file) {}
@Override public void checkRead(String file, Object context) {}
@Override public void checkSecurityAccess(String target) {}
@Override public void checkSetFactory() {}
@Override public void checkSystemClipboardAccess() {}
@Override public void checkWrite(FileDescriptor fd) {}
@Override public void checkWrite(String file) {}
};
System.setSecurityManager(sm);
System.out.println("https://the.bytecode.club - Created by @Konloch - Bytecode Viewer " + version);
iconList = new ArrayList<BufferedImage>();
int size = 16;
for (int i = 0; i < 24; i++) {
iconList.add(resize(icon, size, size));
size += 2;
}
cleanup();
Runtime.getRuntime().addShutdownHook(new Thread() {
@Override
public void run() {
Settings.saveGUI();
cleanup();
}
});
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Exception e) {
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e);
}
viewer = new MainViewerGUI();
Settings.loadGUI();
resetRecentFilesMenu();
if (viewer.chckbxmntmNewCheckItem_12.isSelected()) // start only if selected if (viewer.chckbxmntmNewCheckItem_12.isSelected()) // start only if selected
versionChecker.start(); versionChecker.start();
viewer.setVisible(true);
System.out.println("Start up took " + ((System.currentTimeMillis() - start) / 1000) + " seconds");
if (args.length >= 1) if (args.length >= 1)
for (String s : args) { for (String s : args) {
openFiles(new File[] { new File(s) }, true); openFiles(new File[] { new File(s) }, true);
} }
viewer.setVisible(true);
System.out.println("Start up took " + ((System.currentTimeMillis() - start) / 1000) + " seconds");
} }
//because Smali and Baksmali System.exit if it failed //because Smali and Baksmali System.exit if it failed

View file

@ -1,107 +0,0 @@
package the.bytecode.club.bytecodeviewer;
import java.io.IOException;
import the.bytecode.club.bytecodeviewer.plugins.EZInjection;
public class RuntimeOverride {
private static RuntimeOverride currentRuntime = new RuntimeOverride();
public static RuntimeOverride getRuntime() {
return currentRuntime;
}
public void exit(int status) {
if (EZInjection.sandboxSystem) {
EZInjection.exitR(status);
} else {
Runtime.getRuntime().exit(status);
}
}
public void addShutdownHook(Thread hook) {
Runtime.getRuntime().addShutdownHook(hook);
}
public boolean removeShutdownHook(Thread hook) {
return Runtime.getRuntime().removeShutdownHook(hook);
}
public void halt(int status) {
Runtime.getRuntime().halt(status);
}
public Process exec(String command) throws IOException {
if (EZInjection.sandboxSystem) {
EZInjection.announceSystem(command);
return null;
} else {
return Runtime.getRuntime().exec(command);
}
}
/*
* public Process exec(String command, String[] envp) throws IOException {
* return exec(command, envp, null); }
*
* public Process exec(String command, String[] envp, File dir) throws
* IOException { if (command.length() == 0) throw new
* IllegalArgumentException("Empty command");
*
* StringTokenizer st = new StringTokenizer(command); String[] cmdarray =
* new String[st.countTokens()]; for (int i = 0; st.hasMoreTokens(); i++)
* cmdarray[i] = st.nextToken(); return exec(cmdarray, envp, dir); }
*
* public Process exec(String cmdarray[]) throws IOException { return
* exec(cmdarray, null, null); }
*
* public Process exec(String[] cmdarray, String[] envp) throws IOException
* { return exec(cmdarray, envp, null); }
*
* public Process exec(String[] cmdarray, String[] envp, File dir) throws
* IOException { return new ProcessBuilder(cmdarray) .environment(envp)
* .directory(dir) .start(); }
*
* public native int availableProcessors();
*
* public native long freeMemory();
*
* public native long totalMemory();
*
* public native long maxMemory();
*
* public void gc() { Runtime.getRuntime().gc(); }
*
* public void runFinalization() { Runtime.getRuntime().runFinalization(); }
*
* public native void traceInstructions(boolean on);
*
* public native void traceMethodCalls(boolean on);
*
* public void load(String filename) { load0(Reflection.getCallerClass(),
* filename); }
*
* synchronized void load0(Class fromClass, String filename) {
* SecurityManager security = System.getSecurityManager(); if (security !=
* null) { security.checkLink(filename); } if (!(new
* File(filename).isAbsolute())) { throw new UnsatisfiedLinkError(
* "Expecting an absolute path of the library: " + filename); }
* ClassLoader.loadLibrary(fromClass, filename, true); }
*
* public void loadLibrary(String libname) {
* loadLibrary0(Reflection.getCallerClass(), libname); }
*
* synchronized void loadLibrary0(Class fromClass, String libname) {
* SecurityManager security = System.getSecurityManager(); if (security !=
* null) { security.checkLink(libname); } if
* (libname.indexOf((int)File.separatorChar) != -1) { throw new
* UnsatisfiedLinkError(
* "Directory separator should not appear in library name: " + libname); }
* ClassLoader.loadLibrary(fromClass, libname, false); }
*
* public InputStream getLocalizedInputStream(InputStream in) { return in; }
*
* public OutputStream getLocalizedOutputStream(OutputStream out) { return
* out; }
*/
}

View file

@ -146,6 +146,7 @@ public class Settings {
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.isMaximized), false); DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.isMaximized), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.autoCompileSmali.isSelected()), false); DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.autoCompileSmali.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.autoCompileOnRefresh.isSelected()), false); DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.autoCompileOnRefresh.isSelected()), false);
DiskWriter.writeNewLine(BytecodeViewer.settingsName, BytecodeViewer.lastDirectory, false);
} catch(Exception e) { } catch(Exception e) {
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e);
} }
@ -290,6 +291,7 @@ public class Settings {
} }
BytecodeViewer.viewer.autoCompileSmali.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 86, false))); BytecodeViewer.viewer.autoCompileSmali.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 86, false)));
BytecodeViewer.viewer.autoCompileOnRefresh.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 87, false))); BytecodeViewer.viewer.autoCompileOnRefresh.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 87, false)));
BytecodeViewer.lastDirectory = DiskReader.loadString(BytecodeViewer.settingsName, 88, false);
} catch(Exception e) { } catch(Exception e) {
//ignore because errors are expected, first start up and outdated settings. //ignore because errors are expected, first start up and outdated settings.
} }

View file

@ -7,6 +7,8 @@ import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.OutputStream; import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.Deque; import java.util.Deque;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.Random; import java.util.Random;
@ -89,13 +91,17 @@ public class CFRDecompiler extends JavaDecompiler {
try { try {
s = DiskReader.loadAsString(f.getAbsolutePath()); s = DiskReader.loadAsString(f.getAbsolutePath());
} catch (Exception e) { } catch (Exception e) {
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); StringWriter sw = new StringWriter();
return "CFR error! Send the stacktrace to Konloch at http://the.bytecode.club or konloch@gmail.com"; 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+"Suggestest Fix: Click refresh class, if it fails again try another decompiler."+BytecodeViewer.nl+BytecodeViewer.nl+exception;
} }
return s; return s;
} }
} }
return "CFR error! Send the stacktrace to Konloch at http://the.bytecode.club or konloch@gmail.com"; return "CFR error!"+BytecodeViewer.nl+BytecodeViewer.nl+"Suggestest Fix: Click refresh class, if it fails again try another decompiler.";
} }
public String[] generateMainMethod(String filePath, String outputPath) { public String[] generateMainMethod(String filePath, String outputPath) {

View file

@ -3,6 +3,8 @@ package the.bytecode.club.bytecodeviewer.decompilers;
import java.io.File; import java.io.File;
import java.io.FileOutputStream; import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.PrintWriter;
import java.io.StringWriter;
import me.konloch.kontainer.io.DiskReader; import me.konloch.kontainer.io.DiskReader;
import me.konloch.kontainer.io.DiskWriter; import me.konloch.kontainer.io.DiskWriter;
@ -65,6 +67,7 @@ public class FernFlowerDecompiler extends JavaDecompiler {
final File tempClass = new File(start + ".class"); final File tempClass = new File(start + ".class");
String exception = "";
try { try {
final FileOutputStream fos = new FileOutputStream(tempClass); final FileOutputStream fos = new FileOutputStream(tempClass);
@ -72,7 +75,11 @@ public class FernFlowerDecompiler extends JavaDecompiler {
fos.close(); fos.close();
} catch (final IOException e) { } catch (final IOException e) {
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); StringWriter sw = new StringWriter();
e.printStackTrace(new PrintWriter(sw));
e.printStackTrace();
exception = "Bytecode Viewer Version: " + BytecodeViewer.version + BytecodeViewer.nl + BytecodeViewer.nl + sw.toString();
} }
org.jetbrains.java.decompiler.main.decompiler.ConsoleDecompiler org.jetbrains.java.decompiler.main.decompiler.ConsoleDecompiler
@ -90,10 +97,14 @@ public class FernFlowerDecompiler extends JavaDecompiler {
return s; return s;
} catch (Exception e) { } catch (Exception e) {
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); StringWriter sw = new StringWriter();
e.printStackTrace(new PrintWriter(sw));
e.printStackTrace();
exception += BytecodeViewer.nl + BytecodeViewer.nl + sw.toString();
} }
} }
return "FernFlower error! Send the stacktrace to Konloch at http://the.bytecode.club or konloch@gmail.com"; return "FernFlower error! Send the stacktrace to Konloch at http://the.bytecode.club or konloch@gmail.com"+BytecodeViewer.nl+BytecodeViewer.nl+"Suggestest Fix: Click refresh class, if it fails again try another decompiler."+BytecodeViewer.nl+BytecodeViewer.nl+exception;
} }
private String[] generateMainMethod(String className, String folder) { private String[] generateMainMethod(String className, String folder) {

View file

@ -6,6 +6,7 @@ import java.io.FileOutputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.OutputStreamWriter; import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.io.StringWriter; import java.io.StringWriter;
import java.io.Writer; import java.io.Writer;
import java.util.ArrayList; import java.util.ArrayList;
@ -90,6 +91,7 @@ public class ProcyonDecompiler extends JavaDecompiler {
@Override @Override
public String decompileClassNode(ClassNode cn) { public String decompileClassNode(ClassNode cn) {
String exception = "";
try { try {
final ClassWriter cw = new ClassWriter(0); final ClassWriter cw = new ClassWriter(0);
cn.accept(cw); cn.accept(cw);
@ -131,9 +133,13 @@ public class ProcyonDecompiler extends JavaDecompiler {
return decompiledSource; return decompiledSource;
} catch (Exception e) { } catch (Exception e) {
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); StringWriter sw = new StringWriter();
e.printStackTrace(new PrintWriter(sw));
e.printStackTrace();
exception = "Bytecode Viewer Version: " + BytecodeViewer.version + BytecodeViewer.nl + BytecodeViewer.nl + sw.toString();
} }
return "Procyon error! Send the stacktrace to Konloch at http://the.bytecode.club or konloch@gmail.com"; return "Procyon error! Send the stacktrace to Konloch at http://the.bytecode.club or konloch@gmail.com"+BytecodeViewer.nl+BytecodeViewer.nl+"Suggestest Fix: Click refresh class, if it fails again try another decompiler."+BytecodeViewer.nl+BytecodeViewer.nl+exception;
} }
@Override @Override

View file

@ -23,46 +23,33 @@ import javax.swing.JLabel;
public class EZInjectionOptions extends JFrame { public class EZInjectionOptions extends JFrame {
public EZInjectionOptions() { public EZInjectionOptions() {
this.setIconImages(BytecodeViewer.iconList); this.setIconImages(BytecodeViewer.iconList);
setSize(new Dimension(250, 454)); setSize(new Dimension(250, 402));
setResizable(false); setResizable(false);
setTitle("EZ Injection Options"); setTitle("EZ Injection Options");
getContentPane().setLayout(null); getContentPane().setLayout(null);
final JCheckBox accessModifiers = new JCheckBox( final JCheckBox accessModifiers = new JCheckBox(
"Set All Access Modifiers Public"); "Set All Access Modifiers Public");
accessModifiers.setSelected(true);
accessModifiers.setBounds(6, 7, 232, 23); accessModifiers.setBounds(6, 7, 232, 23);
getContentPane().add(accessModifiers); getContentPane().add(accessModifiers);
final JCheckBox invokeMethod = new JCheckBox("Invoke Main Method:"); final JCheckBox invokeMethod = new JCheckBox("Invoke Main Method:");
invokeMethod.setSelected(true); invokeMethod.setSelected(true);
invokeMethod.setBounds(6, 251, 232, 23); invokeMethod.setBounds(6, 203, 232, 23);
getContentPane().add(invokeMethod); getContentPane().add(invokeMethod);
final JCheckBox injectHooks = new JCheckBox("Inject Hooks"); final JCheckBox injectHooks = new JCheckBox("Inject Hooks");
injectHooks.setSelected(true);
injectHooks.setBounds(6, 33, 232, 23); injectHooks.setBounds(6, 33, 232, 23);
getContentPane().add(injectHooks); getContentPane().add(injectHooks);
debugMethodCalls = new JCheckBox("Debug Method Calls"); debugMethodCalls = new JCheckBox("Debug Method Calls");
debugMethodCalls.setSelected(true);
debugMethodCalls.setBounds(6, 59, 232, 23); debugMethodCalls.setBounds(6, 59, 232, 23);
getContentPane().add(debugMethodCalls); getContentPane().add(debugMethodCalls);
final JCheckBox runtime = new JCheckBox("Sandbox Runtime.exec");
runtime.setEnabled(false);
runtime.setBounds(6, 138, 232, 23);
getContentPane().add(runtime);
final JCheckBox system = new JCheckBox("Sandbox System.exit");
system.setEnabled(false);
system.setBounds(6, 164, 232, 23);
getContentPane().add(system);
txtThebytecodeclubexamplemainlstring = new JTextField(); txtThebytecodeclubexamplemainlstring = new JTextField();
JButton btnNewButton = new JButton("Execute"); JButton btnNewButton = new JButton("Execute");
btnNewButton.setBounds(6, 393, 232, 23); btnNewButton.setBounds(6, 345, 232, 23);
getContentPane().add(btnNewButton); getContentPane().add(btnNewButton);
boolean b = false; boolean b = false;
@ -85,7 +72,7 @@ public class EZInjectionOptions extends JFrame {
txtThebytecodeclubexamplemainlstring txtThebytecodeclubexamplemainlstring
.setText("the/bytecode/club/Example.main"); .setText("the/bytecode/club/Example.main");
txtThebytecodeclubexamplemainlstring.setBounds(6, 281, 232, 20); txtThebytecodeclubexamplemainlstring.setBounds(6, 233, 232, 20);
getContentPane().add(txtThebytecodeclubexamplemainlstring); getContentPane().add(txtThebytecodeclubexamplemainlstring);
txtThebytecodeclubexamplemainlstring.setColumns(10); txtThebytecodeclubexamplemainlstring.setColumns(10);
@ -100,31 +87,31 @@ public class EZInjectionOptions extends JFrame {
textField.setColumns(10); textField.setColumns(10);
textField_1 = new JTextField(); textField_1 = new JTextField();
textField_1.setText("127.0.0.1:9050"); textField_1.setText("127.0.0.1:9150");
textField_1.setColumns(10); textField_1.setColumns(10);
textField_1.setBounds(6, 220, 232, 20); textField_1.setBounds(6, 172, 232, 20);
getContentPane().add(textField_1); getContentPane().add(textField_1);
final JCheckBox forceProxy = new JCheckBox( final JCheckBox forceProxy = new JCheckBox(
"Force Proxy (socks5, host:port):"); "Force Proxy (socks5, host:port):");
forceProxy.setBounds(6, 190, 232, 23); forceProxy.setBounds(6, 142, 232, 23);
getContentPane().add(forceProxy); getContentPane().add(forceProxy);
final JCheckBox launchReflectionKit = new JCheckBox( final JCheckBox launchReflectionKit = new JCheckBox(
"Launch Reflection Kit On Successful Invoke"); "Launch Reflection Kit On Successful Invoke");
launchReflectionKit.setEnabled(false); launchReflectionKit.setEnabled(false);
launchReflectionKit.setBounds(6, 308, 232, 23); launchReflectionKit.setBounds(6, 260, 232, 23);
getContentPane().add(launchReflectionKit); getContentPane().add(launchReflectionKit);
final JCheckBox console = new JCheckBox("Launch Console"); final JCheckBox console = new JCheckBox("Launch Console");
console.setBounds(6, 334, 232, 23); console.setBounds(6, 286, 232, 23);
console.setSelected(true); console.setSelected(true);
getContentPane().add(console); getContentPane().add(console);
final JCheckBox chckbxPrintToTerminal = new JCheckBox( final JCheckBox chckbxPrintToTerminal = new JCheckBox(
"Print To Command Line"); "Print To Command Line");
chckbxPrintToTerminal.setSelected(true); chckbxPrintToTerminal.setSelected(true);
chckbxPrintToTerminal.setBounds(6, 363, 232, 23); chckbxPrintToTerminal.setBounds(6, 315, 232, 23);
getContentPane().add(chckbxPrintToTerminal); getContentPane().add(chckbxPrintToTerminal);
this.setLocationRelativeTo(null); this.setLocationRelativeTo(null);
btnNewButton.addActionListener(new ActionListener() { btnNewButton.addActionListener(new ActionListener() {
@ -133,8 +120,7 @@ public class EZInjectionOptions extends JFrame {
.isSelected(), injectHooks.isSelected(), .isSelected(), injectHooks.isSelected(),
debugMethodCalls.isSelected(), invokeMethod debugMethodCalls.isSelected(), invokeMethod
.isSelected(), .isSelected(),
txtThebytecodeclubexamplemainlstring.getText(), runtime txtThebytecodeclubexamplemainlstring.getText(), false, false, textField
.isSelected(), system.isSelected(), textField
.getText(), textField_1.getText(), forceProxy .getText(), textField_1.getText(), forceProxy
.isSelected(), .isSelected(),
launchReflectionKit.isSelected(), console.isSelected(), launchReflectionKit.isSelected(), console.isSelected(),

View file

@ -15,6 +15,9 @@ import java.awt.Component;
import java.awt.Cursor; import java.awt.Cursor;
import java.awt.Dimension; import java.awt.Dimension;
import java.awt.Frame; import java.awt.Frame;
import java.awt.KeyEventDispatcher;
import java.awt.KeyboardFocusManager;
import java.awt.event.KeyEvent;
import java.awt.event.WindowAdapter; import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent; import java.awt.event.WindowEvent;
@ -337,6 +340,44 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier {
} }
} }
private class Test implements KeyEventDispatcher {
long last = System.currentTimeMillis();
@Override
public boolean dispatchKeyEvent(KeyEvent e) {
if(System.currentTimeMillis() - last <= (1000 * 4))
return false;
if ((e.getKeyCode() == KeyEvent.VK_O) && ((e.getModifiers() & KeyEvent.CTRL_MASK) != 0)) {
last = System.currentTimeMillis();
JFileChooser fc = new JFileChooser();
try {
fc.setSelectedFile(new File(BytecodeViewer.lastDirectory));
} catch(Exception e2) {
}
fc.setFileFilter(new APKDEXJarZipClassFileFilter());
fc.setFileHidingEnabled(false);
fc.setAcceptAllFileFilterUsed(false);
int returnVal = fc.showOpenDialog(BytecodeViewer.viewer);
if (returnVal == JFileChooser.APPROVE_OPTION) {
BytecodeViewer.lastDirectory = fc.getSelectedFile().getAbsolutePath();
try {
BytecodeViewer.viewer.setIcon(true);
BytecodeViewer.openFiles(new File[] { fc.getSelectedFile() }, true);
BytecodeViewer.viewer.setIcon(false);
} catch (Exception e1) {
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e1);
}
}
} else if ((e.getKeyCode() == KeyEvent.VK_N) && ((e.getModifiers() & KeyEvent.CTRL_MASK) != 0)) {
last = System.currentTimeMillis();
BytecodeViewer.resetWorkSpace(true);
}
return false;
}
}
ImageIcon busy = new ImageIcon(getClass().getResource("/resources/1.gif")); ImageIcon busy = new ImageIcon(getClass().getResource("/resources/1.gif"));
ImageIcon busyB64 = new ImageIcon(BytecodeViewer.b642IMG("R0lGODlhEAALAPQAAP///wAAANra2tDQ0Orq6gcHBwAAAC8vL4KCgmFhYbq6uiMjI0tLS4qKimVlZb6+vicnJwUFBU9PT+bm5tjY2PT09Dk5Odzc3PLy8ra2tqCgoMrKyu7u7gAAAAAAAAAAACH5BAkLAAAAIf4aQ3JlYXRlZCB3aXRoIGFqYXhsb2FkLmluZm8AIf8LTkVUU0NBUEUyLjADAQAAACwAAAAAEAALAAAFLSAgjmRpnqSgCuLKAq5AEIM4zDVw03ve27ifDgfkEYe04kDIDC5zrtYKRa2WQgAh+QQJCwAAACwAAAAAEAALAAAFJGBhGAVgnqhpHIeRvsDawqns0qeN5+y967tYLyicBYE7EYkYAgAh+QQJCwAAACwAAAAAEAALAAAFNiAgjothLOOIJAkiGgxjpGKiKMkbz7SN6zIawJcDwIK9W/HISxGBzdHTuBNOmcJVCyoUlk7CEAAh+QQJCwAAACwAAAAAEAALAAAFNSAgjqQIRRFUAo3jNGIkSdHqPI8Tz3V55zuaDacDyIQ+YrBH+hWPzJFzOQQaeavWi7oqnVIhACH5BAkLAAAALAAAAAAQAAsAAAUyICCOZGme1rJY5kRRk7hI0mJSVUXJtF3iOl7tltsBZsNfUegjAY3I5sgFY55KqdX1GgIAIfkECQsAAAAsAAAAABAACwAABTcgII5kaZ4kcV2EqLJipmnZhWGXaOOitm2aXQ4g7P2Ct2ER4AMul00kj5g0Al8tADY2y6C+4FIIACH5BAkLAAAALAAAAAAQAAsAAAUvICCOZGme5ERRk6iy7qpyHCVStA3gNa/7txxwlwv2isSacYUc+l4tADQGQ1mvpBAAIfkECQsAAAAsAAAAABAACwAABS8gII5kaZ7kRFGTqLLuqnIcJVK0DeA1r/u3HHCXC/aKxJpxhRz6Xi0ANAZDWa+kEAA7")); ImageIcon busyB64 = new ImageIcon(BytecodeViewer.b642IMG("R0lGODlhEAALAPQAAP///wAAANra2tDQ0Orq6gcHBwAAAC8vL4KCgmFhYbq6uiMjI0tLS4qKimVlZb6+vicnJwUFBU9PT+bm5tjY2PT09Dk5Odzc3PLy8ra2tqCgoMrKyu7u7gAAAAAAAAAAACH5BAkLAAAAIf4aQ3JlYXRlZCB3aXRoIGFqYXhsb2FkLmluZm8AIf8LTkVUU0NBUEUyLjADAQAAACwAAAAAEAALAAAFLSAgjmRpnqSgCuLKAq5AEIM4zDVw03ve27ifDgfkEYe04kDIDC5zrtYKRa2WQgAh+QQJCwAAACwAAAAAEAALAAAFJGBhGAVgnqhpHIeRvsDawqns0qeN5+y967tYLyicBYE7EYkYAgAh+QQJCwAAACwAAAAAEAALAAAFNiAgjothLOOIJAkiGgxjpGKiKMkbz7SN6zIawJcDwIK9W/HISxGBzdHTuBNOmcJVCyoUlk7CEAAh+QQJCwAAACwAAAAAEAALAAAFNSAgjqQIRRFUAo3jNGIkSdHqPI8Tz3V55zuaDacDyIQ+YrBH+hWPzJFzOQQaeavWi7oqnVIhACH5BAkLAAAALAAAAAAQAAsAAAUyICCOZGme1rJY5kRRk7hI0mJSVUXJtF3iOl7tltsBZsNfUegjAY3I5sgFY55KqdX1GgIAIfkECQsAAAAsAAAAABAACwAABTcgII5kaZ4kcV2EqLJipmnZhWGXaOOitm2aXQ4g7P2Ct2ER4AMul00kj5g0Al8tADY2y6C+4FIIACH5BAkLAAAALAAAAAAQAAsAAAUvICCOZGme5ERRk6iy7qpyHCVStA3gNa/7txxwlwv2isSacYUc+l4tADQGQ1mvpBAAIfkECQsAAAAsAAAAABAACwAABS8gII5kaZ7kRFGTqLLuqnIcJVK0DeA1r/u3HHCXC/aKxJpxhRz6Xi0ANAZDWa+kEAA7"));
private final JMenuItem mntmSaveAsApk = new JMenuItem("Save As DEX.."); private final JMenuItem mntmSaveAsApk = new JMenuItem("Save As DEX..");
@ -370,6 +411,7 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier {
} }
public MainViewerGUI() { public MainViewerGUI() {
KeyboardFocusManager.getCurrentKeyboardFocusManager().addKeyEventDispatcher(new Test());
mnNewMenu_5.setVisible(false); mnNewMenu_5.setVisible(false);
this.addWindowStateListener(new WindowAdapter() { this.addWindowStateListener(new WindowAdapter() {
public void windowStateChanged(WindowEvent evt) { public void windowStateChanged(WindowEvent evt) {
@ -471,12 +513,18 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier {
mntmLoadJar.addActionListener(new ActionListener() { mntmLoadJar.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
JFileChooser fc = new JFileChooser(); JFileChooser fc = new JFileChooser();
try {
fc.setSelectedFile(new File(BytecodeViewer.lastDirectory));
} catch(Exception e2) {
}
fc.setFileFilter(new APKDEXJarZipClassFileFilter()); fc.setFileFilter(new APKDEXJarZipClassFileFilter());
fc.setFileHidingEnabled(false); fc.setFileHidingEnabled(false);
fc.setAcceptAllFileFilterUsed(false); fc.setAcceptAllFileFilterUsed(false);
int returnVal = fc.showOpenDialog(BytecodeViewer.viewer); int returnVal = fc.showOpenDialog(BytecodeViewer.viewer);
if (returnVal == JFileChooser.APPROVE_OPTION) if (returnVal == JFileChooser.APPROVE_OPTION) {
BytecodeViewer.lastDirectory = fc.getSelectedFile().getAbsolutePath();
try { try {
BytecodeViewer.viewer.setIcon(true); BytecodeViewer.viewer.setIcon(true);
BytecodeViewer.openFiles(new File[] { fc BytecodeViewer.openFiles(new File[] { fc
@ -486,6 +534,7 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier {
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e1); new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e1);
} }
} }
}
}); });
mnNewMenu.add(mntmLoadJar); mnNewMenu.add(mntmLoadJar);

View file

@ -121,7 +121,8 @@ public class WorkPane extends VisibleComponent implements ActionListener {
public void actionPerformed(final ActionEvent arg0) { public void actionPerformed(final ActionEvent arg0) {
if(BytecodeViewer.viewer.autoCompileOnRefresh.isSelected()) if(BytecodeViewer.viewer.autoCompileOnRefresh.isSelected())
try { try {
BytecodeViewer.compileSmali(false); if(!BytecodeViewer.compileSmali(false))
return;
} catch(java.lang.NullPointerException e) { } catch(java.lang.NullPointerException e) {
} }

View file

@ -147,11 +147,6 @@ public class EZInjection extends Plugin {
print("Hooks are not debugging."); print("Hooks are not debugging.");
else else
print("Hooks are disabled completely."); print("Hooks are disabled completely.");
if (sandboxRuntime || sandboxSystem)
print("Sandboxing runtime: " + sandboxRuntime + ", system: "
+ sandboxSystem + ".");
else
print("WARNING: Sandboxing is disabled, this is NOT SAFE!");
if (useProxy) if (useProxy)
print("Forcing proxy as '" + proxy + "'."); print("Forcing proxy as '" + proxy + "'.");
if (launchKit) if (launchKit)