Code Cleanup

This commit is contained in:
Konloch 2022-01-22 13:02:24 -06:00
parent c51c4f0b81
commit af6274fb4b
1 changed files with 19 additions and 3 deletions

View File

@ -22,23 +22,39 @@ public class ExampleStringDecrypter extends Plugin {
new String[]{"Continue", "Cancel"}); new String[]{"Continue", "Cancel"});
if (dialog.promptChoice() == 0) { if (dialog.promptChoice() == 0) {
boolean needsWarning = false;
for (ClassNode cn : classNodesList) { for (ClassNode cn : classNodesList) {
//load the class node into the classloader
BCV.getClassNodeLoader().addClass(cn); BCV.getClassNodeLoader().addClass(cn);
for (Object o : cn.fields.toArray()) { for (Object o : cn.fields.toArray()) {
FieldNode f = (FieldNode) o; FieldNode f = (FieldNode) o;
if (f.name.equals("z")) {// && f.desc.equals("([Ljava/lang/String;)V")) {
//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
if (f.name.equals("z")) {
try { try {
for (Field f2 : BCV.getClassNodeLoader().nodeToClass(cn).getFields()) { for (Field f2 : BCV.getClassNodeLoader().nodeToClass(cn).getFields()) {
String s = (String) f2.get(null); String s = (String) f2.get(null);
if (s != null && !s.isEmpty()) if (s != null && !s.isEmpty())
gui.appendText(cn + ":" + s); gui.appendText(cn + ":" + s);
} }
} catch (Exception ignored) { } catch (Exception e) {
gui.appendText("Failed loading class " + cn.name);
e.printStackTrace();
needsWarning = true;
}
} }
} }
} }
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.");
} }
gui.setVisible(true); gui.setVisible(true);