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.
This commit is contained in:
		
							parent
							
								
									2713a8b129
								
							
						
					
					
						commit
						bc9cfe13f3
					
				
					 12 changed files with 358 additions and 300 deletions
				
			
		
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										15
									
								
								README.txt
									
										
									
									
									
								
							
							
						
						
									
										15
									
								
								README.txt
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -256,11 +256,22 @@ Changelog:
 | 
			
		|||
01/09/2015 - Added add entire directory.
 | 
			
		||||
01/09/2015 - Fixed import .DEX files.
 | 
			
		||||
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 - 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 - All of the decompiling names are now randomly generated instead of a counting number.
 | 
			
		||||
01/11/2015 - Updated CFR to CFR_0.94.jar
 | 
			
		||||
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.
 | 
			
		||||
| 
						 | 
				
			
			@ -5,13 +5,18 @@ import java.awt.event.ActionEvent;
 | 
			
		|||
import java.awt.event.ActionListener;
 | 
			
		||||
import java.awt.image.BufferedImage;
 | 
			
		||||
import java.io.ByteArrayInputStream;
 | 
			
		||||
import java.io.ByteArrayOutputStream;
 | 
			
		||||
import java.io.File;
 | 
			
		||||
import java.io.FileDescriptor;
 | 
			
		||||
import java.io.FileInputStream;
 | 
			
		||||
import java.io.FileNotFoundException;
 | 
			
		||||
import java.io.FileOutputStream;
 | 
			
		||||
import java.io.IOException;
 | 
			
		||||
import java.io.InputStream;
 | 
			
		||||
import java.net.InetAddress;
 | 
			
		||||
import java.net.URI;
 | 
			
		||||
import java.net.URL;
 | 
			
		||||
import java.security.Permission;
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
import java.util.HashMap;
 | 
			
		||||
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
 | 
			
		||||
 * 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.
 | 
			
		||||
 * 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-----:
 | 
			
		||||
 * 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 to the latest version of FernFlower.
 | 
			
		||||
 * 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
 | 
			
		||||
 * 
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Store the inst object and original class bytes, then allow optional real time toggling?
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
public class BytecodeViewer {
 | 
			
		||||
 | 
			
		||||
	public static MainViewerGUI viewer = null;
 | 
			
