bcv-vf/plugins/groovy/ExampleStringDecrypter.gy
2022-01-22 13:38:29 -06:00

51 lines
1.9 KiB
Text

import org.objectweb.asm.tree.ClassNode
import org.objectweb.asm.tree.FieldNode
import the.bytecode.club.bytecodeviewer.api.BCV
import the.bytecode.club.bytecodeviewer.api.Plugin
import the.bytecode.club.bytecodeviewer.api.PluginConsole
import the.bytecode.club.bytecodeviewer.gui.components.MultipleChoiceDialog
import java.lang.reflect.Field
import static the.bytecode.club.bytecodeviewer.Constants.nl
/**
** This is an example of a String Decrypter Groovy Plugin for BCV.
**
** @author [Your-Name-Goes-Here]
**/
class ExampleStringDecrypter extends Plugin {
@Override
void execute(List<ClassNode> classNodesList) {
PluginConsole gui = new PluginConsole("Example String Decrypter Groovy Edition")
MultipleChoiceDialog dialog = new MultipleChoiceDialog("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.",
new String[]{"Continue", "Cancel"})
if (dialog.promptChoice() == 0) {
for (ClassNode cn : classNodesList) {
BCV.getClassNodeLoader().addClass(cn)
for (Object o : cn.fields.toArray()) {
FieldNode f = (FieldNode) o
if (f.name == "z") {// && f.desc.equals("([Ljava/lang/String;)V")) {
try {
for (Field f2 : BCV.getClassNodeLoader().nodeToClass(cn).getFields()) {
String s = f2.get(null)
if (s != null && !s.empty)
gui.appendText(cn + ":" + s)
}
} catch (Exception | StackOverflowError ignored) {
}
}
}
}
gui.setVisible(true)
}
}
}