|
1 | 1 | import java.lang.reflect.Field; |
2 | 2 | import java.util.List; |
| 3 | + |
3 | 4 | import org.objectweb.asm.tree.ClassNode; |
4 | 5 | import org.objectweb.asm.tree.FieldNode; |
| 6 | +import the.bytecode.club.bytecodeviewer.*; |
5 | 7 | import the.bytecode.club.bytecodeviewer.api.*; |
6 | 8 | import the.bytecode.club.bytecodeviewer.gui.components.MultipleChoiceDialog; |
7 | 9 |
|
8 | | -import static the.bytecode.club.bytecodeviewer.Constants.nl; |
| 10 | +import static the.bytecode.club.bytecodeviewer.Constants.NL; |
9 | 11 |
|
10 | 12 | /** |
11 | | - ** This is an example of a String Decrypter Java Plugin for BCV. |
12 | | - ** |
13 | | - ** @author [Your-Name-Goes-Here] |
| 13 | + * * This is an example of a String Decrypter Java Plugin for BCV. |
| 14 | + * * |
| 15 | + * * @author [Your-Name-Goes-Here] |
14 | 16 | **/ |
15 | 17 |
|
16 | | -public class ExampleStringDecrypter extends Plugin { |
| 18 | +public class ExampleStringDecrypter extends Plugin |
| 19 | +{ |
17 | 20 |
|
18 | 21 | @Override |
19 | | - public void execute(List<ClassNode> classNodesList) { |
| 22 | + public void execute(List<ClassNode> classNodesList) |
| 23 | + { |
20 | 24 | PluginConsole gui = new PluginConsole("Example String Decrypter Java Edition"); |
21 | 25 |
|
22 | | - MultipleChoiceDialog dialog = new MultipleChoiceDialog("Bytecode Viewer - WARNING", |
23 | | - "WARNING: This will load the classes into the JVM and execute the initialize function" |
24 | | - + nl + "for each class. IF THE FILE YOU'RE LOADING IS MALICIOUS, DO NOT CONTINUE.", |
25 | | - new String[]{"Continue", "Cancel"}); |
| 26 | + MultipleChoiceDialog dialog = new MultipleChoiceDialog("Bytecode Viewer - WARNING", "WARNING: This will load the classes into the JVM and execute the initialize function" + NL + |
| 27 | + "for each class. IF THE FILE YOU'RE LOADING IS MALICIOUS, DO NOT CONTINUE.", new String[]{"Continue", "Cancel"}); |
26 | 28 |
|
27 | | - if (dialog.promptChoice() == 0) { |
| 29 | + if (dialog.promptChoice() == 0) |
| 30 | + { |
28 | 31 | boolean needsWarning = false; |
29 | | - |
30 | | - for (ClassNode cn : classNodesList) { |
31 | | - try { |
| 32 | + |
| 33 | + for (ClassNode cn : classNodesList) |
| 34 | + { |
| 35 | + try |
| 36 | + { |
32 | 37 | //load the class node into the classloader |
33 | 38 | BCV.getClassNodeLoader().addClass(cn); |
34 | | - |
35 | | - for (Object o : cn.fields.toArray()) { |
| 39 | + |
| 40 | + for (Object o : cn.fields.toArray()) |
| 41 | + { |
36 | 42 | FieldNode f = (FieldNode) o; |
37 | | - |
| 43 | + |
38 | 44 | //if the class contains the field z, get the class object from the class node |
39 | 45 | //then print out the value of the fields inside the class |
40 | 46 | //if the strings get decrypted on init, this allows you to dump the current values |
41 | | - |
42 | | - if (f.name.equals("z")) { |
43 | | - try { |
44 | | - for (Field f2 : BCV.getClassNodeLoader().nodeToClass(cn).getFields()) { |
| 47 | + if (f.name.equals("z")) |
| 48 | + { |
| 49 | + try |
| 50 | + { |
| 51 | + for (Field f2 : BCV.getClassNodeLoader().nodeToClass(cn).getFields()) |
| 52 | + { |
45 | 53 | String s = (String) f2.get(null); |
46 | 54 | if (s != null && !s.isEmpty()) |
47 | 55 | gui.appendText(cn + ":" + s); |
48 | 56 | } |
49 | | - } catch (Exception ignored) { |
| 57 | + } |
| 58 | + catch (Exception ignored) |
| 59 | + { |
50 | 60 | } |
51 | 61 | } |
52 | 62 | } |
53 | | - } catch (Exception e) { |
| 63 | + } |
| 64 | + catch (Exception e) |
| 65 | + { |
54 | 66 | gui.appendText("Failed loading class " + cn.name); |
55 | 67 | e.printStackTrace(); |
56 | 68 | needsWarning = true; |
57 | 69 | } |
58 | 70 | } |
59 | | - |
60 | | - if (needsWarning) { |
61 | | - BytecodeViewer.showMessage("Some classes failed to decrypt, if you'd like to decrypt all of them\n" |
62 | | - + "makes sure you include ALL the libraries it requires."); |
| 71 | + |
| 72 | + if (needsWarning) |
| 73 | + { |
| 74 | + BytecodeViewer.showMessage("Some classes failed to decrypt, if you'd like to decrypt all of them" + NL + |
| 75 | + "makes sure you include ALL the libraries it requires."); |
63 | 76 | } |
64 | 77 |
|
65 | 78 | gui.setVisible(true); |
66 | 79 | } |
67 | 80 | } |
| 81 | + |
68 | 82 | } |
0 commit comments