bcv-vf/plugins/java/ExampleStringDecrypter.java

49 lines
1.8 KiB
Java
Raw Normal View History

2021-06-27 21:45:36 +00:00
import java.lang.reflect.Field;
2022-01-08 10:48:25 +00:00
import java.util.List;
2021-06-27 21:45:36 +00:00
import org.objectweb.asm.tree.ClassNode;
2022-01-08 10:48:25 +00:00
import org.objectweb.asm.tree.FieldNode;
import the.bytecode.club.bytecodeviewer.api.*;
import the.bytecode.club.bytecodeviewer.gui.components.MultipleChoiceDialog;
2021-06-27 21:45:36 +00:00
import static the.bytecode.club.bytecodeviewer.Constants.nl;
/**
* This is an example of a string decrypter plugin
*/
public class ExampleStringDecrypter extends Plugin {
@Override
2022-01-08 10:48:25 +00:00
public void execute(List<ClassNode> classNodesList) {
2022-01-18 01:35:13 +00:00
PluginConsole gui = new PluginConsole("Example String Decrypter Java Edition");
2021-06-27 21:45:36 +00:00
MultipleChoiceDialog dialog = new MultipleChoiceDialog("Bytecode Viewer - WARNING",
2021-06-27 21:45:36 +00:00
"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.",
new String[]{"Continue", "Cancel"});
2022-01-08 10:48:25 +00:00
if (dialog.promptChoice() == 0) {
for (ClassNode cn : classNodesList) {
BCV.getClassNodeLoader().addClass(cn);
2021-06-27 21:45:36 +00:00
2022-01-08 10:48:25 +00:00
for (Object o : cn.fields.toArray()) {
2021-06-27 21:45:36 +00:00
FieldNode f = (FieldNode) o;
2022-01-08 10:48:25 +00:00
if (f.name.equals("z")) {// && f.desc.equals("([Ljava/lang/String;)V")) {
try {
for (Field f2 : BCV.getClassNodeLoader().nodeToClass(cn).getFields()) {
String s = (String) f2.get(null);
if (s != null && !s.isEmpty())
gui.appendText(cn + ":" + s);
2021-06-27 21:45:36 +00:00
}
2022-01-08 10:48:25 +00:00
} catch (Exception ignored) {
}
2021-06-27 21:45:36 +00:00
}
}
}
gui.setVisible(true);
}
}
2022-01-08 10:48:25 +00:00
}