Plugin Code Cleanup
This commit is contained in:
parent
6031154319
commit
a12f1aa503
2 changed files with 49 additions and 48 deletions
|
@ -1,10 +1,12 @@
|
|||
import the.bytecode.club.bytecodeviewer.api.*;
|
||||
import the.bytecode.club.bytecodeviewer.api.*
|
||||
import the.bytecode.club.bytecodeviewer.gui.components.MultipleChoiceDialogue;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
import javax.swing.JDialog;
|
||||
import javax.swing.JOptionPane;
|
||||
import java.lang.reflect.Field;
|
||||
import org.objectweb.asm.tree.FieldNode;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
import org.objectweb.asm.tree.FieldNode
|
||||
|
||||
import static the.bytecode.club.bytecodeviewer.Constants.nl;
|
||||
|
||||
/**
|
||||
* This is an example of a string decrypter plugin
|
||||
|
@ -15,27 +17,25 @@ public class ExampleStringDecrypter extends Plugin {
|
|||
public void execute(ArrayList<ClassNode> classNodesList) {
|
||||
PluginConsole gui = new PluginConsole("Example String Decrypter");
|
||||
|
||||
JOptionPane pane = new JOptionPane("WARNING: This method of decryption loads the classes into a classloader and executes the init function, this could lead to malicious code executing.\n\r\n\rAre you sure you want to run this plugin?");
|
||||
String[] options = ["Yes", "No"];
|
||||
pane.setOptions(options);
|
||||
JDialog dialog = pane.createDialog(the.bytecode.club.bytecodeviewer.BytecodeViewer.viewer, "WARNING");
|
||||
dialog.show();
|
||||
Object obj = pane.getValue();
|
||||
int result = -1;
|
||||
for (int k = 0; k < options.length; k++)
|
||||
if (options[k].equals(obj))
|
||||
result = k;
|
||||
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"});
|
||||
|
||||
|
||||
if(result == 0) {
|
||||
for(ClassNode cn : classNodesList) {
|
||||
if(dialogue.promptChoice() == 0)
|
||||
{
|
||||
for(ClassNode cn : classNodesList)
|
||||
{
|
||||
the.bytecode.club.bytecodeviewer.api.BytecodeViewer.getClassNodeLoader().addClass(cn);
|
||||
|
||||
for(Object o : cn.fields.toArray()) {
|
||||
for(Object o : cn.fields.toArray())
|
||||
{
|
||||
FieldNode f = (FieldNode) o;
|
||||
if(f.name.equals("z")) {// && f.desc.equals("([Ljava/lang/String;)V")) {
|
||||
try {
|
||||
for(Field f2 : the.bytecode.club.bytecodeviewer.api.BytecodeViewer.getClassNodeLoader().nodeToClass(cn).getFields()) {
|
||||
try
|
||||
{
|
||||
for(Field f2 : the.bytecode.club.bytecodeviewer.api.BytecodeViewer.getClassNodeLoader().nodeToClass(cn).getFields())
|
||||
{
|
||||
String s = f2.get(null);
|
||||
if(s != null && !s.empty())
|
||||
gui.appendText(cn+":"+s);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue