diff --git a/BytecodeViewer 2.9.8-preview-3.jar b/BytecodeViewer 2.9.8-preview-4.jar similarity index 86% rename from BytecodeViewer 2.9.8-preview-3.jar rename to BytecodeViewer 2.9.8-preview-4.jar index cfeb30b3..844ae2da 100644 Binary files a/BytecodeViewer 2.9.8-preview-3.jar and b/BytecodeViewer 2.9.8-preview-4.jar differ diff --git a/src/resources/class.png b/src/resources/class.png new file mode 100644 index 00000000..0a7d6f4a Binary files /dev/null and b/src/resources/class.png differ diff --git a/src/resources/java.png b/src/resources/java.png index 0a7d6f4a..4eb93e6f 100644 Binary files a/src/resources/java.png and b/src/resources/java.png differ diff --git a/src/the/bytecode/club/bytecodeviewer/BytecodeViewer.java b/src/the/bytecode/club/bytecodeviewer/BytecodeViewer.java index 04246862..499ebc0a 100644 --- a/src/the/bytecode/club/bytecodeviewer/BytecodeViewer.java +++ b/src/the/bytecode/club/bytecodeviewer/BytecodeViewer.java @@ -13,6 +13,8 @@ import java.io.IOException; import java.io.InputStream; import java.net.URI; import java.net.URL; +import java.nio.file.Files; +import java.nio.file.Paths; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -85,7 +87,6 @@ import the.bytecode.club.bytecodeviewer.plugin.PluginManager; * Spiffy up the plugin console with hilighted lines * Take https://github.com/ptnkjke/Java-Bytecode-Editor visualize * make zipfile not include the decode shit - * When you drag a folder, it must add the folder name not just the child into the root jtree path * add stackmapframes to bytecode decompiler * add stackmapframes remover? * make ez-injection plugin console show all sys.out calls @@ -109,6 +110,13 @@ import the.bytecode.club.bytecodeviewer.plugin.PluginManager; * 07/22/2015 - Fixed a typo (Thanks affffsdsd) * 07/22/2015 - Finally added icons to the File Navigator, credits to http://famfamfam.com/lab/icons/silk/ for the icons. * 07/22/2015 - JD-GUI is now the default decompiler for GUI. + * 07/22/2015 - Added Set Python 3.X to the UI. + * 07/22/2015 - Fixed krakatau/export as jar bug introduced by file system update. + * 07/22/2015 - Sped up krakatau decompiler/disassembler on big files. + * 07/22/2015 - Made it so when you press enter on the file navigation pane it opens the class. + * 07/22/2015 - The Quick file search now opens the files again. + * 07/23/2015 - Fixed opening single files and file folders into BCV + * 07/24/2015 - Added File>Reload Resources. * * @author Konloch * @@ -619,7 +627,8 @@ public class BytecodeViewer { for(FileContainer container : files) for(ClassNode c : container.classes) - a.add(c); + if(!a.contains(c)) + a.add(c); return a; } @@ -741,7 +750,38 @@ public class BytecodeViewer { showMessage("The file " + f.getAbsolutePath() + " could not be found."); } else { if(f.isDirectory()) { - openFiles(f.listFiles(), false); + FileContainer container = new FileContainer(f); + HashMap files = new HashMap(); + boolean finished = false; + ArrayList totalFiles = new ArrayList(); + totalFiles.add(f); + String dir = f.getAbsolutePath();//f.getAbsolutePath().substring(0, f.getAbsolutePath().length()-f.getName().length()); + + while(!finished) { + boolean added = false; + for(int i = 0; i < totalFiles.size(); i++) { + File child = totalFiles.get(i); + if(child.listFiles() != null) + for(File rocket : child.listFiles()) + if(!totalFiles.contains(rocket)) { + totalFiles.add(rocket); + added = true; + } + } + + if(!added) { + for(File child : totalFiles) + if(child.isFile()) { + String fileName = child.getAbsolutePath().substring(dir.length()+1, child.getAbsolutePath().length()).replaceAll("\\\\", "\\/"); + + + files.put(fileName, Files.readAllBytes(Paths.get(child.getAbsolutePath()))); + } + finished = true; + } + } + container.files = files; + BytecodeViewer.files.add(container); } else { if (fn.endsWith(".jar") || fn.endsWith(".zip")) { try { diff --git a/src/the/bytecode/club/bytecodeviewer/JarUtils.java b/src/the/bytecode/club/bytecodeviewer/JarUtils.java index b265d3f2..3caae32d 100644 --- a/src/the/bytecode/club/bytecodeviewer/JarUtils.java +++ b/src/the/bytecode/club/bytecodeviewer/JarUtils.java @@ -230,29 +230,69 @@ public class JarUtils { * @param nodeList The loaded ClassNodes * @param path the exact jar output path */ - public static void saveAsJar(ArrayList nodeList, String path) { + public static void saveAsJarClassesOnly(ArrayList nodeList, String path) { try { - JarOutputStream out = new JarOutputStream( - new FileOutputStream(path)); + System.out.println("zipping"); + JarOutputStream out = new JarOutputStream(new FileOutputStream(path)); + ArrayList noDupe = new ArrayList(); for (ClassNode cn : nodeList) { ClassWriter cw = new ClassWriter(0); cn.accept(cw); - out.putNextEntry(new ZipEntry(cn.name + ".class")); - out.write(cw.toByteArray()); - out.closeEntry(); + String name = cn.name + ".class"; + + if(!noDupe.contains(name)) { + noDupe.add(name); + out.putNextEntry(new ZipEntry(name)); + out.write(cw.toByteArray()); + out.closeEntry(); + } + } + + noDupe.clear(); + out.close(); + } catch (IOException e) { + new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); + } + } + + /** + * Saves a jar without the manifest + * @param nodeList The loaded ClassNodes + * @param path the exact jar output path + */ + public static void saveAsJar(ArrayList nodeList, String path) { + try { + JarOutputStream out = new JarOutputStream(new FileOutputStream(path)); + ArrayList noDupe = new ArrayList(); + for (ClassNode cn : nodeList) { + ClassWriter cw = new ClassWriter(0); + cn.accept(cw); + + String name = cn.name + ".class"; + + if(!noDupe.contains(name)) { + noDupe.add(name); + out.putNextEntry(new ZipEntry(name)); + out.write(cw.toByteArray()); + out.closeEntry(); + } } for(FileContainer container : BytecodeViewer.files) for (Entry entry : container.files.entrySet()) { String filename = entry.getKey(); if (!filename.startsWith("META-INF")) { - out.putNextEntry(new ZipEntry(filename)); - out.write(entry.getValue()); - out.closeEntry(); + if(!noDupe.contains(filename)) { + noDupe.add(filename); + out.putNextEntry(new ZipEntry(filename)); + out.write(entry.getValue()); + out.closeEntry(); + } } } + noDupe.clear(); out.close(); } catch (IOException e) { new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e); diff --git a/src/the/bytecode/club/bytecodeviewer/Resources.java b/src/the/bytecode/club/bytecodeviewer/Resources.java index 95e4d897..ca287cca 100644 --- a/src/the/bytecode/club/bytecodeviewer/Resources.java +++ b/src/the/bytecode/club/bytecodeviewer/Resources.java @@ -23,48 +23,49 @@ public class Resources { public static BufferedImage icon; public static ImageIcon nextIcon; public static ImageIcon prevIcon; - public static ImageIcon busy; - public static ImageIcon busyB64; - - public static ImageIcon bat; - public static ImageIcon sh; - public static ImageIcon csharp; - public static ImageIcon cplusplus; - public static ImageIcon config; - public static ImageIcon jar; - public static ImageIcon zip; - public static ImageIcon packages; - public static ImageIcon folder; - public static ImageIcon android; - public static ImageIcon file; - public static ImageIcon textFile; - public static ImageIcon classFile; - public static ImageIcon imageFile; - public static ImageIcon decoded; + public static ImageIcon busyIcon; + public static ImageIcon busyB64Icon; + public static ImageIcon batIcon; + public static ImageIcon shIcon; + public static ImageIcon csharpIcon; + public static ImageIcon cplusplusIcon; + public static ImageIcon configIcon; + public static ImageIcon jarIcon; + public static ImageIcon zipIcon; + public static ImageIcon packagesIcon; + public static ImageIcon folderIcon; + public static ImageIcon androidIcon; + public static ImageIcon fileIcon; + public static ImageIcon textIcon; + public static ImageIcon classIcon; + public static ImageIcon imageIcon; + public static ImageIcon decodedIcon; + public static ImageIcon javaIcon; static { icon = b642IMG("iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAUd0lEQVR42pWaWXRbVZaGq5iHqgaSeJZsy7YkD7KtwZItebblQfI8x/HseIodO3bixE5iZw4ZSBwyACkCXQ003dD0oigq1UBqFVQ1HSB0wkyvXt1VPNSiavHCC288/b3/I11ZSszQDzuRfO89Z39n/3uffST9BMBP17Dbgna72B1hdmfQ7hK7W+yeoN0btPvE7v8Rdl+Y3Rsc4+7guHcF5wif9/ag3fYd/v70J/zHWlGFcLPRKqth99Yoc1TVKssTc1b74Krxw1Vbh3yxAl+9Mre/QZmnrvFHG+/Xnud4alwxzpEXnJOm+UGfbEH/wv2NAHkwMQ4P6GLk/1hlDyXFKVuXFI/1yQnKolJ0yqLTEhFjTEKsKRlxZgPi01OQkJ6qTJeRBn2mEYlZpjWN13gP7+VzfJ7G8WjRqXo1xwZDQmhe+kBfHhR7QHz7O300fq6LUhYBQkJ1UxDkFggZdEMQIJoTCkCsAhDn6TgdpKMWE5KyzcqSc9JDZsjNCL3WridZAmA3Q3F8zhMV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Icon(b642IMG("iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAMFBMVEX///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAABnRSTlMANzlYqPBJSG/ZAAAASUlEQVR42mNgwAbS0oAEE4yHyWBmYAzjYDC694OJ4f9+BoY3H0BSbz6A2MxA6VciFyDqGAWQTWVkYEkCUrcOsDD8OwtkvMViMwAb8xEUHlHcFAAAAABJRU5ErkJggg==")); prevIcon = new ImageIcon(b642IMG("iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAMFBMVEX///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAv3aB7AAAABnRSTlMANzlYgKhxpRi1AAAATElEQVR42mNgwAZYHIAEExA7qUAYLApMDmCGEwODCojByM/A8FEAyPi/moFh9QewYjCAM1iA+D2KqYwMrIlA6tUGFoa/Z4GMt1hsBgCe1wuKber+SwAAAABJRU5ErkJggg==")); - busy = new ImageIcon(Resources.class.getClass().getResource("/resources/1.gif")); - busyB64 = new ImageIcon(b642IMG("R0lGODlhEAALAPQAAP///wAAANra2tDQ0Orq6gcHBwAAAC8vL4KCgmFhYbq6uiMjI0tLS4qKimVlZb6+vicnJwUFBU9PT+bm5tjY2PT09Dk5Odzc3PLy8ra2tqCgoMrKyu7u7gAAAAAAAAAAACH5BAkLAAAAIf4aQ3JlYXRlZCB3aXRoIGFqYXhsb2FkLmluZm8AIf8LTkVUU0NBUEUyLjADAQAAACwAAAAAEAALAAAFLSAgjmRpnqSgCuLKAq5AEIM4zDVw03ve27ifDgfkEYe04kDIDC5zrtYKRa2WQgAh+QQJCwAAACwAAAAAEAALAAAFJGBhGAVgnqhpHIeRvsDawqns0qeN5+y967tYLyicBYE7EYkYAgAh+QQJCwAAACwAAAAAEAALAAAFNiAgjothLOOIJAkiGgxjpGKiKMkbz7SN6zIawJcDwIK9W/HISxGBzdHTuBNOmcJVCyoUlk7CEAAh+QQJCwAAACwAAAAAEAALAAAFNSAgjqQIRRFUAo3jNGIkSdHqPI8Tz3V55zuaDacDyIQ+YrBH+hWPzJFzOQQaeavWi7oqnVIhACH5BAkLAAAALAAAAAAQAAsAAAUyICCOZGme1rJY5kRRk7hI0mJSVUXJtF3iOl7tltsBZsNfUegjAY3I5sgFY55KqdX1GgIAIfkECQsAAAAsAAAAABAACwAABTcgII5kaZ4kcV2EqLJipmnZhWGXaOOitm2aXQ4g7P2Ct2ER4AMul00kj5g0Al8tADY2y6C+4FIIACH5BAkLAAAALAAAAAAQAAsAAAUvICCOZGme5ERRk6iy7qpyHCVStA3gNa/7txxwlwv2isSacYUc+l4tADQGQ1mvpBAAIfkECQsAAAAsAAAAABAACwAABS8gII5kaZ7kRFGTqLLuqnIcJVK0DeA1r/u3HHCXC/aKxJpxhRz6Xi0ANAZDWa+kEAA7")); + busyIcon = new ImageIcon(Resources.class.getClass().getResource("/resources/1.gif")); + busyB64Icon = new ImageIcon(b642IMG("R0lGODlhEAALAPQAAP///wAAANra2tDQ0Orq6gcHBwAAAC8vL4KCgmFhYbq6uiMjI0tLS4qKimVlZb6+vicnJwUFBU9PT+bm5tjY2PT09Dk5Odzc3PLy8ra2tqCgoMrKyu7u7gAAAAAAAAAAACH5BAkLAAAAIf4aQ3JlYXRlZCB3aXRoIGFqYXhsb2FkLmluZm8AIf8LTkVUU0NBUEUyLjADAQAAACwAAAAAEAALAAAFLSAgjmRpnqSgCuLKAq5AEIM4zDVw03ve27ifDgfkEYe04kDIDC5zrtYKRa2WQgAh+QQJCwAAACwAAAAAEAALAAAFJGBhGAVgnqhpHIeRvsDawqns0qeN5+y967tYLyicBYE7EYkYAgAh+QQJCwAAACwAAAAAEAALAAAFNiAgjothLOOIJAkiGgxjpGKiKMkbz7SN6zIawJcDwIK9W/HISxGBzdHTuBNOmcJVCyoUlk7CEAAh+QQJCwAAACwAAAAAEAALAAAFNSAgjqQIRRFUAo3jNGIkSdHqPI8Tz3V55zuaDacDyIQ+YrBH+hWPzJFzOQQaeavWi7oqnVIhACH5BAkLAAAALAAAAAAQAAsAAAUyICCOZGme1rJY5kRRk7hI0mJSVUXJtF3iOl7tltsBZsNfUegjAY3I5sgFY55KqdX1GgIAIfkECQsAAAAsAAAAABAACwAABTcgII5kaZ4kcV2EqLJipmnZhWGXaOOitm2aXQ4g7P2Ct2ER4AMul00kj5g0Al8tADY2y6C+4FIIACH5BAkLAAAALAAAAAAQAAsAAAUvICCOZGme5ERRk6iy7qpyHCVStA3gNa/7txxwlwv2isSacYUc+l4tADQGQ1mvpBAAIfkECQsAAAAsAAAAABAACwAABS8gII5kaZ7kRFGTqLLuqnIcJVK0DeA1r/u3HHCXC/aKxJpxhRz6Xi0ANAZDWa+kEAA7")); - bat = new ImageIcon(Resources.class.getClass().getResource("/resources/bat.png")); - sh = new ImageIcon(Resources.class.getClass().getResource("/resources/sh.png")); - csharp = new ImageIcon(Resources.class.getClass().getResource("/resources/c#.png")); - cplusplus = new ImageIcon(Resources.class.getClass().getResource("/resources/c++.png")); - config = new ImageIcon(Resources.class.getClass().getResource("/resources/config.png")); - jar = new ImageIcon(Resources.class.getClass().getResource("/resources/jar.png")); - zip= new ImageIcon(Resources.class.getClass().getResource("/resources/zip.png")); - packages = new ImageIcon(Resources.class.getClass().getResource("/resources/package.png")); - folder = new ImageIcon(Resources.class.getClass().getResource("/resources/folder.png")); - android = new ImageIcon(Resources.class.getClass().getResource("/resources/android.png")); - file = new ImageIcon(Resources.class.getClass().getResource("/resources/file.png")); - textFile = new ImageIcon(Resources.class.getClass().getResource("/resources/text.png")); - classFile = new ImageIcon(Resources.class.getClass().getResource("/resources/java.png")); - imageFile = new ImageIcon(Resources.class.getClass().getResource("/resources/image.png")); - decoded = new ImageIcon(Resources.class.getClass().getResource("/resources/decoded.png")); + batIcon = new ImageIcon(Resources.class.getClass().getResource("/resources/bat.png")); + shIcon = new ImageIcon(Resources.class.getClass().getResource("/resources/sh.png")); + csharpIcon = new ImageIcon(Resources.class.getClass().getResource("/resources/c#.png")); + cplusplusIcon = new ImageIcon(Resources.class.getClass().getResource("/resources/c++.png")); + configIcon = new ImageIcon(Resources.class.getClass().getResource("/resources/config.png")); + jarIcon = new ImageIcon(Resources.class.getClass().getResource("/resources/jar.png")); + zipIcon= new ImageIcon(Resources.class.getClass().getResource("/resources/zip.png")); + packagesIcon = new ImageIcon(Resources.class.getClass().getResource("/resources/package.png")); + folderIcon = new ImageIcon(Resources.class.getClass().getResource("/resources/folder.png")); + androidIcon = new ImageIcon(Resources.class.getClass().getResource("/resources/android.png")); + fileIcon = new ImageIcon(Resources.class.getClass().getResource("/resources/file.png")); + textIcon = new ImageIcon(Resources.class.getClass().getResource("/resources/text.png")); + classIcon = new ImageIcon(Resources.class.getClass().getResource("/resources/class.png")); + imageIcon = new ImageIcon(Resources.class.getClass().getResource("/resources/image.png")); + decodedIcon = new ImageIcon(Resources.class.getClass().getResource("/resources/decoded.png")); + javaIcon = new ImageIcon(Resources.class.getClass().getResource("/resources/java.png")); iconList = new ArrayList(); int size = 16; diff --git a/src/the/bytecode/club/bytecodeviewer/decompilers/KrakatauDecompiler.java b/src/the/bytecode/club/bytecodeviewer/decompilers/KrakatauDecompiler.java index 5c532144..b6332145 100644 --- a/src/the/bytecode/club/bytecodeviewer/decompilers/KrakatauDecompiler.java +++ b/src/the/bytecode/club/bytecodeviewer/decompilers/KrakatauDecompiler.java @@ -47,7 +47,7 @@ public class KrakatauDecompiler extends Decompiler { final File tempDirectory = new File(BytecodeViewer.tempDirectory + BytecodeViewer.fs + MiscUtils.randomString(32) + BytecodeViewer.fs); tempDirectory.mkdir(); final File tempJar = new File(BytecodeViewer.tempDirectory + BytecodeViewer.fs + "temp"+MiscUtils.randomString(32)+".jar"); - JarUtils.saveAsJar(BytecodeViewer.getLoadedClasses(), tempJar.getAbsolutePath()); + JarUtils.saveAsJarClassesOnly(BytecodeViewer.getLoadedClasses(), tempJar.getAbsolutePath()); BytecodeViewer.sm.stopBlocking(); try { @@ -121,7 +121,7 @@ public class KrakatauDecompiler extends Decompiler { final File tempDirectory = new File(BytecodeViewer.tempDirectory + BytecodeViewer.fs + ran + BytecodeViewer.fs); tempDirectory.mkdir(); final File tempJar = new File(BytecodeViewer.tempDirectory + BytecodeViewer.fs + "temp.jar"); - JarUtils.saveAsJar(BytecodeViewer.getLoadedClasses(), tempJar.getAbsolutePath()); + JarUtils.saveAsJarClassesOnly(BytecodeViewer.getLoadedClasses(), tempJar.getAbsolutePath()); BytecodeViewer.sm.stopBlocking(); try { diff --git a/src/the/bytecode/club/bytecodeviewer/decompilers/KrakatauDisassembler.java b/src/the/bytecode/club/bytecodeviewer/decompilers/KrakatauDisassembler.java index ed79abfe..9acf23cf 100644 --- a/src/the/bytecode/club/bytecodeviewer/decompilers/KrakatauDisassembler.java +++ b/src/the/bytecode/club/bytecodeviewer/decompilers/KrakatauDisassembler.java @@ -35,7 +35,7 @@ public class KrakatauDisassembler extends Decompiler { final File tempDirectory = new File(BytecodeViewer.tempDirectory + BytecodeViewer.fs + MiscUtils.randomString(32) + BytecodeViewer.fs); tempDirectory.mkdir(); final File tempJar = new File(BytecodeViewer.tempDirectory + BytecodeViewer.fs + "temp"+MiscUtils.randomString(32)+".jar"); - JarUtils.saveAsJar(BytecodeViewer.getLoadedClasses(), tempJar.getAbsolutePath()); + JarUtils.saveAsJarClassesOnly(BytecodeViewer.getLoadedClasses(), tempJar.getAbsolutePath()); BytecodeViewer.sm.stopBlocking(); try { @@ -102,7 +102,7 @@ public class KrakatauDisassembler extends Decompiler { final File tempDirectory = new File(BytecodeViewer.tempDirectory + BytecodeViewer.fs + ran + BytecodeViewer.fs); tempDirectory.mkdir(); final File tempJar = new File(BytecodeViewer.tempDirectory + BytecodeViewer.fs + "temp.jar"); - JarUtils.saveAsJar(BytecodeViewer.getLoadedClasses(), tempJar.getAbsolutePath()); + JarUtils.saveAsJarClassesOnly(BytecodeViewer.getLoadedClasses(), tempJar.getAbsolutePath()); BytecodeViewer.sm.stopBlocking(); try { diff --git a/src/the/bytecode/club/bytecodeviewer/gui/ClassViewer.java b/src/the/bytecode/club/bytecodeviewer/gui/ClassViewer.java index 24bba9f2..871f29a4 100644 --- a/src/the/bytecode/club/bytecodeviewer/gui/ClassViewer.java +++ b/src/the/bytecode/club/bytecodeviewer/gui/ClassViewer.java @@ -581,6 +581,13 @@ public class ClassViewer extends Viewer { java2 = null; java3 = null; + if(this.cn == null) { + panel1.add(new JLabel("This file has been removed from the reload.")); + panel2.add(new JLabel("This file has been removed from the reload.")); + panel3.add(new JLabel("This file has been removed from the reload.")); + return; + } + if (pane1 != 0 && pane1 != 5) panel1.add(panel1Search, BorderLayout.NORTH); if (pane2 != 0 && pane2 != 5) diff --git a/src/the/bytecode/club/bytecodeviewer/gui/FileNavigationPane.java b/src/the/bytecode/club/bytecodeviewer/gui/FileNavigationPane.java index cf191b1b..a2f85e5b 100644 --- a/src/the/bytecode/club/bytecodeviewer/gui/FileNavigationPane.java +++ b/src/the/bytecode/club/bytecodeviewer/gui/FileNavigationPane.java @@ -14,6 +14,7 @@ import java.awt.event.FocusEvent; import java.awt.event.FocusListener; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; +import java.awt.event.KeyListener; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.io.File; @@ -61,187 +62,156 @@ public class FileNavigationPane extends VisibleComponent implements MyTreeNode treeRoot = new MyTreeNode("Loaded Files:"); MyTree tree = new MyTree(treeRoot); + final String quickSearchText = "Quick file search (no file extension)"; + final JTextField quickSearch = new JTextField(quickSearchText); + public KeyAdapter search = new KeyAdapter() { + @Override + public void keyPressed(final KeyEvent ke) { + if (ke.getKeyCode() == KeyEvent.VK_ENTER) { + + final String qt = quickSearch.getText(); + quickSearch.setText(""); + + + String[] path = null; + + if (qt.contains(".")) { + path = qt.split("\\."); + String[] path2 = new String[path.length]; + for(int i = 0; i < path.length; i++) { + path2[i] = path[i]; + if(i+2 == path.length) { + path2[i+1] = "." + path[i+1]; + } + } + } else { + path = new String[] { qt }; + } + + MyTreeNode curNode = treeRoot; + if (exact.isSelected()) { + pathLoop: for (int i = 0; i < path.length; i++) { + final String pathName = path[i]; + final boolean isLast = i == path.length - 1; + + for (int c = 0; c < curNode.getChildCount(); c++) { + final MyTreeNode child = (MyTreeNode) curNode.getChildAt(c); + System.out.println(pathName +":"+((String) child.getUserObject())); + + if (((String) child.getUserObject()).equals(pathName)) { + curNode = child; + if (isLast) { + final TreePath pathn = new TreePath(curNode.getPath()); + tree.setSelectionPath(pathn); + tree.makeVisible(pathn); + tree.scrollPathToVisible(pathn); + openPath(pathn); //auto open + System.out.println("Found! " + curNode); + break pathLoop; + } + continue pathLoop; + } + } + + System.out.println("Could not find " + pathName); + break; + } + } else { + { + @SuppressWarnings("unchecked") + Enumeration enums = curNode.depthFirstEnumeration(); + while (enums != null && enums.hasMoreElements()) { + + MyTreeNode node = enums.nextElement(); + if (node.isLeaf()) { + if (((String) (node.getUserObject())).toLowerCase().contains(path[path.length - 1].toLowerCase())) { + TreeNode pathArray[] = node.getPath(); + int k = 0; + StringBuffer fullPath = new StringBuffer(); + while (pathArray != null + && k < pathArray.length) { + MyTreeNode n = (MyTreeNode) pathArray[k]; + String s = (String) (n.getUserObject()); + fullPath.append(s); + if (k++ != pathArray.length - 1) { + fullPath.append("."); + } + } + String fullPathString = fullPath.toString(); + if (fullPathString != null && fullPathString.toLowerCase().contains(qt.toLowerCase())) { + System.out.println("Found! " + node); + final TreePath pathn = new TreePath(node.getPath()); + tree.setSelectionPath(pathn.getParentPath()); + tree.setSelectionPath(pathn); + tree.makeVisible(pathn); + tree.scrollPathToVisible(pathn); + } + } + } + } + } + } + } + } + }; + public FileNavigationPane(final FileChangeNotifier fcn) { super("ClassNavigation"); - setTitle("Files"); - - + this.fcn = fcn; tree.setRootVisible(false); tree.setShowsRootHandles(true); + quickSearch.setForeground(Color.gray); + setTitle("Files"); - this.fcn = fcn; - - open.addActionListener(new ActionListener() { - + this.open.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { final TreeNode root = (TreeNode) tree.getModel().getRoot(); expandAll(tree, new TreePath(root), true); } - }); - close.addActionListener(new ActionListener() { - + this.close.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { final TreeNode root = (TreeNode) tree.getModel().getRoot(); expandAll(tree, new TreePath(root), false); tree.expandPath(new TreePath(root)); } - }); - - getContentPane().setLayout(new BorderLayout()); - getContentPane().add(new JScrollPane(tree), BorderLayout.CENTER); - MouseAdapter ml = new MouseAdapter() { + this.tree.addMouseListener(new MouseAdapter() { + @Override public void mousePressed(MouseEvent e) { - TreePath path = tree.getPathForLocation(e.getX(), e.getY()); - if (path == null) - return; - final StringBuffer nameBuffer = new StringBuffer(); - for (int i = 2; i < path.getPathCount(); i++) { - nameBuffer.append(path.getPathComponent(i)); - if (i < path.getPathCount() - 1) { - nameBuffer.append("/"); - } - } - - String name = nameBuffer.toString(); - if(name.endsWith(".class")) { - final ClassNode cn = BytecodeViewer.getClassNode(name.substring(0, name.length() - ".class".length())); - if (cn != null) { - openClassFileToWorkSpace(nameBuffer.toString(), cn); - } - } else { - openFileToWorkSpace(nameBuffer.toString(), BytecodeViewer.getFileContents(nameBuffer.toString())); - } + openPath(tree.getPathForLocation(e.getX(), e.getY())); } - }; - this.tree.addMouseListener(ml); + }); this.tree.addTreeSelectionListener(new TreeSelectionListener() { @Override public void valueChanged(final TreeSelectionEvent arg0) { - final TreePath path = arg0.getPath(); - if (((TreeNode) path.getLastPathComponent()).getChildCount() > 0) - return; - final StringBuffer nameBuffer = new StringBuffer(); - for (int i = 1; i < path.getPathCount(); i++) { - nameBuffer.append(path.getPathComponent(i)); - if (i < path.getPathCount() - 1) { - nameBuffer.append("/"); - } - } - - String name = nameBuffer.toString(); - if(name.endsWith(".class")) { - final ClassNode cn = BytecodeViewer.getClassNode(name.substring(0, name.length() - ".class".length())); - if (cn != null) { - openClassFileToWorkSpace(nameBuffer.toString(), cn); - } - } else { - openFileToWorkSpace(nameBuffer.toString(), BytecodeViewer.getFileContents(nameBuffer.toString())); - } + openPath(arg0.getPath()); } }); - final String quickSearchText = "Quick class search (no file extension)"; - - final JTextField quickSearch = new JTextField(quickSearchText); - quickSearch.setForeground(Color.gray); - quickSearch.addKeyListener(new KeyAdapter() { + this.tree.addKeyListener(new KeyListener() { @Override - public void keyPressed(final KeyEvent ke) { - if (ke.getKeyCode() == KeyEvent.VK_ENTER) { - - final String qt = quickSearch.getText(); - quickSearch.setText(""); - - - String[] path = null; - - if (qt.contains(".")) { - path = qt.split("\\."); - String[] path2 = new String[path.length]; - for(int i = 0; i < path.length; i++) { - path2[i] = path[i]; - if(i+2 == path.length) { - path2[i+1] = "." + path[i+1]; - } - } - } else { - path = new String[] { qt }; + public void keyReleased(KeyEvent arg0) { + if(arg0.getKeyCode() == KeyEvent.VK_ENTER) { + if(arg0.getSource() instanceof MyTree) { + MyTree tree = (MyTree) arg0.getSource(); + openPath(tree.getSelectionPath()); } - - MyTreeNode curNode = treeRoot; - if (exact.isSelected()) { - pathLoop: for (int i = 0; i < path.length; i++) { - final String pathName = path[i]; - final boolean isLast = i == path.length - 1; - - for (int c = 0; c < curNode.getChildCount(); c++) { - final MyTreeNode child = (MyTreeNode) curNode.getChildAt(c); - System.out.println(pathName +":"+((String) child.getUserObject())); - - if (((String) child.getUserObject()).equals(pathName)) { - curNode = child; - if (isLast) { - final TreePath pathn = new TreePath(curNode.getPath()); - tree.setSelectionPath(pathn); - tree.makeVisible(pathn); - tree.scrollPathToVisible(pathn); - System.out.println("Found! " + curNode); - break pathLoop; - } - continue pathLoop; - } - } - - System.out.println("Could not find " + pathName); - break; - } - } else { - { - @SuppressWarnings("unchecked") - Enumeration enums = curNode.depthFirstEnumeration(); - while (enums != null && enums.hasMoreElements()) { - - MyTreeNode node = enums.nextElement(); - if (node.isLeaf()) { - if (((String) (node.getUserObject())).toLowerCase().contains(path[path.length - 1].toLowerCase())) { - TreeNode pathArray[] = node.getPath(); - int k = 0; - StringBuffer fullPath = new StringBuffer(); - while (pathArray != null - && k < pathArray.length) { - MyTreeNode n = (MyTreeNode) pathArray[k]; - String s = (String) (n.getUserObject()); - fullPath.append(s); - if (k++ != pathArray.length - 1) { - fullPath.append("."); - } - } - String fullPathString = fullPath.toString(); - if (fullPathString != null && fullPathString.toLowerCase().contains(qt.toLowerCase())) { - System.out.println("Found! " + node); - final TreePath pathn = new TreePath(node.getPath()); - tree.setSelectionPath(pathn.getParentPath()); - tree.setSelectionPath(pathn); - tree.makeVisible(pathn); - tree.scrollPathToVisible(pathn); - } - } - } - } - } - } - } } + + @Override public void keyPressed(KeyEvent arg0) { } + @Override public void keyTyped(KeyEvent arg0) { } }); + + quickSearch.addKeyListener(search); + quickSearch.addFocusListener(new FocusListener() { @Override public void focusGained(final FocusEvent arg0) { @@ -259,6 +229,9 @@ public class FileNavigationPane extends VisibleComponent implements } } }); + + getContentPane().setLayout(new BorderLayout()); + getContentPane().add(new JScrollPane(tree), BorderLayout.CENTER); JPanel p2 = new JPanel(); p2.setLayout(new BorderLayout()); @@ -518,6 +491,28 @@ public class FileNavigationPane extends VisibleComponent implements tree.updateUI(); } + public void openPath(TreePath path) { + if (path == null) + return; + final StringBuffer nameBuffer = new StringBuffer(); + for (int i = 2; i < path.getPathCount(); i++) { + nameBuffer.append(path.getPathComponent(i)); + if (i < path.getPathCount() - 1) { + nameBuffer.append("/"); + } + } + + String name = nameBuffer.toString(); + if(name.endsWith(".class")) { + final ClassNode cn = BytecodeViewer.getClassNode(name.substring(0, name.length() - ".class".length())); + if (cn != null) { + openClassFileToWorkSpace(nameBuffer.toString(), cn); + } + } else { + openFileToWorkSpace(nameBuffer.toString(), BytecodeViewer.getFileContents(nameBuffer.toString())); + } + } + /** * * @author http://stackoverflow.com/questions/14968005 @@ -544,31 +539,33 @@ public class FileNavigationPane extends VisibleComponent implements String name = node.toString().toLowerCase(); if(name.endsWith(".jar")) { - setIcon(Resources.jar); + setIcon(Resources.jarIcon); } else if(name.endsWith(".zip")) { - setIcon(Resources.zip); + setIcon(Resources.zipIcon); } else if(name.endsWith(".bat")) { - setIcon(Resources.bat); + setIcon(Resources.batIcon); } else if(name.endsWith(".sh")) { - setIcon(Resources.sh); + setIcon(Resources.shIcon); } else if(name.endsWith(".cs")) { - setIcon(Resources.csharp); + setIcon(Resources.csharpIcon); } else if(name.endsWith(".c") ||name.endsWith(".cpp") ||name.endsWith(".h")) { - setIcon(Resources.cplusplus); + setIcon(Resources.cplusplusIcon); } else if(name.endsWith(".apk") || name.endsWith(".dex")) { - setIcon(Resources.android); + setIcon(Resources.androidIcon); } else if(name.endsWith(".png") || name.endsWith(".jpg") || name.endsWith(".jpeg") || name.endsWith(".bmp") || name.endsWith(".gif")) { - setIcon(Resources.imageFile); + setIcon(Resources.imageIcon); } else if(name.endsWith(".class")) { - setIcon(Resources.classFile); + setIcon(Resources.classIcon); + } else if(name.endsWith(".java")) { + setIcon(Resources.javaIcon); } else if(name.endsWith(".txt") || name.endsWith(".md")) { - setIcon(Resources.textFile); + setIcon(Resources.textIcon); } else if(name.equals("decoded resources")) { - setIcon(Resources.decoded); + setIcon(Resources.decodedIcon); } else if(name.endsWith(".properties") || name.endsWith(".xml") || name.endsWith(".mf") || name.endsWith(".config") || name.endsWith(".cfg")) { - setIcon(Resources.config); + setIcon(Resources.configIcon); } else if(node.getChildCount() <= 0) { //random file - setIcon(Resources.file); + setIcon(Resources.fileIcon); } else { //folder ArrayList nodes = new ArrayList(); ArrayList totalNodes = new ArrayList(); @@ -605,9 +602,9 @@ public class FileNavigationPane extends VisibleComponent implements } if(isJava) - setIcon(Resources.packages); + setIcon(Resources.packagesIcon); else { - setIcon(Resources.folder); + setIcon(Resources.folderIcon); } } } diff --git a/src/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI.java b/src/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI.java index 9473484f..ac47ea3d 100644 --- a/src/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI.java +++ b/src/the/bytecode/club/bytecodeviewer/gui/MainViewerGUI.java @@ -38,6 +38,7 @@ import org.objectweb.asm.tree.ClassNode; import the.bytecode.club.bytecodeviewer.BytecodeViewer; import the.bytecode.club.bytecodeviewer.Dex2Jar; import the.bytecode.club.bytecodeviewer.FileChangeNotifier; +import the.bytecode.club.bytecodeviewer.FileContainer; import the.bytecode.club.bytecodeviewer.JarUtils; import the.bytecode.club.bytecodeviewer.MiscUtils; import the.bytecode.club.bytecodeviewer.Resources; @@ -526,9 +527,9 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier { public void run() { if (busy) { try { - mntmNewMenuItem_4.setIcon(Resources.busy); + mntmNewMenuItem_4.setIcon(Resources.busyIcon); } catch (NullPointerException e) { - mntmNewMenuItem_4.setIcon(Resources.busyB64); + mntmNewMenuItem_4.setIcon(Resources.busyB64Icon); } } else mntmNewMenuItem_4.setIcon(null); @@ -564,6 +565,10 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier { public final ButtonGroup apkConversionGroup = new ButtonGroup(); public final JRadioButtonMenuItem apkConversionDex = new JRadioButtonMenuItem("Dex2Jar"); public final JRadioButtonMenuItem apkConversionEnjarify = new JRadioButtonMenuItem("Enjarify"); + private final JMenuItem mntmSetPythonx = new JMenuItem("Set Python 3.X Executable"); + private final JMenuItem mntmReloadResources = new JMenuItem("Reload Resources"); + private final JSeparator separator_39 = new JSeparator(); + private final JSeparator separator_40 = new JSeparator(); public void calledAfterLoad() { chckbxmntmDeleteForiegnoutdatedLibs.setSelected(BytecodeViewer.deleteForiegnLibraries); @@ -677,6 +682,8 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier { } }); mnNewMenu.add(mntmLoadJar); + + mnNewMenu.add(separator_40); mnNewMenu.add(mntmNewWorkspace); @@ -747,6 +754,35 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier { } } }); + + mnNewMenu.add(separator_39); + mntmReloadResources.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + JOptionPane pane = new JOptionPane("Are you sure you wish to reload the resources?"); + Object[] options = new String[] { "Yes", "No" }; + pane.setOptions(options); + JDialog dialog = pane.createDialog(BytecodeViewer.viewer, "Bytecode Viewer - Reload Resources"); + 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) { + ArrayList reopen = new ArrayList(); + for(FileContainer container : BytecodeViewer.files) + reopen.add(container.file); + + BytecodeViewer.files.clear(); + BytecodeViewer.openFiles(reopen.toArray(new File[reopen.size()]), false); + + //refresh panes + } + } + }); + + mnNewMenu.add(mntmReloadResources); mnNewMenu.add(separator_3); mntmNewMenuItem_3.addActionListener(new ActionListener() { @@ -1491,6 +1527,7 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier { mnApkConversion.add(apkConversionEnjarify); mnSettings.add(separator_37); + chckbxmntmNewCheckItem_12.setSelected(true); mnSettings.add(chckbxmntmNewCheckItem_12); chckbxmntmDeleteForiegnoutdatedLibs.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { @@ -1519,6 +1556,13 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier { rtC(); } }); + mntmSetPythonx.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent arg0) { + pythonC3(); + } + }); + + mnSettings.add(mntmSetPythonx); mnSettings.add(mntmSetJreRt); mntmSetOpitonalLibrary.addActionListener(new ActionListener() {