bcv-vf/plugins/groovy/ExampleStringDecrypter.gy

52 lines
1.9 KiB
Text
Raw Normal View History

2021-12-19 23:24:17 +00:00
import org.objectweb.asm.tree.ClassNode
2021-06-27 21:41:58 +00:00
import org.objectweb.asm.tree.FieldNode
2021-12-19 23:24:17 +00:00
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
2021-06-27 21:41:58 +00:00
2021-12-19 23:24:17 +00:00
import static the.bytecode.club.bytecodeviewer.Constants.nl
2021-06-26 13:04:31 +00:00
/**
2022-01-22 19:19:05 +00:00
** This is an example of a String Decrypter Groovy Plugin for BCV.
**
2022-01-22 19:38:29 +00:00
** @author [Your-Name-Goes-Here]
2022-01-22 19:19:05 +00:00
**/
2021-12-19 23:24:17 +00:00
class ExampleStringDecrypter extends Plugin {
2021-06-26 13:04:31 +00:00
@Override
2021-12-19 23:24:17 +00:00
void execute(List<ClassNode> classNodesList) {
2022-01-18 01:35:09 +00:00
PluginConsole gui = new PluginConsole("Example String Decrypter Groovy Edition")
2021-06-26 13:04:31 +00:00
MultipleChoiceDialog dialog = new MultipleChoiceDialog("Bytecode Viewer - WARNING",
2021-06-27 21:41:58 +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.",
2021-12-19 23:24:17 +00:00
new String[]{"Continue", "Cancel"})
2021-06-26 13:04:31 +00:00
2022-01-08 10:48:25 +00:00
if (dialog.promptChoice() == 0) {
for (ClassNode cn : classNodesList) {
2021-12-19 23:24:17 +00:00
BCV.getClassNodeLoader().addClass(cn)
2021-06-26 13:04:31 +00:00
2022-01-08 10:48:25 +00:00
for (Object o : cn.fields.toArray()) {
2021-12-19 23:24:17 +00:00
FieldNode f = (FieldNode) o
2022-01-08 10:48:25 +00:00
if (f.name == "z") {// && f.desc.equals("([Ljava/lang/String;)V")) {
try {
for (Field f2 : BCV.getClassNodeLoader().nodeToClass(cn).getFields()) {
2021-12-19 23:24:17 +00:00
String s = f2.get(null)
2022-01-08 10:48:25 +00:00
if (s != null && !s.empty)
2021-12-19 23:24:17 +00:00
gui.appendText(cn + ":" + s)
2021-06-26 13:04:31 +00:00
}
2022-01-08 10:48:25 +00:00
} catch (Exception | StackOverflowError ignored) {
}
2021-06-26 13:04:31 +00:00
}
}
}
2021-12-19 23:24:17 +00:00
gui.setVisible(true)
2021-06-26 13:04:31 +00:00
}
}
2021-12-19 23:24:17 +00:00
}