2021-06-27 21:41:58 +00:00
|
|
|
import the.bytecode.club.bytecodeviewer.api.*
|
2021-07-21 15:20:38 +00:00
|
|
|
import the.bytecode.club.bytecodeviewer.gui.components.MultipleChoiceDialog;
|
2021-06-27 21:41:58 +00:00
|
|
|
|
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-07-21 15:20:38 +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.",
|
|
|
|
new String[]{"Continue", "Cancel"});
|
2021-06-26 13:04:31 +00:00
|
|
|
|
2021-07-21 15:20:38 +00:00
|
|
|
if(dialog.promptChoice() == 0)
|
2021-06-27 21:41:58 +00:00
|
|
|
{
|
|
|
|
for(ClassNode cn : classNodesList)
|
|
|
|
{
|
2021-07-07 04:36:11 +00:00
|
|
|
BCV.getClassNodeLoader().addClass(cn);
|
2021-06-26 13:04:31 +00:00
|
|
|
|
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
|
|
|
|
{
|
2021-07-07 04:36:11 +00:00
|
|
|
for(Field f2 : BCV.getClassNodeLoader().nodeToClass(cn).getFields())
|
2021-06-27 21:41:58 +00:00
|
|
|
{
|
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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|