diff --git a/plugins/example/ExampleStringDecrypter.java b/plugins/example/ExampleStringDecrypter.java index 5b75264f..b6307a54 100644 --- a/plugins/example/ExampleStringDecrypter.java +++ b/plugins/example/ExampleStringDecrypter.java @@ -15,7 +15,7 @@ public class ExampleStringDecrypter extends Plugin { @Override public void execute(ArrayList classNodesList) { - PluginConsole gui = new PluginConsole("Example String Decrypter"); + PluginConsole gui = new PluginConsole(activeContainer.name + "Example String Decrypter"); MultipleChoiceDialogue dialogue = new MultipleChoiceDialogue("Bytecode Viewer - WARNING", "WARNING: This will load the classes into the JVM and execute the initialize function" diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/decompilers/impl/FernFlowerDecompiler.java b/src/main/java/the/bytecode/club/bytecodeviewer/decompilers/impl/FernFlowerDecompiler.java index 63b189dc..7f5e7afd 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/decompilers/impl/FernFlowerDecompiler.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/decompilers/impl/FernFlowerDecompiler.java @@ -70,7 +70,7 @@ public class FernFlowerDecompiler extends InternalDecompiler String start = tempDirectory + fs + MiscUtils.getUniqueName("", ".class"); final File tempClass = new File(start + ".class"); - + String exception = ""; try { final FileOutputStream fos = new FileOutputStream(tempClass); diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/AllatoriStringDecrypter.java b/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/AllatoriStringDecrypter.java index 76f4d0ee..6365e1b3 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/AllatoriStringDecrypter.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/AllatoriStringDecrypter.java @@ -45,7 +45,6 @@ import static the.bytecode.club.bytecodeviewer.Constants.nl; public class AllatoriStringDecrypter extends Plugin { - final PluginConsole frame = new PluginConsole("Allatori String Decrypter"); final StringBuilder out = new StringBuilder(); final String className; @@ -54,6 +53,8 @@ public class AllatoriStringDecrypter extends Plugin @Override public void execute(ArrayList classNodeList) { + PluginConsole frame = new PluginConsole(activeContainer.name + " - Allatori String Decrypter"); + MultipleChoiceDialogue dialogue = new MultipleChoiceDialogue("Bytecode Viewer - WARNING", "WARNING: This will load the classes into the JVM and execute the allatori decrypter function" + nl + "for each class. IF THE FILE YOU'RE LOADING IS MALICIOUS, DO NOT CONTINUE.", diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/EZInjection.java b/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/EZInjection.java index cd0f8715..63e81493 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/EZInjection.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/EZInjection.java @@ -51,7 +51,6 @@ public class EZInjection extends Plugin { public static ArrayList hookArray = new ArrayList<>(); private static final String version = "1.0"; - private static final PluginConsole gui = new PluginConsole("EZ Injection v" + version); private final boolean accessModifiers; private final boolean injectHooks; private final boolean invokeMethod; @@ -140,7 +139,7 @@ public class EZInjection extends Plugin @Override public void execute(ArrayList classNodeList) { - BytecodeViewer.updateBusyStatus(true); + PluginConsole gui = new PluginConsole(activeContainer.name + " - EZ Injection v" + version); gui.setText(""); @@ -328,7 +327,5 @@ public class EZInjection extends Plugin } } } - - BytecodeViewer.updateBusyStatus(false); } } diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/MaliciousCodeScanner.java b/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/MaliciousCodeScanner.java index 54e7b69d..5b3aca75 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/MaliciousCodeScanner.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/MaliciousCodeScanner.java @@ -51,7 +51,7 @@ public class MaliciousCodeScanner extends Plugin @Override public void execute(ArrayList classNodeList) { - PluginConsole frame = new PluginConsole("Malicious Code Scanner"); + PluginConsole frame = new PluginConsole(activeContainer.name + " - Malicious Code Scanner"); StringBuilder sb = new StringBuilder(); HashSet scanOptions = new HashSet<>(); diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ReplaceStrings.java b/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ReplaceStrings.java index 03072033..5d99113f 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ReplaceStrings.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ReplaceStrings.java @@ -36,7 +36,7 @@ import the.bytecode.club.bytecodeviewer.api.PluginConsole; public class ReplaceStrings extends Plugin { - PluginConsole frame = new PluginConsole("Replace Strings"); + PluginConsole frame; String originalLDC; String newLDC; String className; @@ -53,6 +53,8 @@ public class ReplaceStrings extends Plugin @Override public void execute(ArrayList classNodeList) { + frame = new PluginConsole(activeContainer.name + " - Replace Strings"); + if (!className.equals("*")) { for (ClassNode classNode : classNodeList) diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ShowAllStrings.java b/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ShowAllStrings.java index cc1f2cc4..6cc04719 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ShowAllStrings.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ShowAllStrings.java @@ -44,7 +44,7 @@ public class ShowAllStrings extends Plugin @Override public void execute(ArrayList classNodeList) { - PluginConsole frame = new PluginConsole("Show All Strings"); + PluginConsole frame = new PluginConsole(activeContainer.name + " - Show All Strings"); StringBuilder sb = new StringBuilder(); for (ClassNode classNode : classNodeList) diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ShowMainMethods.java b/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ShowMainMethods.java index e8f2c327..be58268b 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ShowMainMethods.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ShowMainMethods.java @@ -39,7 +39,7 @@ public class ShowMainMethods extends Plugin @Override public void execute(ArrayList classNodeList) { - PluginConsole frame = new PluginConsole("Show Main Methods"); + PluginConsole frame = new PluginConsole(activeContainer.name + " - Show Main Methods"); StringBuilder sb = new StringBuilder(); for (ClassNode classNode : classNodeList) diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/StackFramesRemover.java b/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/StackFramesRemover.java index 4fb807ef..b6916535 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/StackFramesRemover.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/StackFramesRemover.java @@ -15,7 +15,7 @@ public class StackFramesRemover extends Plugin public void execute(ArrayList classNodeList) { AtomicInteger counter = new AtomicInteger(); - PluginConsole frame = new PluginConsole("StackFrames Remover"); + PluginConsole frame = new PluginConsole(activeContainer.name + " - StackFrames Remover"); for (ClassNode cn : classNodeList) { for (MethodNode mn : cn.methods) diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ViewAPKAndroidPermissions.java b/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ViewAPKAndroidPermissions.java index 41a6e3ec..e7b1d55d 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ViewAPKAndroidPermissions.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ViewAPKAndroidPermissions.java @@ -17,7 +17,7 @@ public class ViewAPKAndroidPermissions extends Plugin @Override public void execute(ArrayList classNodeList) { - PluginConsole frame = new PluginConsole("Android Permissions"); + PluginConsole frame = new PluginConsole(activeContainer.name + " - Android Permissions"); frame.setVisible(true); byte[] encodedAndroidManifest = BytecodeViewer.getFileContents("AndroidManifest.xml"); diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ViewManifest.java b/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ViewManifest.java index ef30b731..f1bad95a 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ViewManifest.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ViewManifest.java @@ -17,7 +17,7 @@ public class ViewManifest extends Plugin @Override public void execute(ArrayList classNodeList) { - PluginConsole frame = new PluginConsole("View Manifest"); + PluginConsole frame = new PluginConsole(activeContainer.name + " - View Manifest"); frame.setVisible(true); //TODO android APKs may have AndroidManifests that can be viewed normally, this should be checked diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ZStringArrayDecrypter.java b/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ZStringArrayDecrypter.java index 428a6127..5b590f29 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ZStringArrayDecrypter.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/plugin/preinstalled/ZStringArrayDecrypter.java @@ -41,12 +41,12 @@ import static the.bytecode.club.bytecodeviewer.Constants.*; public class ZStringArrayDecrypter extends Plugin { - PluginConsole gui = new PluginConsole("ZStringArray Decrypter"); - StringBuilder out = new StringBuilder(); - @Override public void execute(ArrayList classNodeList) { + PluginConsole gui = new PluginConsole(activeContainer.name + " - ZStringArray Decrypter"); + StringBuilder out = new StringBuilder(); + MultipleChoiceDialogue dialogue = new MultipleChoiceDialogue("Bytecode Viewer - WARNING", "WARNING: This will load the classes into the JVM and execute the initialize function" + nl + "for each class. IF THE FILE YOU'RE LOADING IS MALICIOUS, DO NOT CONTINUE.", diff --git a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/strategies/JavascriptPluginLaunchStrategy.java b/src/main/java/the/bytecode/club/bytecodeviewer/plugin/strategies/JavascriptPluginLaunchStrategy.java index 104d227f..de414bba 100644 --- a/src/main/java/the/bytecode/club/bytecodeviewer/plugin/strategies/JavascriptPluginLaunchStrategy.java +++ b/src/main/java/the/bytecode/club/bytecodeviewer/plugin/strategies/JavascriptPluginLaunchStrategy.java @@ -62,6 +62,10 @@ public class JavascriptPluginLaunchStrategy implements PluginLaunchStrategy { try { + //add the active container as a global variable to the JS script + finalEngine.put("activeContainer", activeContainer); + + //invoke the JS function ((Invocable) finalEngine).invokeFunction("execute", classNodeList); } catch (NoSuchMethodException | ScriptException e) diff --git a/src/main/resources/templates/Template_Plugin.java b/src/main/resources/templates/Template_Plugin.java index d01cde6d..dacd295e 100644 --- a/src/main/resources/templates/Template_Plugin.java +++ b/src/main/resources/templates/Template_Plugin.java @@ -4,7 +4,7 @@ import org.objectweb.asm.tree.ClassNode; public class Template extends Plugin { - PluginConsole gui = new PluginConsole("Java Template"); + PluginConsole gui; /** * Main function @@ -12,7 +12,11 @@ public class Template extends Plugin @Override public void execute(ArrayList classNodeList) { + //create console + gui = new PluginConsole(activeContainer.name + "Java Template"); gui.setVisible(true); //show the console + + //debug text out("Class Nodes: " + classNodeList.size()); //iterate through each class node diff --git a/src/main/resources/templates/Template_Plugin.js b/src/main/resources/templates/Template_Plugin.js index 3e9074af..fb46bedb 100644 --- a/src/main/resources/templates/Template_Plugin.js +++ b/src/main/resources/templates/Template_Plugin.js @@ -1,12 +1,13 @@ var BCV = Java.type("the.bytecode.club.bytecodeviewer.api.BCV"); var PluginConsole = Java.type("the.bytecode.club.bytecodeviewer.api.PluginConsole"); -var gui = new PluginConsole("Javascript Template"); +var gui; /** * Main function */ function execute(classNodeList) { + gui = new PluginConsole(activeContainer.name + "Javascript Template"); gui.setVisible(true); //show the console out("Class Nodes: " + classNodeList.size());