BCV API Change

This API change will break compatibility with most pre-existing plugins
This commit is contained in:
Konloch 2021-07-06 21:36:11 -07:00
parent 7eda960981
commit c5b53be4b8
13 changed files with 31 additions and 32 deletions

View file

@ -26,7 +26,7 @@ public class ExampleStringDecrypter extends Plugin {
{ {
for(ClassNode cn : classNodesList) for(ClassNode cn : classNodesList)
{ {
the.bytecode.club.bytecodeviewer.api.BytecodeViewer.getClassNodeLoader().addClass(cn); BCV.getClassNodeLoader().addClass(cn);
for(Object o : cn.fields.toArray()) for(Object o : cn.fields.toArray())
{ {
@ -34,7 +34,7 @@ public class ExampleStringDecrypter extends Plugin {
if(f.name.equals("z")) {// && f.desc.equals("([Ljava/lang/String;)V")) { if(f.name.equals("z")) {// && f.desc.equals("([Ljava/lang/String;)V")) {
try try
{ {
for(Field f2 : the.bytecode.club.bytecodeviewer.api.BytecodeViewer.getClassNodeLoader().nodeToClass(cn).getFields()) for(Field f2 : BCV.getClassNodeLoader().nodeToClass(cn).getFields())
{ {
String s = f2.get(null); String s = f2.get(null);
if(s != null && !s.empty()) if(s != null && !s.empty())

View file

@ -26,7 +26,7 @@ public class ExampleStringDecrypter extends Plugin {
{ {
for(ClassNode cn : classNodesList) for(ClassNode cn : classNodesList)
{ {
the.bytecode.club.bytecodeviewer.api.BytecodeViewer.getClassNodeLoader().addClass(cn); the.bytecode.club.bytecodeviewer.api.BCV.getClassNodeLoader().addClass(cn);
for(Object o : cn.fields.toArray()) for(Object o : cn.fields.toArray())
{ {
@ -34,7 +34,7 @@ public class ExampleStringDecrypter extends Plugin {
if(f.name.equals("z")) {// && f.desc.equals("([Ljava/lang/String;)V")) { if(f.name.equals("z")) {// && f.desc.equals("([Ljava/lang/String;)V")) {
try try
{ {
for(Field f2 : the.bytecode.club.bytecodeviewer.api.BytecodeViewer.getClassNodeLoader().nodeToClass(cn).getFields()) for(Field f2 : the.bytecode.club.bytecodeviewer.api.BCV.getClassNodeLoader().nodeToClass(cn).getFields())
{ {
String s = f2.get(null); String s = f2.get(null);
if(s != null && !s.empty()) if(s != null && !s.empty())

View file

@ -4,7 +4,7 @@
var PluginConsole = Java.type("the.bytecode.club.bytecodeviewer.api.PluginConsole"); var PluginConsole = Java.type("the.bytecode.club.bytecodeviewer.api.PluginConsole");
var MultipleChoiceDialogue = Java.type("the.bytecode.club.bytecodeviewer.gui.components.MultipleChoiceDialogue") var MultipleChoiceDialogue = Java.type("the.bytecode.club.bytecodeviewer.gui.components.MultipleChoiceDialogue")
var BytecodeViewer = Java.type("the.bytecode.club.bytecodeviewer.api.BytecodeViewer") var BytecodeViewer = Java.type("the.bytecode.club.bytecodeviewer.api.BCV")
var dialogue = new MultipleChoiceDialogue("Bytecode Viewer - WARNING", var dialogue = new MultipleChoiceDialogue("Bytecode Viewer - WARNING",
"WARNING: This will load the classes into the JVM and execute the initialize function" "WARNING: This will load the classes into the JVM and execute the initialize function"

View file

@ -126,7 +126,7 @@ public class BytecodeViewer
public static List<Process> createdProcesses = new ArrayList<>(); public static List<Process> createdProcesses = new ArrayList<>();
//Security Manager for dynamic analysis debugging //Security Manager for dynamic analysis debugging
public static SecurityMan sm = new SecurityMan(); //might be insecure due to assholes targeting BCV, public static SecurityMan sm = new SecurityMan(); //might be insecure due to assholes targeting BCV
//Refactorer //Refactorer
public static Refactorer refactorer = new Refactorer(); public static Refactorer refactorer = new Refactorer();

View file

@ -41,14 +41,15 @@ import static the.bytecode.club.bytecodeviewer.Constants.*;
***************************************************************************/ ***************************************************************************/
/** /**
* The official API for BCV, this was designed for plugin authors and * The official API for BCV, this was designed for plugin authors and developers utilizing EZ-Injection.
* people utilizing EZ-Injection. *
* The BCV Class is meant to to help aid in dynamic analysis and plugin utility.
* *
* @author Konloch * @author Konloch
*/ */
public class BytecodeViewer public class BCV
{ {
private static ClassNodeLoader loader = new ClassNodeLoader(); //might be insecure due to assholes targeting BCV, private static ClassNodeLoader loader = new ClassNodeLoader(); //might be insecure due to assholes targeting BCV
private static URLClassLoader cl; private static URLClassLoader cl;
/** /**
@ -94,7 +95,7 @@ public class BytecodeViewer
{ {
File f = new File(tempDirectory + fs + MiscUtils.randomString(12) + "loaded_temp.jar"); File f = new File(tempDirectory + fs + MiscUtils.randomString(12) + "loaded_temp.jar");
JarUtils.saveAsJar(BytecodeViewer.getLoadedClasses(), f.getAbsolutePath()); JarUtils.saveAsJar(BCV.getLoadedClasses(), f.getAbsolutePath());
JarFile jarFile = new JarFile("" + f.getAbsolutePath()); JarFile jarFile = new JarFile("" + f.getAbsolutePath());
Enumeration<JarEntry> e = jarFile.entries(); Enumeration<JarEntry> e = jarFile.entries();

View file

@ -105,10 +105,10 @@ public class RunOptions extends JFrame
console.setSelected(true); console.setSelected(true);
getContentPane().add(console); getContentPane().add(console);
final JCheckBox chckbxPrintToTerminal = new JCheckBox("Print To Command Line"); final JCheckBox printToCommandLine = new JCheckBox("Print To Command Line");
chckbxPrintToTerminal.setSelected(true); printToCommandLine.setSelected(true);
chckbxPrintToTerminal.setBounds(6, 315, 232, 23); printToCommandLine.setBounds(6, 315, 232, 23);
getContentPane().add(chckbxPrintToTerminal); getContentPane().add(printToCommandLine);
this.setLocationRelativeTo(null); this.setLocationRelativeTo(null);
btnNewButton.addActionListener(arg0 -> { btnNewButton.addActionListener(arg0 -> {
PluginManager.runPlugin(new EZInjection(accessModifiers PluginManager.runPlugin(new EZInjection(accessModifiers
@ -119,7 +119,7 @@ public class RunOptions extends JFrame
.getText(), this.socksProxy.getText(), forceProxy .getText(), this.socksProxy.getText(), forceProxy
.isSelected(), .isSelected(),
launchReflectionKit.isSelected(), console.isSelected(), launchReflectionKit.isSelected(), console.isSelected(),
chckbxPrintToTerminal.isSelected())); printToCommandLine.isSelected()));
dispose(); dispose();
}); });
} }

View file

@ -9,10 +9,7 @@ import org.objectweb.asm.tree.*;
import the.bytecode.club.bytecodeviewer.BytecodeViewer; import the.bytecode.club.bytecodeviewer.BytecodeViewer;
import the.bytecode.club.bytecodeviewer.Constants; import the.bytecode.club.bytecodeviewer.Constants;
import the.bytecode.club.bytecodeviewer.Resources; import the.bytecode.club.bytecodeviewer.Resources;
import the.bytecode.club.bytecodeviewer.api.ASMUtil; import the.bytecode.club.bytecodeviewer.api.*;
import the.bytecode.club.bytecodeviewer.api.ExceptionUI;
import the.bytecode.club.bytecodeviewer.api.Plugin;
import the.bytecode.club.bytecodeviewer.api.PluginConsole;
import the.bytecode.club.bytecodeviewer.gui.components.MultipleChoiceDialogue; import the.bytecode.club.bytecodeviewer.gui.components.MultipleChoiceDialogue;
import the.bytecode.club.bytecodeviewer.plugin.PluginManager; import the.bytecode.club.bytecodeviewer.plugin.PluginManager;
@ -169,7 +166,7 @@ public class AllatoriStringDecrypter extends Plugin
{ {
System.out.println("Loading " + decrypterClassName); System.out.println("Loading " + decrypterClassName);
Class<?> decrypterClassList = the.bytecode.club.bytecodeviewer.api.BytecodeViewer Class<?> decrypterClassList = BCV
.loadClassIntoClassLoader(decrypterClassNode); .loadClassIntoClassLoader(decrypterClassNode);
String decrypted = invokeDecrypter(decrypterClassList, decrypterMethodName, (String) laststringldconstack.cst); String decrypted = invokeDecrypter(decrypterClassList, decrypterMethodName, (String) laststringldconstack.cst);

View file

@ -11,6 +11,7 @@ import org.objectweb.asm.tree.LdcInsnNode;
import org.objectweb.asm.tree.MethodInsnNode; import org.objectweb.asm.tree.MethodInsnNode;
import org.objectweb.asm.tree.MethodNode; import org.objectweb.asm.tree.MethodNode;
import the.bytecode.club.bytecodeviewer.BytecodeViewer; import the.bytecode.club.bytecodeviewer.BytecodeViewer;
import the.bytecode.club.bytecodeviewer.api.BCV;
import the.bytecode.club.bytecodeviewer.api.BytecodeHook; import the.bytecode.club.bytecodeviewer.api.BytecodeHook;
import the.bytecode.club.bytecodeviewer.api.Plugin; import the.bytecode.club.bytecodeviewer.api.Plugin;
import the.bytecode.club.bytecodeviewer.api.PluginConsole; import the.bytecode.club.bytecodeviewer.api.PluginConsole;
@ -71,7 +72,7 @@ public class EZInjection extends Plugin {
boolean useProxy, boolean launchKit, boolean console, boolean useProxy, boolean launchKit, boolean console,
boolean printCmdL) boolean printCmdL)
{ {
the.bytecode.club.bytecodeviewer.api.BytecodeViewer.createNewClassNodeLoaderInstance(); BCV.createNewClassNodeLoaderInstance();
this.accessModifiers = accessModifiers; this.accessModifiers = accessModifiers;
this.injectHooks = injectHooks; this.injectHooks = injectHooks;
EZInjection.debugHooks = debugHooks; EZInjection.debugHooks = debugHooks;
@ -279,7 +280,7 @@ public class EZInjection extends Plugin {
// load all the classnodes into the classloader // load all the classnodes into the classloader
for (ClassNode cn : BytecodeViewer.getLoadedClasses()) for (ClassNode cn : BytecodeViewer.getLoadedClasses())
the.bytecode.club.bytecodeviewer.api.BytecodeViewer.getClassNodeLoader().addClass(cn); BCV.getClassNodeLoader().addClass(cn);
print("Attempting to find " + invokeMethodInformation + ":" + nl + nl); print("Attempting to find " + invokeMethodInformation + ":" + nl + nl);
@ -292,7 +293,7 @@ public class EZInjection extends Plugin {
if (invokeMethodInformation.equals(methodInformation)) if (invokeMethodInformation.equals(methodInformation))
{ {
for (Method m2 : the.bytecode.club.bytecodeviewer.api.BytecodeViewer for (Method m2 : BCV
.getClassNodeLoader().nodeToClass(classNode) .getClassNodeLoader().nodeToClass(classNode)
.getMethods()) .getMethods())
{ {

View file

@ -4,10 +4,10 @@ import java.lang.reflect.Field;
import java.lang.reflect.Modifier; import java.lang.reflect.Modifier;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Objects; import java.util.Objects;
import javax.swing.JDialog;
import javax.swing.JOptionPane;
import org.objectweb.asm.tree.ClassNode; import org.objectweb.asm.tree.ClassNode;
import the.bytecode.club.bytecodeviewer.BytecodeViewer; import the.bytecode.club.bytecodeviewer.BytecodeViewer;
import the.bytecode.club.bytecodeviewer.api.BCV;
import the.bytecode.club.bytecodeviewer.api.Plugin; import the.bytecode.club.bytecodeviewer.api.Plugin;
import the.bytecode.club.bytecodeviewer.api.PluginConsole; import the.bytecode.club.bytecodeviewer.api.PluginConsole;
import the.bytecode.club.bytecodeviewer.gui.components.MultipleChoiceDialogue; import the.bytecode.club.bytecodeviewer.gui.components.MultipleChoiceDialogue;
@ -56,7 +56,7 @@ public class ZStringArrayDecrypter extends Plugin
{ {
boolean needsWarning = false; boolean needsWarning = false;
for (Class<?> cn : for (Class<?> cn :
Objects.requireNonNull(the.bytecode.club.bytecodeviewer.api.BytecodeViewer.loadClassesIntoClassLoader())) Objects.requireNonNull(BCV.loadClassesIntoClassLoader()))
{ {
try try
{ {

View file

@ -2,7 +2,7 @@ package the.bytecode.club.bytecodeviewer.util;
import the.bytecode.club.bytecodeviewer.BytecodeViewer; import the.bytecode.club.bytecodeviewer.BytecodeViewer;
import the.bytecode.club.bytecodeviewer.Configuration; import the.bytecode.club.bytecodeviewer.Configuration;
import the.bytecode.club.bytecodeviewer.gui.components.MultipleChoiceDialogue; import the.bytecode.club.bytecodeviewer.api.BCV;
import java.io.File; import java.io.File;
@ -22,7 +22,7 @@ public class BCVResourceUtils
BytecodeViewer.viewer.resourcePane.resetWorkspace(); BytecodeViewer.viewer.resourcePane.resetWorkspace();
BytecodeViewer.viewer.workPane.resetWorkspace(); BytecodeViewer.viewer.workPane.resetWorkspace();
BytecodeViewer.viewer.searchBoxPane.resetWorkspace(); BytecodeViewer.viewer.searchBoxPane.resetWorkspace();
the.bytecode.club.bytecodeviewer.api.BytecodeViewer.getClassNodeLoader().clear(); BCV.getClassNodeLoader().clear();
} }
/** /**

View file

@ -32,7 +32,7 @@ import java.security.Permission;
public class SecurityMan extends SecurityManager public class SecurityMan extends SecurityManager
{ {
private boolean blocking = true; //might be insecure due to assholes targeting BCV, however that's highly unlikely. private boolean blocking = true; //might be insecure due to assholes targeting BCV
private boolean printing = false; private boolean printing = false;
private boolean printingPackage = false; private boolean printingPackage = false;

View file

@ -19,7 +19,7 @@ public class Template extends Plugin
for(ClassNode cn : classNodeList) for(ClassNode cn : classNodeList)
process(cn); process(cn);
BytecodeViewer.hideFrame(gui, 10000); //hides the console after 10 seconds BCV.hideFrame(gui, 10000); //hides the console after 10 seconds
} }
/** /**

View file

@ -1,4 +1,4 @@
var BCV = Java.type("the.bytecode.club.bytecodeviewer.api.BytecodeViewer"); var BCV = Java.type("the.bytecode.club.bytecodeviewer.api.BCV");
var PluginConsole = Java.type("the.bytecode.club.bytecodeviewer.api.PluginConsole"); var PluginConsole = Java.type("the.bytecode.club.bytecodeviewer.api.PluginConsole");
var gui = new PluginConsole("Javascript Template"); var gui = new PluginConsole("Javascript Template");