		||||
| 
						 | 
				
			
			@ -302,10 +328,229 @@ public class BytecodeViewer {
 | 
			
		|||
	private static ArrayList<String> recentFiles = DiskReader.loadArrayList(filesName, false);
 | 
			
		||||
	private static ArrayList<String> recentPlugins = DiskReader.loadArrayList(pluginsName, 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();
 | 
			
		||||
	public static String lastDirectory = "";
 | 
			
		||||
	private static Thread versionChecker = new Thread() {
 | 
			
		||||
		@Override
 | 
			
		||||
		public void run() {
 | 
			
		||||
			try {
 | 
			
		||||
				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(".", ""));
 | 
			
		||||
					int simplemaths2 = Integer.parseInt(BytecodeViewer.version.replace(".", ""));
 | 
			
		||||
					if(simplemaths2 > simplemaths)
 | 
			
		||||
						return; //developer version
 | 
			
		||||
				} catch(Exception e) {
 | 
			
		||||
					
 | 
			
		||||
				}
 | 
			
		||||
				
 | 
			
		||||
				if (!BytecodeViewer.version.equals(version)) {
 | 
			
		||||
					r = new HTTPRequest(new URL("https://raw.githubusercontent.com/Konloch/bytecode-viewer/master/README.txt"));
 | 
			
		||||
					String[] readme = r.read();
 | 
			
		||||
					
 | 
			
		||||
					String changelog = "Unable to load change log, please try again later."+nl;
 | 
			
		||||
					boolean trigger = false;
 | 
			
		||||
					boolean finalTrigger = false;
 | 
			
		||||
					for(String st : readme) {
 | 
			
		||||
						if(st.equals("--- "+BytecodeViewer.version+" ---:")) {
 | 
			
		||||
							changelog = "";
 | 
			
		||||
							trigger = true;
 | 
			
		||||
						} else if(trigger) {
 | 
			
		||||
							if(st.startsWith("--- "))
 | 
			
		||||
								finalTrigger = true;
 | 
			
		||||
							
 | 
			
		||||
							if(finalTrigger)
 | 
			
		||||
								changelog += st + nl;
 | 
			
		||||
						}
 | 
			
		||||
					}
 | 
			
		||||
 | 
			
		||||
					JOptionPane pane = new JOptionPane("Your version: "
 | 
			
		||||
							+ BytecodeViewer.version
 | 
			
		||||
							+ ", latest version: "
 | 
			
		||||
							+ version
 | 
			
		||||
							+ nl
 | 
			
		||||
							+ nl
 | 
			
		||||
							+ "Changes since your version:"
 | 
			
		||||
							+ nl
 | 
			
		||||
							+ changelog
 | 
			
		||||
							+ nl
 | 
			
		||||
							+ "What would you like to do?");
 | 
			
		||||
					Object[] options = new String[] { "Open The Download Page", "Download The Updated Jar", "Do Nothing" };
 | 
			
		||||
					pane.setOptions(options);
 | 
			
		||||
					JDialog dialog = pane.createDialog(BytecodeViewer.viewer,
 | 
			
		||||
							"Bytecode Viewer - Outdated Version");
 | 
			
		||||
					dialog.setVisible(true);
 | 
			
		||||
					Object obj = pane.getValue();
 | 
			
		||||
					int result = -1;
 | 
			
		||||
					for (int k = 0; k < options.length; k++)
 | 
			
		||||
						if (options[k].equals(obj))
 | 
			
		||||
							result = k;
 | 
			
		||||
					
 | 
			
		||||
					if (result == 0) {
 | 
			
		||||
						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.");
 | 
			
		||||
						}
 | 
			
		||||
					}
 | 
			
		||||
					if(result == 1) {
 | 
			
		||||
						JFileChooser fc = new JFileChooser();
 | 
			
		||||
						try {
 | 
			
		||||
							fc.setCurrentDirectory(new File(".").getAbsoluteFile()); //set the current working directory
 | 
			
		||||
						} catch(Exception e) {
 | 
			
		||||
							new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e);
 | 
			
		||||
						}
 | 
			
		||||
						fc.setFileFilter(viewer.new JarFileFilter());
 | 
			
		||||
						fc.setFileHidingEnabled(false);
 | 
			
		||||
						fc.setAcceptAllFileFilterUsed(false);
 | 
			
		||||
						int returnVal = fc.showSaveDialog(viewer);
 | 
			
		||||
						if (returnVal == JFileChooser.APPROVE_OPTION) {
 | 
			
		||||
							File file = fc.getSelectedFile();
 | 
			
		||||
							if(!file.getAbsolutePath().endsWith(".jar"))
 | 
			
		||||
								file = new File(file.getAbsolutePath()+".jar");
 | 
			
		||||
							
 | 
			
		||||
							if(file.exists()) {
 | 
			
		||||
								pane = new JOptionPane("The file " + file + " exists, would you like to overwrite it?");
 | 
			
		||||
								options = new String[] { "Yes", "No" };
 | 
			
		||||
								pane.setOptions(options);
 | 
			
		||||
								dialog = pane.createDialog(BytecodeViewer.viewer,
 | 
			
		||||
										"Bytecode Viewer - Overwrite File");
 | 
			
		||||
								dialog.setVisible(true);
 | 
			
		||||
								obj = pane.getValue();
 | 
			
		||||
								result = -1;
 | 
			
		||||
								for (int k = 0; k < options.length; k++)
 | 
			
		||||
									if (options[k].equals(obj))
 | 
			
		||||
										result = k;
 | 
			
		||||
								
 | 
			
		||||
								if (result != 0)
 | 
			
		||||
									return;
 | 
			
		||||
								
 | 
			
		||||
								file.delete();
 | 
			
		||||
							}
 | 
			
		||||
 | 
			
		||||
							final File finalFile = file;
 | 
			
		||||
							Thread downloadThread = new Thread() {
 | 
			
		||||
								@Override
 | 
			
		||||
								public void run() {
 | 
			
		||||
									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");
 | 
			
		||||
									        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.");
 | 
			
		||||
									        while ((len = is.read(buffer)) > 0) {  
 | 
			
		||||
									            fos.write(buffer, 0, len);
 | 
			
		||||
									            fos.flush();
 | 
			
		||||
									            downloaded += 8192;
 | 
			
		||||
										        int mbs = downloaded / 1048576;
 | 
			
		||||
										        if(mbs % 5 == 0 && mbs != 0) {
 | 
			
		||||
										        	if(!flag)
 | 
			
		||||
										        		System.out.println("Downloaded " + mbs + "MBs so far");
 | 
			
		||||
										        	flag = true;
 | 
			
		||||
										        } else
 | 
			
		||||
										        	flag = false;
 | 
			
		||||
									        }
 | 
			
		||||
									    } finally {
 | 
			
		||||
									        try {
 | 
			
		||||
									            if (is != null) {
 | 
			
		||||
									                is.close();
 | 
			
		||||
									            }
 | 
			
		||||
									        } finally {
 | 
			
		||||
									            if (fos != null) {
 | 
			
		||||
										            fos.flush();
 | 
			
		||||
									                fos.close();
 | 
			
		||||
									            }
 | 
			
		||||
									        }
 | 
			
		||||
									    }
 | 
			
		||||
									    System.out.println("Download finished!");
 | 
			
		||||
										showMessage("Download successful! You can find the updated jar at " + finalFile.getAbsolutePath());
 | 
			
		||||
									} catch(FileNotFoundException e) {
 | 
			
		||||
										showMessage("Unable to download, the jar file has not been uploaded yet, please try again later in an hour.");
 | 
			
		||||
									} catch(Exception e) {
 | 
			
		||||
										new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e);
 | 
			
		||||
									}
 | 
			
		||||
									
 | 
			
		||||
								}
 | 
			
		||||
							};
 | 
			
		||||
							downloadThread.start();
 | 
			
		||||
						}
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
			} catch (Exception e) {
 | 
			
		||||
				e.printStackTrace();
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	};
 | 
			
		||||
	
 | 
			
		||||
	/**
 | 
			
		||||
	 * 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;
 | 
			
		||||
| 
						 | 
				
			
			@ -331,163 +576,16 @@ public class BytecodeViewer {
 | 
			
		|||
		Settings.loadGUI();
 | 
			
		||||
		resetRecentFilesMenu();
 | 
			
		||||
 | 
			
		||||
		Thread versionChecker = new Thread() {
 | 
			
		||||
			@Override
 | 
			
		||||
			public void run() {
 | 
			
		||||
				try {
 | 
			
		||||
					HTTPRequest r = new HTTPRequest(new URL("https://raw.githubusercontent.com/Konloch/bytecode-viewer/master/VERSION"));
 | 
			
		||||
					final String version = r.readSingle();
 | 
			
		||||
					if (!BytecodeViewer.version.equals(version)) {
 | 
			
		||||
						r = new HTTPRequest(new URL("https://raw.githubusercontent.com/Konloch/bytecode-viewer/master/VERSION"));
 | 
			
		||||
						String[] readme = r.read();
 | 
			
		||||
						
 | 
			
		||||
						String changelog = "Unable to load change log, please try again later."+nl;
 | 
			
		||||
						boolean trigger = false;
 | 
			
		||||
						for(String st : readme) {
 | 
			
		||||
							if(st.equals("--- "+version+" ---:")) {
 | 
			
		||||
								changelog = "";
 | 
			
		||||
								trigger = true;
 | 
			
		||||
							} else if(trigger == true) {
 | 
			
		||||
								if(st.startsWith("--- "))
 | 
			
		||||
									trigger = false;
 | 
			
		||||
								else
 | 
			
		||||
									changelog += st + nl;
 | 
			
		||||
							}
 | 
			
		||||
						}
 | 
			
		||||
 | 
			
		||||
						JOptionPane pane = new JOptionPane("Your version: "
 | 
			
		||||
								+ BytecodeViewer.version
 | 
			
		||||
								+ ", latest version: "
 | 
			
		||||
								+ version
 | 
			
		||||
								+ nl
 | 
			
		||||
								+ nl
 | 
			
		||||
								+ "Version " + version + "'s Change Log:"
 | 
			
		||||
								+ nl
 | 
			
		||||
								+ changelog
 | 
			
		||||
								+ nl
 | 
			
		||||
								+ "What would you like to do?");
 | 
			
		||||
						Object[] options = new String[] { "Open The Download Page", "Download The Updated Jar", "Do Nothing" };
 | 
			
		||||
						pane.setOptions(options);
 | 
			
		||||
						JDialog dialog = pane.createDialog(BytecodeViewer.viewer,
 | 
			
		||||
								"Bytecode Viewer - Outdated Version");
 | 
			
		||||
						dialog.setVisible(true);
 | 
			
		||||
						Object obj = pane.getValue();
 | 
			
		||||
						int result = -1;
 | 
			
		||||
						for (int k = 0; k < options.length; k++)
 | 
			
		||||
							if (options[k].equals(obj))
 | 
			
		||||
								result = k;
 | 
			
		||||
						
 | 
			
		||||
						if (result == 0) {
 | 
			
		||||
							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.");
 | 
			
		||||
							}
 | 
			
		||||
						}
 | 
			
		||||
						if(result == 1) {
 | 
			
		||||
							JFileChooser fc = new JFileChooser();
 | 
			
		||||
							try {
 | 
			
		||||
								fc.setCurrentDirectory(new File(".").getAbsoluteFile()); //set the current working directory
 | 
			
		||||
							} catch(Exception e) {
 | 
			
		||||
								new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e);
 | 
			
		||||
							}
 | 
			
		||||
							fc.setFileFilter(viewer.new JarFileFilter());
 | 
			
		||||
							fc.setFileHidingEnabled(false);
 | 
			
		||||
							fc.setAcceptAllFileFilterUsed(false);
 | 
			
		||||
							int returnVal = fc.showSaveDialog(viewer);
 | 
			
		||||
							if (returnVal == JFileChooser.APPROVE_OPTION) {
 | 
			
		||||
								File file = fc.getSelectedFile();
 | 
			
		||||
								if(!file.getAbsolutePath().endsWith(".jar"))
 | 
			
		||||
									file = new File(file.getAbsolutePath()+".jar");
 | 
			
		||||
								
 | 
			
		||||
								if(file.exists()) {
 | 
			
		||||
									pane = new JOptionPane("The file " + file + " exists, would you like to overwrite it?");
 | 
			
		||||
									options = new String[] { "Yes", "No" };
 | 
			
		||||
									pane.setOptions(options);
 | 
			
		||||
									dialog = pane.createDialog(BytecodeViewer.viewer,
 | 
			
		||||
											"Bytecode Viewer - Overwrite File");
 | 
			
		||||
									dialog.setVisible(true);
 | 
			
		||||
									obj = pane.getValue();
 | 
			
		||||
									result = -1;
 | 
			
		||||
									for (int k = 0; k < options.length; k++)
 | 
			
		||||
										if (options[k].equals(obj))
 | 
			
		||||
											result = k;
 | 
			
		||||
									
 | 
			
		||||
									if (result != 0)
 | 
			
		||||
										return;
 | 
			
		||||
									
 | 
			
		||||
									file.delete();
 | 
			
		||||
								}
 | 
			
		||||
 | 
			
		||||
								final File finalFile = file;
 | 
			
		||||
								Thread downloadThread = new Thread() {
 | 
			
		||||
									@Override
 | 
			
		||||
									public void run() {
 | 
			
		||||
										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");
 | 
			
		||||
										        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.");
 | 
			
		||||
										        while ((len = is.read(buffer)) > 0) {  
 | 
			
		||||
										            fos.write(buffer, 0, len);
 | 
			
		||||
										            fos.flush();
 | 
			
		||||
										            downloaded += 8192;
 | 
			
		||||
											        int mbs = downloaded / 1048576;
 | 
			
		||||
											        if(mbs % 5 == 0 && mbs != 0) {
 | 
			
		||||
											        	if(!flag)
 | 
			
		||||
											        		System.out.println("Downloaded " + mbs + "MBs so far");
 | 
			
		||||
											        	flag = true;
 | 
			
		||||
											        } else
 | 
			
		||||
											        	flag = false;
 | 
			
		||||
										        }
 | 
			
		||||
										    } finally {
 | 
			
		||||
										        try {
 | 
			
		||||
										            if (is != null) {
 | 
			
		||||
										                is.close();
 | 
			
		||||
										            }
 | 
			
		||||
										        } finally {
 | 
			
		||||
										            if (fos != null) {
 | 
			
		||||
											            fos.flush();
 | 
			
		||||
										                fos.close();
 | 
			
		||||
										            }
 | 
			
		||||
										        }
 | 
			
		||||
										    }
 | 
			
		||||
										    System.out.println("Download finished!");
 | 
			
		||||
											showMessage("Download successful! You can find the updated jar at " + finalFile.getAbsolutePath());
 | 
			
		||||
										} catch(FileNotFoundException e) {
 | 
			
		||||
											showMessage("Unable to download, the jar file has not been uploaded yet, please try again later in an hour.");
 | 
			
		||||
										} catch(Exception e) {
 | 
			
		||||
											new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e);
 | 
			
		||||
										}
 | 
			
		||||
										
 | 
			
		||||
									}
 | 
			
		||||
								};
 | 
			
		||||
								downloadThread.start();
 | 
			
		||||
							}
 | 
			
		||||
						}
 | 
			
		||||
					}
 | 
			
		||||
				} catch (Exception e) {
 | 
			
		||||
					e.printStackTrace();
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		};
 | 
			
		||||
 | 
			
		||||
		if (viewer.chckbxmntmNewCheckItem_12.isSelected()) // start only if selected
 | 
			
		||||
			versionChecker.start();
 | 
			
		||||
 | 
			
		||||
		viewer.setVisible(true);		
 | 
			
		||||
		System.out.println("Start up took " + ((System.currentTimeMillis() - start) / 1000) + " seconds");
 | 
			
		||||
		
 | 
			
		||||
		if (args.length >= 1)
 | 
			
		||||
			for (String s : args) {
 | 
			
		||||
				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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -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; }
 | 
			
		||||
	 */
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -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.autoCompileSmali.isSelected()), false);
 | 
			
		||||
			DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.autoCompileOnRefresh.isSelected()), false);
 | 
			
		||||
			DiskWriter.writeNewLine(BytecodeViewer.settingsName, BytecodeViewer.lastDirectory, false);
 | 
			
		||||
		} catch(Exception 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.autoCompileOnRefresh.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 87, false)));
 | 
			
		||||
			BytecodeViewer.lastDirectory = DiskReader.loadString(BytecodeViewer.settingsName, 88, false);
 | 
			
		||||
		} catch(Exception e) {
 | 
			
		||||
			//ignore because errors are expected, first start up and outdated settings.
 | 
			
		||||
		}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -7,6 +7,8 @@ import java.io.FileOutputStream;
 | 
			
		|||
