use of the.bytecode.club.bytecodeviewer.api.ExceptionUI in project bytecode-viewer by Konloch.
the class ZStringArrayDecrypter method execute.
@Override
public void execute(ArrayList<ClassNode> classNodeList) {
JOptionPane pane = new JOptionPane("WARNING: This will load the classes into the JVM and execute the initialize function" + BytecodeViewer.nl + "for each class. IF THE FILE YOU'RE LOADING IS MALICIOUS, DO NOT CONTINUE.");
Object[] options = new String[] { "Continue", "Cancel" };
pane.setOptions(options);
JDialog dialog = pane.createDialog(BytecodeViewer.viewer, "Bytecode Viewer - WARNING");
dialog.setVisible(true);
Object obj = pane.getValue();
int result = -1;
for (int k = 0; k < options.length; k++) if (options[k].equals(obj))
result = k;
if (result == 0) {
boolean needsWarning = false;
try {
for (Class<?> debug : the.bytecode.club.bytecodeviewer.api.BytecodeViewer.loadAllClassesIntoClassLoader()) {
try {
Field[] fields = debug.getDeclaredFields();
for (Field field : fields) {
if (field.getName().equals("z")) {
out.append(debug.getName() + ":" + BytecodeViewer.nl);
field.setAccessible(true);
if (field.get(null) != null && field.get(null) instanceof String[] && Modifier.isStatic(field.getModifiers()) && Modifier.isFinal(field.getModifiers())) {
String[] fieldVal = (String[]) field.get(null);
for (int i = 0; i < fieldVal.length; i++) {
out.append(" z[" + i + "] = " + fieldVal[i] + BytecodeViewer.nl);
}
}
}
}
} catch (NoClassDefFoundError | Exception e) {
System.err.println("Failed loading class " + debug.getName());
e.printStackTrace();
needsWarning = true;
}
}
} catch (Exception e) {
new ExceptionUI(e);
}
if (needsWarning) {
BytecodeViewer.showMessage("Some classes failed to decrypt, if you'd like to decrypt all of them" + BytecodeViewer.nl + "makes sure you include ALL the libraries it requires.");
}
gui.setText(out.toString());
gui.setVisible(true);
}
}
use of the.bytecode.club.bytecodeviewer.api.ExceptionUI in project bytecode-viewer by Konloch.
the class CommandLineInput method parseCommandLine.
public int parseCommandLine() {
if (!containsCommand()) {
return OPEN_FILE;
}
try {
if (parsed.hasOption("list")) {
System.out.println("Procyon");
System.out.println("CFR");
System.out.println("FernFlower");
System.out.println("Krakatau");
System.out.println("Krakatau-Bytecode");
System.out.println("JD-GUI");
System.out.println("Smali");
return STOP;
} else if (parsed.hasOption("help")) {
for (String s : new String[] { "-help Displays the help menu", "-list Displays the available decompilers", "-decompiler <decompiler> Selects the decompiler, procyon by default", "-i <input file> Selects the input file", "-o <output file> Selects the output file", "-t <target classname> Must either be the fully qualified classname or \"all\" to decompile all as zip", "-nowait Doesn't wait for the user to read the CLI messages" }) System.out.println(s);
return STOP;
} else {
if (parsed.getOptionValue("i") == null) {
System.err.println("Set the input with -i");
return STOP;
}
if (parsed.getOptionValue("o") == null) {
System.err.println("Set the output with -o");
return STOP;
}
if (parsed.getOptionValue("t") == null) {
System.err.println("Set the target with -t");
return STOP;
}
File input = new File(parsed.getOptionValue("i"));
File output = new File(parsed.getOptionValue("o"));
String decompiler = parsed.getOptionValue("decompiler");
if (!input.exists()) {
System.err.println(input.getAbsolutePath() + " does not exist.");
return STOP;
}
if (output.exists()) {
System.err.println("WARNING: Deleted old " + output.getAbsolutePath() + ".");
output.delete();
}
if (decompiler != null && !decompiler.equalsIgnoreCase("procyon") && !decompiler.equalsIgnoreCase("cfr") && !decompiler.equalsIgnoreCase("fernflower") && !decompiler.equalsIgnoreCase("krakatau") && !decompiler.equalsIgnoreCase("krakatau-bytecode") && !decompiler.equalsIgnoreCase("jd-gui") && !decompiler.equalsIgnoreCase("smali")) {
System.out.println("Error, no decompiler called '" + decompiler + "' found. Type -decompiler-list for the list");
}
if (!parsed.hasOption("nowait"))
Thread.sleep(5 * 1000);
return CLI;
}
} catch (Exception e) {
new ExceptionUI(e);
}
return OPEN_FILE;
}
Aggregations