Skip to content

Commit d12eca6

Browse files
committed
Example Java Plugin
1 parent a12f1aa commit d12eca6

1 file changed

Lines changed: 52 additions & 0 deletions

File tree

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
import the.bytecode.club.bytecodeviewer.api.*
2+
import the.bytecode.club.bytecodeviewer.gui.components.MultipleChoiceDialogue;
3+
4+
import java.util.ArrayList;
5+
import java.lang.reflect.Field;
6+
import org.objectweb.asm.tree.ClassNode;
7+
import org.objectweb.asm.tree.FieldNode
8+
9+
import static the.bytecode.club.bytecodeviewer.Constants.nl;
10+
11+
/**
12+
* This is an example of a string decrypter plugin
13+
*/
14+
public class ExampleStringDecrypter extends Plugin {
15+
16+
@Override
17+
public void execute(ArrayList<ClassNode> classNodesList) {
18+
PluginConsole gui = new PluginConsole("Example String Decrypter");
19+
20+
MultipleChoiceDialogue dialogue = new MultipleChoiceDialogue("Bytecode Viewer - WARNING",
21+
"WARNING: This will load the classes into the JVM and execute the initialize function"
22+
+ nl + "for each class. IF THE FILE YOU'RE LOADING IS MALICIOUS, DO NOT CONTINUE.",
23+
new String[]{"Continue", "Cancel"});
24+
25+
if(dialogue.promptChoice() == 0)
26+
{
27+
for(ClassNode cn : classNodesList)
28+
{
29+
the.bytecode.club.bytecodeviewer.api.BytecodeViewer.getClassNodeLoader().addClass(cn);
30+
31+
for(Object o : cn.fields.toArray())
32+
{
33+
FieldNode f = (FieldNode) o;
34+
if(f.name.equals("z")) {// && f.desc.equals("([Ljava/lang/String;)V")) {
35+
try
36+
{
37+
for(Field f2 : the.bytecode.club.bytecodeviewer.api.BytecodeViewer.getClassNodeLoader().nodeToClass(cn).getFields())
38+
{
39+
String s = f2.get(null);
40+
if(s != null && !s.empty())
41+
gui.appendText(cn+":"+s);
42+
}
43+
} catch(Exception | StackOverflowError e) {}
44+
}
45+
}
46+
47+
}
48+
49+
gui.setVisible(true);
50+
}
51+
}
52+
}

0 commit comments

Comments
 (0)