bcv-vf/plugins/example/ExampleStringDecrypter.gy

52 lines
2 KiB
Text
Raw Normal View History

2021-06-27 21:41:58 +00:00
import the.bytecode.club.bytecodeviewer.api.*
import the.bytecode.club.bytecodeviewer.gui.components.MultipleChoiceDialogue;
2021-06-26 13:04:31 +00:00
import java.util.ArrayList;
import java.lang.reflect.Field;
2021-06-27 21:41:58 +00:00
import org.objectweb.asm.tree.ClassNode;
import org.objectweb.asm.tree.FieldNode
import static the.bytecode.club.bytecodeviewer.Constants.nl;
2021-06-26 13:04:31 +00:00
/**
* This is an example of a string decrypter plugin
*/
public class ExampleStringDecrypter extends Plugin {
@Override
public void execute(ArrayList<ClassNode> classNodesList) {
PluginConsole gui = new PluginConsole("Example String Decrypter");
2021-06-27 21:41:58 +00:00
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.",
new String[]{"Continue", "Cancel"});
2021-06-26 13:04:31 +00:00
2021-06-27 21:41:58 +00:00
if(dialogue.promptChoice() == 0)
{
for(ClassNode cn : classNodesList)
{
2021-06-26 13:04:31 +00:00
the.bytecode.club.bytecodeviewer.api.BytecodeViewer.getClassNodeLoader().addClass(cn);
2021-06-27 21:41:58 +00:00
for(Object o : cn.fields.toArray())
{
2021-06-26 13:04:31 +00:00
FieldNode f = (FieldNode) o;
if(f.name.equals("z")) {// && f.desc.equals("([Ljava/lang/String;)V")) {
2021-06-27 21:41:58 +00:00
try
{
for(Field f2 : the.bytecode.club.bytecodeviewer.api.BytecodeViewer.getClassNodeLoader().nodeToClass(cn).getFields())
{
2021-06-26 13:04:31 +00:00
String s = f2.get(null);
if(s != null && !s.empty())
gui.appendText(cn+":"+s);
}
} catch(Exception | StackOverflowError e) {}
}
}
}
gui.setVisible(true);
}
}
}