import java.io.IOException;
 | 
			
		||||
import java.io.InputStream;
 | 
			
		||||
import java.io.OutputStream;
 | 
			
		||||
import java.io.PrintWriter;
 | 
			
		||||
import java.io.StringWriter;
 | 
			
		||||
import java.util.Deque;
 | 
			
		||||
import java.util.LinkedList;
 | 
			
		||||
import java.util.Random;
 | 
			
		||||
| 
						 | 
				
			
			@ -89,13 +91,17 @@ public class CFRDecompiler extends JavaDecompiler {
 | 
			
		|||
				try {
 | 
			
		||||
					s = DiskReader.loadAsString(f.getAbsolutePath());
 | 
			
		||||
				} catch (Exception e) {
 | 
			
		||||
					new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e);
 | 
			
		||||
					return "CFR error! Send the stacktrace to Konloch at http://the.bytecode.club or konloch@gmail.com";
 | 
			
		||||
					StringWriter sw = new StringWriter();
 | 
			
		||||
					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 "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) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -3,6 +3,8 @@ package the.bytecode.club.bytecodeviewer.decompilers;
 | 
			
		|||
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 me.konloch.kontainer.io.DiskWriter;
 | 
			
		||||
| 
						 | 
				
			
			@ -65,6 +67,7 @@ public class FernFlowerDecompiler extends JavaDecompiler {
 | 
			
		|||
		
 | 
			
		||||
		final File tempClass = new File(start + ".class");
 | 
			
		||||
 | 
			
		||||
		String exception = "";
 | 
			
		||||
		try {
 | 
			
		||||
			final FileOutputStream fos = new FileOutputStream(tempClass);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -72,7 +75,11 @@ public class FernFlowerDecompiler extends JavaDecompiler {
 | 
			
		|||
 | 
			
		||||
			fos.close();
 | 
			
		||||
		} 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
 | 
			
		||||
| 
						 | 
				
			
			@ -90,10 +97,14 @@ public class FernFlowerDecompiler extends JavaDecompiler {
 | 
			
		|||
 | 
			
		||||
				return s;
 | 
			
		||||
			} 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) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -6,6 +6,7 @@ import java.io.FileOutputStream;
 | 
			
		|||
import java.io.IOException;
 | 
			
		||||
import java.io.InputStream;
 | 
			
		||||
import java.io.OutputStreamWriter;
 | 
			
		||||
import java.io.PrintWriter;
 | 
			
		||||
import java.io.StringWriter;
 | 
			
		||||
import java.io.Writer;
 | 
			
		||||
import java.util.ArrayList;
 | 
			
		||||
| 
						 | 
				
			
			@ -90,6 +91,7 @@ public class ProcyonDecompiler extends JavaDecompiler {
 | 
			
		|||
 | 
			
		||||
	@Override
 | 
			
		||||
	public String decompileClassNode(ClassNode cn) {
 | 
			
		||||
		String exception = "";
 | 
			
		||||
		try {
 | 
			
		||||
			final ClassWriter cw = new ClassWriter(0);
 | 
			
		||||
			cn.accept(cw);
 | 
			
		||||
| 
						 | 
				
			
			@ -131,9 +133,13 @@ public class ProcyonDecompiler extends JavaDecompiler {
 | 
			
		|||
 | 
			
		||||
			return decompiledSource;
 | 
			
		||||
		} 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
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -23,46 +23,33 @@ import javax.swing.JLabel;
 | 
			
		|||
public class EZInjectionOptions extends JFrame {
 | 
			
		||||
	public EZInjectionOptions() {
 | 
			
		||||
		this.setIconImages(BytecodeViewer.iconList);
 | 
			
		||||
		setSize(new Dimension(250, 454));
 | 
			
		||||
		setSize(new Dimension(250, 402));
 | 
			
		||||
		setResizable(false);
 | 
			
		||||
		setTitle("EZ Injection Options");
 | 
			
		||||
		getContentPane().setLayout(null);
 | 
			
		||||
 | 
			
		||||
		final JCheckBox accessModifiers = new JCheckBox(
 | 
			
		||||
				"Set All Access Modifiers Public");
 | 
			
		||||
		accessModifiers.setSelected(true);
 | 
			
		||||
		accessModifiers.setBounds(6, 7, 232, 23);
 | 
			
		||||
		getContentPane().add(accessModifiers);
 | 
			
		||||
 | 
			
		||||
		final JCheckBox invokeMethod = new JCheckBox("Invoke Main Method:");
 | 
			
		||||
		invokeMethod.setSelected(true);
 | 
			
		||||
		invokeMethod.setBounds(6, 251, 232, 23);
 | 
			
		||||
		invokeMethod.setBounds(6, 203, 232, 23);
 | 
			
		||||
		getContentPane().add(invokeMethod);
 | 
			
		||||
 | 
			
		||||
		final JCheckBox injectHooks = new JCheckBox("Inject Hooks");
 | 
			
		||||
		injectHooks.setSelected(true);
 | 
			
		||||
		injectHooks.setBounds(6, 33, 232, 23);
 | 
			
		||||
		getContentPane().add(injectHooks);
 | 
			
		||||
 | 
			
		||||
		debugMethodCalls = new JCheckBox("Debug Method Calls");
 | 
			
		||||
		debugMethodCalls.setSelected(true);
 | 
			
		||||
		debugMethodCalls.setBounds(6, 59, 232, 23);
 | 
			
		||||
		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();
 | 
			
		||||
 | 
			
		||||
		JButton btnNewButton = new JButton("Execute");
 | 
			
		||||
		btnNewButton.setBounds(6, 393, 232, 23);
 | 
			
		||||
		btnNewButton.setBounds(6, 345, 232, 23);
 | 
			
		||||
		getContentPane().add(btnNewButton);
 | 
			
		||||
 | 
			
		||||
		boolean b = false;
 | 
			
		||||
| 
						 | 
				
			
			@ -85,7 +72,7 @@ public class EZInjectionOptions extends JFrame {
 | 
			
		|||
			txtThebytecodeclubexamplemainlstring
 | 
			
		||||
					.setText("the/bytecode/club/Example.main");
 | 
			
		||||
 | 
			
		||||
		txtThebytecodeclubexamplemainlstring.setBounds(6, 281, 232, 20);
 | 
			
		||||
		txtThebytecodeclubexamplemainlstring.setBounds(6, 233, 232, 20);
 | 
			
		||||
		getContentPane().add(txtThebytecodeclubexamplemainlstring);
 | 
			
		||||
		txtThebytecodeclubexamplemainlstring.setColumns(10);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -100,31 +87,31 @@ public class EZInjectionOptions extends JFrame {
 | 
			
		|||
		textField.setColumns(10);
 | 
			
		||||
 | 
			
		||||
		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.setBounds(6, 220, 232, 20);
 | 
			
		||||
		textField_1.setBounds(6, 172, 232, 20);
 | 
			
		||||
		getContentPane().add(textField_1);
 | 
			
		||||
 | 
			
		||||
		final JCheckBox forceProxy = new JCheckBox(
 | 
			
		||||
				"Force Proxy (socks5, host:port):");
 | 
			
		||||
		forceProxy.setBounds(6, 190, 232, 23);
 | 
			
		||||
		forceProxy.setBounds(6, 142, 232, 23);
 | 
			
		||||
		getContentPane().add(forceProxy);
 | 
			
		||||
 | 
			
		||||
		final JCheckBox launchReflectionKit = new JCheckBox(
 | 
			
		||||
				"Launch Reflection Kit On Successful Invoke");
 | 
			
		||||
		launchReflectionKit.setEnabled(false);
 | 
			
		||||
		launchReflectionKit.setBounds(6, 308, 232, 23);
 | 
			
		||||
		launchReflectionKit.setBounds(6, 260, 232, 23);
 | 
			
		||||
		getContentPane().add(launchReflectionKit);
 | 
			
		||||
 | 
			
		||||
		final JCheckBox console = new JCheckBox("Launch Console");
 | 
			
		||||
		console.setBounds(6, 334, 232, 23);
 | 
			
		||||
		console.setBounds(6, 286, 232, 23);
 | 
			
		||||
		console.setSelected(true);
 | 
			
		||||
		getContentPane().add(console);
 | 
			
		||||
 | 
			
		||||
		final JCheckBox chckbxPrintToTerminal = new JCheckBox(
 | 
			
		||||
				"Print To Command Line");
 | 
			
		||||
		chckbxPrintToTerminal.setSelected(true);
 | 
			
		||||
		chckbxPrintToTerminal.setBounds(6, 363, 232, 23);
 | 
			
		||||
		chckbxPrintToTerminal.setBounds(6, 315, 232, 23);
 | 
			
		||||
		getContentPane().add(chckbxPrintToTerminal);
 | 
			
		||||
		this.setLocationRelativeTo(null);
 | 
			
		||||
		btnNewButton.addActionListener(new ActionListener() {
 | 
			
		||||
| 
						 | 
				
			
			@ -133,8 +120,7 @@ public class EZInjectionOptions extends JFrame {
 | 
			
		|||
						.isSelected(), injectHooks.isSelected(),
 | 
			
		||||
						debugMethodCalls.isSelected(), invokeMethod
 | 
			
		||||
								.isSelected(),
 | 
			
		||||
						txtThebytecodeclubexamplemainlstring.getText(), runtime
 | 
			
		||||
								.isSelected(), system.isSelected(), textField
 | 
			
		||||
						txtThebytecodeclubexamplemainlstring.getText(), false, false, textField
 | 
			
		||||
								.getText(), textField_1.getText(), forceProxy
 | 
			
		||||
								.isSelected(),
 | 
			
		||||
						launchReflectionKit.isSelected(), console.isSelected(),
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -15,6 +15,9 @@ import java.awt.Component;
 | 
			
		|||
import java.awt.Cursor;
 | 
			
		||||
import java.awt.Dimension;
 | 
			
		||||
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.WindowEvent;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -336,6 +339,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 busyB64 = new ImageIcon(BytecodeViewer.b642IMG("R0lGODlhEAALAPQAAP///wAAANra2tDQ0Orq6gcHBwAAAC8vL4KCgmFhYbq6uiMjI0tLS4qKimVlZb6+vicnJwUFBU9PT+bm5tjY2PT09Dk5Odzc3PLy8ra2tqCgoMrKyu7u7gAAAAAAAAAAACH5BAkLAAAAIf4aQ3JlYXRlZCB3aXRoIGFqYXhsb2FkLmluZm8AIf8LTkVUU0NBUEUyLjADAQAAACwAAAAAEAALAAAFLSAgjmRpnqSgCuLKAq5AEIM4zDVw03ve27ifDgfkEYe04kDIDC5zrtYKRa2WQgAh+QQJCwAAACwAAAAAEAALAAAFJGBhGAVgnqhpHIeRvsDawqns0qeN5+y967tYLyicBYE7EYkYAgAh+QQJCwAAACwAAAAAEAALAAAFNiAgjothLOOIJAkiGgxjpGKiKMkbz7SN6zIawJcDwIK9W/HISxGBzdHTuBNOmcJVCyoUlk7CEAAh+QQJCwAAACwAAAAAEAALAAAFNSAgjqQIRRFUAo3jNGIkSdHqPI8Tz3V55zuaDacDyIQ+YrBH+hWPzJFzOQQaeavWi7oqnVIhACH5BAkLAAAALAAAAAAQAAsAAAUyICCOZGme1rJY5kRRk7hI0mJSVUXJtF3iOl7tltsBZsNfUegjAY3I5sgFY55KqdX1GgIAIfkECQsAAAAsAAAAABAACwAABTcgII5kaZ4kcV2EqLJipmnZhWGXaOOitm2aXQ4g7P2Ct2ER4AMul00kj5g0Al8tADY2y6C+4FIIACH5BAkLAAAALAAAAAAQAAsAAAUvICCOZGme5ERRk6iy7qpyHCVStA3gNa/7txxwlwv2isSacYUc+l4tADQGQ1mvpBAAIfkECQsAAAAsAAAAABAACwAABS8gII5kaZ7kRFGTqLLuqnIcJVK0DeA1r/u3HHCXC/aKxJpxhRz6Xi0ANAZDWa+kEAA7"));
 | 
			
		||||
| 
						 | 
				
			
			@ -370,6 +411,7 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier {
 | 
			
		|||
	}
 | 
			
		||||
 | 
			
		||||
	public MainViewerGUI() {
 | 
			
		||||
		KeyboardFocusManager.getCurrentKeyboardFocusManager().addKeyEventDispatcher(new Test());
 | 
			
		||||
		mnNewMenu_5.setVisible(false);
 | 
			
		||||
		this.addWindowStateListener(new WindowAdapter() {
 | 
			
		||||
		      public void windowStateChanged(WindowEvent evt) {
 | 
			
		||||
| 
						 | 
				
			
			@ -471,12 +513,18 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier {
 | 
			
		|||
		mntmLoadJar.addActionListener(new ActionListener() {
 | 
			
		||||
			public void actionPerformed(ActionEvent e) {
 | 
			
		||||
				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)
 | 
			
		||||
				if (returnVal == JFileChooser.APPROVE_OPTION) {
 | 
			
		||||
					BytecodeViewer.lastDirectory = fc.getSelectedFile().getAbsolutePath();
 | 
			
		||||
					try {
 | 
			
		||||
						BytecodeViewer.viewer.setIcon(true);
 | 
			
		||||
						BytecodeViewer.openFiles(new File[] { fc
 | 
			
		||||
| 
						 | 
				
			
			@ -485,6 +533,7 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier {
 | 
			
		|||
					} catch (Exception e1) {
 | 
			
		||||
						new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e1);
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		});
 | 
			
		||||
		mnNewMenu.add(mntmLoadJar);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -121,7 +121,8 @@ public class WorkPane extends VisibleComponent implements ActionListener {
 | 
			
		|||
	public void actionPerformed(final ActionEvent arg0) {
 | 
			
		||||
		if(BytecodeViewer.viewer.autoCompileOnRefresh.isSelected())
 | 
			
		||||
			try {
 | 
			
		||||
				BytecodeViewer.compileSmali(false);
 | 
			
		||||
				if(!BytecodeViewer.compileSmali(false))
 | 
			
		||||
					return;
 | 
			
		||||
			} catch(java.lang.NullPointerException e) {
 | 
			
		||||
				
 | 
			
		||||
			}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -147,11 +147,6 @@ public class EZInjection extends Plugin {
 | 
			
		|||
			print("Hooks are not debugging.");
 | 
			
		||||
		else
 | 
			
		||||
			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)
 | 
			
		||||
			print("Forcing proxy as '" + proxy + "'.");
 | 
			
		||||
		if (launchKit)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue