2022-01-22 19:20:53 +00:00
|
|
|
|
2021-06-27 23:27:16 +00:00
|
|
|
/**
|
2022-01-22 19:20:53 +00:00
|
|
|
** This is an example of a String Decrypter Javascript Plugin for BCV.
|
|
|
|
**
|
2022-01-22 19:38:40 +00:00
|
|
|
** @author [Your-Name-Goes-Here]
|
2022-01-22 19:20:53 +00:00
|
|
|
**/
|
2021-06-27 23:27:16 +00:00
|
|
|
|
|
|
|
var PluginConsole = Java.type("the.bytecode.club.bytecodeviewer.api.PluginConsole");
|
2021-07-21 15:20:38 +00:00
|
|
|
var MultipleChoiceDialog = Java.type("the.bytecode.club.bytecodeviewer.gui.components.MultipleChoiceDialog")
|
2021-07-07 04:36:11 +00:00
|
|
|
var BytecodeViewer = Java.type("the.bytecode.club.bytecodeviewer.api.BCV")
|
2021-06-27 23:27:16 +00:00
|
|
|
|
2021-07-21 15:20:38 +00:00
|
|
|
var dialog = new MultipleChoiceDialog("Bytecode Viewer - WARNING",
|
2022-01-08 10:48:25 +00:00
|
|
|
"WARNING: This will load the classes into the JVM and execute the initialize function"
|
|
|
|
+ "\nfor each class. IF THE FILE YOU'RE LOADING IS MALICIOUS, DO NOT CONTINUE.",
|
|
|
|
["Continue", "Cancel"]);
|
2021-07-21 13:22:22 +00:00
|
|
|
var gui;
|
2021-06-27 23:27:16 +00:00
|
|
|
|
2022-01-08 10:48:25 +00:00
|
|
|
function execute(classNodeList) {
|
2022-01-18 01:35:18 +00:00
|
|
|
gui = new PluginConsole("Example String Decrypter Javascript Edition");
|
2021-07-21 13:22:22 +00:00
|
|
|
|
2022-01-08 10:48:25 +00:00
|
|
|
if (dialog.promptChoice() == 0) {
|
2021-06-27 23:27:16 +00:00
|
|
|
var needsWarning = false;
|
|
|
|
|
2022-01-08 10:48:25 +00:00
|
|
|
for (cnIndex = 0; cnIndex < classNodeList.length; cnIndex++) {
|
|
|
|
try {
|
2021-06-27 23:27:16 +00:00
|
|
|
var cn = classNodeList[cnIndex];
|
|
|
|
|
|
|
|
//load the class node into the classloader
|
2022-01-08 10:48:25 +00:00
|
|
|
BytecodeViewer.getClassNodeLoader().addClass(cn);
|
2021-06-27 23:27:16 +00:00
|
|
|
|
2022-01-08 10:48:25 +00:00
|
|
|
var fields = cn.fields.toArray();
|
|
|
|
for (fieldIndex = 0; fieldIndex < fields.length; fieldIndex++) {
|
2021-06-27 23:27:16 +00:00
|
|
|
var field = fields[fieldIndex];
|
|
|
|
|
|
|
|
//if the class contains the field z, get the class object from the class node
|
|
|
|
//then print out the value of the fields inside the class
|
|
|
|
//if the strings get decrypted on init, this allows you to dump the current values
|
|
|
|
|
2022-01-22 18:59:22 +00:00
|
|
|
if (field.name.equals("z")) {
|
2022-01-08 10:48:25 +00:00
|
|
|
try {
|
2021-06-27 23:27:16 +00:00
|
|
|
var loadedClass = BytecodeViewer.getClassNodeLoader().nodeToClass(cn);
|
|
|
|
var reflectedFields = loadedClass.getFields();
|
|
|
|
|
2022-01-08 10:48:25 +00:00
|
|
|
for (reflectedFieldIndex = 0; reflectedFieldIndex < reflectedFields.length; reflectedFieldIndex++) {
|
2021-06-27 23:27:16 +00:00
|
|
|
var reflectedField = reflectedFields[fieldIndex];
|
|
|
|
var s = reflectedField.get(null);
|
|
|
|
|
2022-01-08 10:48:25 +00:00
|
|
|
if (s != null && !s.empty())
|
2021-06-27 23:27:16 +00:00
|
|
|
gui.appendText(cn + "->" + s);
|
|
|
|
}
|
2022-01-22 19:06:25 +00:00
|
|
|
} catch (ignored) {
|
2022-01-08 10:48:25 +00:00
|
|
|
}
|
2021-06-27 23:27:16 +00:00
|
|
|
}
|
|
|
|
}
|
2022-01-08 10:48:25 +00:00
|
|
|
} catch (e) {
|
|
|
|
gui.appendText("Failed loading class " + cn.name);
|
2021-06-27 23:27:16 +00:00
|
|
|
e.printStackTrace();
|
|
|
|
needsWarning = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-01-08 10:48:25 +00:00
|
|
|
if (needsWarning) {
|
|
|
|
BytecodeViewer.showMessage("Some classes failed to decrypt, if you'd like to decrypt all of them\n"
|
|
|
|
+ "makes sure you include ALL the libraries it requires.");
|
2021-06-27 23:27:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
gui.setVisible(true);
|
|
|
|
}
|
2022-01-08 10:48:25 +00:00
|
|
|
}
|