bug fixes for v2.9.16
This commit is contained in:
parent
93f38a27d0
commit
e092c3bba8
|
@ -885,23 +885,28 @@ public class BytecodeViewer
|
|||
} else if (fn.endsWith(".apk")) {
|
||||
try {
|
||||
BytecodeViewer.viewer.setIcon(true);
|
||||
FileContainer container = new FileContainer(f);
|
||||
|
||||
File tempCopy = new File(tempDirectory+fs+MiscUtils.randomString(32)+".apk");
|
||||
|
||||
FileUtils.copyFile(f, tempCopy);
|
||||
|
||||
FileContainer container = new FileContainer(tempCopy, f.getName());
|
||||
|
||||
if (viewer.decodeAPKResources.isSelected()) {
|
||||
File decodedResources = new File(tempDirectory + fs + MiscUtils.randomString(32) + ".apk");
|
||||
APKTool.decodeResources(f, decodedResources);
|
||||
APKTool.decodeResources(tempCopy, decodedResources);
|
||||
container.files = JarUtils.loadResources(decodedResources);
|
||||
}
|
||||
|
||||
container.files.putAll(JarUtils.loadResources(f));
|
||||
container.files.putAll(JarUtils.loadResources(tempCopy)); //copy and rename to prevent unicode filenames
|
||||
|
||||
String name = getRandomizedName() + ".jar";
|
||||
File output = new File(tempDirectory + fs + name);
|
||||
|
||||
if (BytecodeViewer.viewer.apkConversionGroup.isSelected(BytecodeViewer.viewer.apkConversionDex.getModel()))
|
||||
Dex2Jar.dex2Jar(f, output);
|
||||
Dex2Jar.dex2Jar(tempCopy, output);
|
||||
else if (BytecodeViewer.viewer.apkConversionGroup.isSelected(BytecodeViewer.viewer.apkConversionEnjarify.getModel()))
|
||||
Enjarify.apk2Jar(f, output);
|
||||
Enjarify.apk2Jar(tempCopy, output);
|
||||
|
||||
container.classes = JarUtils.loadClasses(output);
|
||||
|
||||
|
@ -914,15 +919,20 @@ public class BytecodeViewer
|
|||
} else if (fn.endsWith(".dex")) {
|
||||
try {
|
||||
BytecodeViewer.viewer.setIcon(true);
|
||||
FileContainer container = new FileContainer(f);
|
||||
|
||||
File tempCopy = new File(tempDirectory+fs+MiscUtils.randomString(32)+".dex");
|
||||
|
||||
FileUtils.copyFile(f, tempCopy); //copy and rename to prevent unicode filenames
|
||||
|
||||
FileContainer container = new FileContainer(tempCopy, f.getName());
|
||||
|
||||
String name = getRandomizedName() + ".jar";
|
||||
File output = new File(tempDirectory + fs + name);
|
||||
|
||||
if (BytecodeViewer.viewer.apkConversionGroup.isSelected(BytecodeViewer.viewer.apkConversionDex.getModel()))
|
||||
Dex2Jar.dex2Jar(f, output);
|
||||
Dex2Jar.dex2Jar(tempCopy, output);
|
||||
else if (BytecodeViewer.viewer.apkConversionGroup.isSelected(BytecodeViewer.viewer.apkConversionEnjarify.getModel()))
|
||||
Enjarify.apk2Jar(f, output);
|
||||
Enjarify.apk2Jar(tempCopy, output);
|
||||
|
||||
container.classes = JarUtils.loadClasses(output);
|
||||
|
||||
|
|
|
@ -182,6 +182,12 @@ public class CommandLineInput {
|
|||
//if its zip/jar/apk/dex attempt unzip as whole zip
|
||||
//if its just class allow any
|
||||
|
||||
File tempZip = new File(BytecodeViewer.tempDirectory + BytecodeViewer.fs + "temp_"+BytecodeViewer.getRandomizedName()+".jar");
|
||||
if (tempZip.exists())
|
||||
tempZip.delete();
|
||||
|
||||
JarUtils.saveAsJarClassesOnly(BytecodeViewer.getLoadedClasses(), tempZip.getAbsolutePath());
|
||||
|
||||
if (decompiler.equalsIgnoreCase("procyon")) {
|
||||
System.out.println("Decompiling " + input.getAbsolutePath() + " with Procyon");
|
||||
BytecodeViewer.openFiles(new File[]{input}, false);
|
||||
|
@ -189,7 +195,7 @@ public class CommandLineInput {
|
|||
Thread.sleep(5 * 1000);
|
||||
|
||||
if (target.equalsIgnoreCase("all")) {
|
||||
Decompiler.procyon.decompileToZip(output.getAbsolutePath());
|
||||
Decompiler.procyon.decompileToZip(tempZip.getAbsolutePath(), output.getAbsolutePath());
|
||||
} else {
|
||||
try {
|
||||
ClassNode cn = BytecodeViewer.getClassNode(target);
|
||||
|
@ -207,7 +213,7 @@ public class CommandLineInput {
|
|||
Thread.sleep(5 * 1000);
|
||||
|
||||
if (target.equalsIgnoreCase("all")) {
|
||||
Decompiler.cfr.decompileToZip(output.getAbsolutePath());
|
||||
Decompiler.cfr.decompileToZip(tempZip.getAbsolutePath(), output.getAbsolutePath());
|
||||
} else {
|
||||
try {
|
||||
ClassNode cn = BytecodeViewer.getClassNode(target);
|
||||
|
@ -225,7 +231,7 @@ public class CommandLineInput {
|
|||
Thread.sleep(5 * 1000);
|
||||
|
||||
if (target.equalsIgnoreCase("all")) {
|
||||
Decompiler.fernflower.decompileToZip(output.getAbsolutePath());
|
||||
Decompiler.fernflower.decompileToZip(tempZip.getAbsolutePath(), output.getAbsolutePath());
|
||||
} else {
|
||||
try {
|
||||
ClassNode cn = BytecodeViewer.getClassNode(target);
|
||||
|
@ -243,7 +249,7 @@ public class CommandLineInput {
|
|||
Thread.sleep(5 * 1000);
|
||||
|
||||
if (target.equalsIgnoreCase("all")) {
|
||||
Decompiler.krakatau.decompileToZip(output.getAbsolutePath());
|
||||
Decompiler.krakatau.decompileToZip(tempZip.getAbsolutePath(), output.getAbsolutePath());
|
||||
} else {
|
||||
try {
|
||||
ClassNode cn = BytecodeViewer.getClassNode(target);
|
||||
|
|
|
@ -37,6 +37,11 @@ public class FileContainer {
|
|||
this.name = f.getName();
|
||||
}
|
||||
|
||||
public FileContainer(File f, String name) {
|
||||
this.file = f;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public File file;
|
||||
public String name;
|
||||
|
||||
|
|
|
@ -216,6 +216,7 @@ public class Settings {
|
|||
DiskWriter.writeNewLine(BytecodeViewer.settingsName, BytecodeViewer.java, false);
|
||||
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.autoCompileSmali.isSelected()), false);
|
||||
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.viewer.autoCompileOnRefresh.isSelected()), false);
|
||||
DiskWriter.writeNewLine(BytecodeViewer.settingsName, String.valueOf(BytecodeViewer.warnForEditing), false);
|
||||
} catch (Exception e) {
|
||||
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e);
|
||||
}
|
||||
|
@ -376,6 +377,8 @@ public class Settings {
|
|||
BytecodeViewer.viewer.setExtendedState(JFrame.MAXIMIZED_BOTH);
|
||||
BytecodeViewer.viewer.isMaximized = true;
|
||||
}
|
||||
//86 is deprecated
|
||||
//87 is deprecated
|
||||
BytecodeViewer.lastDirectory = DiskReader.loadString(BytecodeViewer.settingsName, 88, false);
|
||||
BytecodeViewer.python = DiskReader.loadString(BytecodeViewer.settingsName, 89, false);
|
||||
BytecodeViewer.rt = DiskReader.loadString(BytecodeViewer.settingsName, 90, false);
|
||||
|
@ -412,6 +415,7 @@ public class Settings {
|
|||
BytecodeViewer.java = DiskReader.loadString(BytecodeViewer.settingsName, 117, false);
|
||||
BytecodeViewer.viewer.autoCompileSmali.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 118, false)));
|
||||
BytecodeViewer.viewer.autoCompileOnRefresh.setSelected(Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 119, false)));
|
||||
BytecodeViewer.warnForEditing = (Boolean.parseBoolean(DiskReader.loadString(BytecodeViewer.settingsName, 119, false)));
|
||||
} catch (Exception e) {
|
||||
//ignore because errors are expected, first start up and outdated settings.
|
||||
//e.printStackTrace();
|
||||
|
|
|
@ -247,23 +247,15 @@ public class CFRDecompiler extends Decompiler {
|
|||
byte[] buffer = new byte[1024];
|
||||
|
||||
@Override
|
||||
public void decompileToZip(String zipName) {
|
||||
File tempZip = new File(BytecodeViewer.tempDirectory
|
||||
+ BytecodeViewer.fs + "temp.jar");
|
||||
if (tempZip.exists())
|
||||
tempZip.delete();
|
||||
|
||||
JarUtils.saveAsJar(BytecodeViewer.getLoadedClasses(),
|
||||
tempZip.getAbsolutePath());
|
||||
public void decompileToZip(String sourceJar, String zipName)
|
||||
{
|
||||
File tempZip = new File(sourceJar);
|
||||
|
||||
String fileStart = BytecodeViewer.tempDirectory + BytecodeViewer.fs;
|
||||
|
||||
String fuckery = fuckery(fileStart);
|
||||
|
||||
org.benf.cfr.reader.Main.main(generateMainMethod(
|
||||
tempZip.getAbsolutePath(), fuckery));
|
||||
org.benf.cfr.reader.Main.main(generateMainMethod(tempZip.getAbsolutePath(), fuckery));
|
||||
|
||||
tempZip.delete();
|
||||
File fuck = new File(fuckery);
|
||||
|
||||
try {
|
||||
|
|
|
@ -41,5 +41,5 @@ public abstract class Decompiler {
|
|||
|
||||
public abstract String decompileClassNode(ClassNode cn, byte[] b);
|
||||
|
||||
public abstract void decompileToZip(String zipName);
|
||||
public abstract void decompileToZip(String sourceJar, String zipName);
|
||||
}
|
||||
|
|
|
@ -44,29 +44,19 @@ import the.bytecode.club.bytecodeviewer.Resources;
|
|||
public class FernFlowerDecompiler extends Decompiler {
|
||||
|
||||
@Override
|
||||
public void decompileToZip(String zipName) {
|
||||
File tempZip = new File(BytecodeViewer.tempDirectory + "temp.zip");
|
||||
if (tempZip.exists())
|
||||
tempZip.delete();
|
||||
public void decompileToZip(String sourceJar, String zipName) {
|
||||
File tempZip = new File(sourceJar);
|
||||
|
||||
File f = new File(BytecodeViewer.tempDirectory + BytecodeViewer.fs
|
||||
+ "temp" + BytecodeViewer.fs);
|
||||
File f = new File(BytecodeViewer.tempDirectory + BytecodeViewer.fs + "temp" + BytecodeViewer.fs);
|
||||
f.mkdir();
|
||||
|
||||
JarUtils.saveAsJar(BytecodeViewer.getLoadedClasses(),
|
||||
tempZip.getAbsolutePath());
|
||||
|
||||
org.jetbrains.java.decompiler.main.decompiler.ConsoleDecompiler.main(generateMainMethod(tempZip.getAbsolutePath(), BytecodeViewer.tempDirectory + "./temp/"));
|
||||
|
||||
File tempZip2 = new File(BytecodeViewer.tempDirectory
|
||||
+ BytecodeViewer.fs + "temp" + BytecodeViewer.fs
|
||||
+ tempZip.getName());
|
||||
File tempZip2 = new File(BytecodeViewer.tempDirectory + BytecodeViewer.fs + "temp" + BytecodeViewer.fs + tempZip.getName());
|
||||
if (tempZip2.exists())
|
||||
tempZip2.renameTo(new File(zipName));
|
||||
|
||||
tempZip.delete();
|
||||
new File(BytecodeViewer.tempDirectory + BytecodeViewer.fs + "temp")
|
||||
.delete();
|
||||
f.delete();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -121,8 +111,6 @@ public class FernFlowerDecompiler extends Decompiler {
|
|||
|
||||
tempClass.delete();
|
||||
|
||||
System.out.println(start + ".java");
|
||||
|
||||
final File outputJava = new File(start + ".java");
|
||||
if (outputJava.exists()) {
|
||||
String s;
|
||||
|
|
|
@ -118,6 +118,6 @@ public class JDGUIDecompiler extends Decompiler {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void decompileToZip(String zipName) {
|
||||
public void decompileToZip(String sourceJar, String zipName) {
|
||||
}
|
||||
}
|
|
@ -130,7 +130,7 @@ public class KrakatauDecompiler extends Decompiler {
|
|||
return s;
|
||||
}
|
||||
|
||||
public void decompileToZip(String zipName) {
|
||||
public void decompileToZip(String sourceJar, String zipName) {
|
||||
if (BytecodeViewer.python.equals("")) {
|
||||
BytecodeViewer.showMessage("You need to set your Python (or PyPy for speed) 2.7 executable path.");
|
||||
BytecodeViewer.viewer.pythonC();
|
||||
|
@ -144,10 +144,12 @@ public class KrakatauDecompiler extends Decompiler {
|
|||
String ran = MiscUtils.randomString(32);
|
||||
final File tempDirectory = new File(BytecodeViewer.tempDirectory + BytecodeViewer.fs + ran + BytecodeViewer.fs);
|
||||
tempDirectory.mkdir();
|
||||
final File tempJar = new File(BytecodeViewer.tempDirectory + BytecodeViewer.fs + "temp.jar");
|
||||
JarUtils.saveAsJarClassesOnly(BytecodeViewer.getLoadedClasses(), tempJar.getAbsolutePath());
|
||||
|
||||
|
||||
final File tempJar = new File(sourceJar);
|
||||
|
||||
BytecodeViewer.sm.stopBlocking();
|
||||
|
||||
try {
|
||||
ProcessBuilder pb = new ProcessBuilder(
|
||||
BytecodeViewer.python,
|
||||
|
@ -167,11 +169,7 @@ public class KrakatauDecompiler extends Decompiler {
|
|||
process.waitFor();
|
||||
MiscUtils.printProcess(process);
|
||||
|
||||
// ZipUtils.zipDirectory(tempDirectory, new File(zipName));
|
||||
ZipUtils.zipFolder(tempDirectory.getAbsolutePath(), zipName, ran);
|
||||
|
||||
//tempDirectory.delete();
|
||||
tempJar.delete();
|
||||
} catch (Exception e) {
|
||||
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e);
|
||||
} finally {
|
||||
|
|
|
@ -109,7 +109,7 @@ public class KrakatauDisassembler extends Decompiler {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void decompileToZip(String zipName) {
|
||||
public void decompileToZip(String sourceJar, String zipName) {
|
||||
if (BytecodeViewer.python.equals("")) {
|
||||
BytecodeViewer.showMessage("You need to set your Python (or PyPy for speed) 2.7 executable path.");
|
||||
BytecodeViewer.viewer.pythonC();
|
||||
|
@ -118,8 +118,8 @@ public class KrakatauDisassembler extends Decompiler {
|
|||
String ran = MiscUtils.randomString(32);
|
||||
final File tempDirectory = new File(BytecodeViewer.tempDirectory + BytecodeViewer.fs + ran + BytecodeViewer.fs);
|
||||
tempDirectory.mkdir();
|
||||
final File tempJar = new File(BytecodeViewer.tempDirectory + BytecodeViewer.fs + "temp.jar");
|
||||
JarUtils.saveAsJarClassesOnly(BytecodeViewer.getLoadedClasses(), tempJar.getAbsolutePath());
|
||||
|
||||
final File tempJar = new File(sourceJar);
|
||||
|
||||
BytecodeViewer.sm.stopBlocking();
|
||||
try {
|
||||
|
@ -138,11 +138,7 @@ public class KrakatauDisassembler extends Decompiler {
|
|||
BytecodeViewer.createdProcesses.add(process);
|
||||
process.waitFor();
|
||||
|
||||
// ZipUtils.zipDirectory(tempDirectory, new File(zipName));
|
||||
ZipUtils.zipFolder(tempDirectory.getAbsolutePath(), zipName, ran);
|
||||
|
||||
//tempDirectory.delete();
|
||||
tempJar.delete();
|
||||
} catch (Exception e) {
|
||||
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e);
|
||||
} finally {
|
||||
|
|
|
@ -150,17 +150,9 @@ public class ProcyonDecompiler extends Decompiler {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void decompileToZip(String zipName) {
|
||||
File tempZip = new File(BytecodeViewer.tempDirectory
|
||||
+ BytecodeViewer.fs + "temp.jar");
|
||||
if (tempZip.exists())
|
||||
tempZip.delete();
|
||||
|
||||
JarUtils.saveAsJar(BytecodeViewer.getLoadedClasses(),
|
||||
tempZip.getAbsolutePath());
|
||||
|
||||
public void decompileToZip(String sourceJar, String zipName) {
|
||||
try {
|
||||
doSaveJarDecompiled(tempZip, new File(zipName));
|
||||
doSaveJarDecompiled(new File(sourceJar), new File(zipName));
|
||||
} catch (Exception e) {
|
||||
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e);
|
||||
}
|
||||
|
|
|
@ -94,7 +94,7 @@ public class SmaliDisassembler extends Decompiler {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void decompileToZip(String zipName) {
|
||||
public void decompileToZip(String sourceJar, String zipName) {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -182,6 +182,6 @@ public class ClassNodeDecompiler extends Decompiler {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void decompileToZip(String zipName) {
|
||||
public void decompileToZip(String sourceJar, String zipName) {
|
||||
}
|
||||
}
|
|
@ -13,23 +13,7 @@ import java.util.Map;
|
|||
|
||||
import org.apache.commons.lang3.StringEscapeUtils;
|
||||
import org.objectweb.asm.Type;
|
||||
import org.objectweb.asm.tree.AbstractInsnNode;
|
||||
import org.objectweb.asm.tree.FieldInsnNode;
|
||||
import org.objectweb.asm.tree.FrameNode;
|
||||
import org.objectweb.asm.tree.IincInsnNode;
|
||||
import org.objectweb.asm.tree.InsnNode;
|
||||
import org.objectweb.asm.tree.IntInsnNode;
|
||||
import org.objectweb.asm.tree.InvokeDynamicInsnNode;
|
||||
import org.objectweb.asm.tree.JumpInsnNode;
|
||||
import org.objectweb.asm.tree.LabelNode;
|
||||
import org.objectweb.asm.tree.LdcInsnNode;
|
||||
import org.objectweb.asm.tree.LineNumberNode;
|
||||
import org.objectweb.asm.tree.LookupSwitchInsnNode;
|
||||
import org.objectweb.asm.tree.MethodInsnNode;
|
||||
import org.objectweb.asm.tree.MethodNode;
|
||||
import org.objectweb.asm.tree.TableSwitchInsnNode;
|
||||
import org.objectweb.asm.tree.TypeInsnNode;
|
||||
import org.objectweb.asm.tree.VarInsnNode;
|
||||
import org.objectweb.asm.tree.*;
|
||||
|
||||
import org.objectweb.asm.tree.analysis.Frame;
|
||||
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
|
||||
|
@ -150,6 +134,8 @@ public class InstructionPrinter {
|
|||
line = printLookupSwitchInsnNode((LookupSwitchInsnNode) ain);
|
||||
} else if (ain instanceof InvokeDynamicInsnNode) {
|
||||
line = printInvokeDynamicInsNode((InvokeDynamicInsnNode) ain);
|
||||
} else if (ain instanceof MultiANewArrayInsnNode) {
|
||||
line = printMultiANewArrayInsNode((MultiANewArrayInsnNode) ain);
|
||||
} else {
|
||||
line += "UNADDED OPCODE: " + nameOpcode(ain.getOpcode()) + " "
|
||||
+ ain.toString();
|
||||
|
@ -317,6 +303,14 @@ public class InstructionPrinter {
|
|||
return sb.toString();
|
||||
}
|
||||
|
||||
protected String printMultiANewArrayInsNode(MultiANewArrayInsnNode mana)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(nameOpcode(mana.getOpcode()) + " " + mana.dims + " : " + mana.desc);
|
||||
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
private String printFrameNode(FrameNode frame) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(nameOpcode(frame.getOpcode()) + " ");
|
||||
|
|
|
@ -296,7 +296,7 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier {
|
|||
"Replace Strings");
|
||||
public final JMenuItem mntmStackFramesRemover = new JMenuItem(
|
||||
"StackFrames Remover");
|
||||
public final JMenuItem mntmNewMenuItem_4 = new JMenuItem("");
|
||||
public final JMenuItem[] waitIcons;
|
||||
public final JMenu mnNewMenu_3 = new JMenu("CFR");
|
||||
public final JMenu mnNewMenu_4 = new JMenu("Procyon");
|
||||
public final JCheckBoxMenuItem decodeenumswitch = new JCheckBoxMenuItem(
|
||||
|
@ -586,19 +586,38 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier {
|
|||
public final JRadioButtonMenuItem panel3Bytecode = new JRadioButtonMenuItem("Bytecode");
|
||||
public final JRadioButtonMenuItem panel3Hexcode = new JRadioButtonMenuItem("Hexcode");
|
||||
|
||||
public void setIcon(final boolean busy) {
|
||||
public synchronized void setIcon(final boolean busy) {
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (busy) {
|
||||
for(int i = 0; i < 10; i++)
|
||||
{
|
||||
if(waitIcons[i].getIcon() == null)
|
||||
{
|
||||
try {
|
||||
mntmNewMenuItem_4.setIcon(Resources.busyIcon);
|
||||
waitIcons[i].setIcon(Resources.busyIcon);
|
||||
} catch (NullPointerException e) {
|
||||
mntmNewMenuItem_4.setIcon(Resources.busyB64Icon);
|
||||
waitIcons[i].setIcon(Resources.busyB64Icon);
|
||||
}
|
||||
waitIcons[i].updateUI();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
for(int i = 0; i < 10; i++)
|
||||
{
|
||||
if(waitIcons[i].getIcon() != null)
|
||||
{
|
||||
waitIcons[i].setIcon(null);
|
||||
waitIcons[i].updateUI();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else
|
||||
mntmNewMenuItem_4.setIcon(null);
|
||||
mntmNewMenuItem_4.updateUI();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -841,10 +860,20 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier {
|
|||
|
||||
if (result == 0) {
|
||||
ArrayList<File> reopen = new ArrayList<File>();
|
||||
|
||||
for (FileContainer container : BytecodeViewer.files)
|
||||
{
|
||||
File newFile = new File(container.file.getParent() + BytecodeViewer.fs + container.name);
|
||||
if(!container.file.getAbsolutePath().equals(newFile.getAbsolutePath())) //APKs & dex get renamed
|
||||
{
|
||||
container.file.renameTo(newFile);
|
||||
container.file = newFile;
|
||||
}
|
||||
reopen.add(container.file);
|
||||
}
|
||||
|
||||
BytecodeViewer.files.clear();
|
||||
|
||||
BytecodeViewer.openFiles(reopen.toArray(new File[reopen.size()]), false);
|
||||
|
||||
//refresh panes
|
||||
|
@ -1081,13 +1110,14 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier {
|
|||
}
|
||||
}
|
||||
|
||||
BytecodeViewer.viewer.setIcon(true);
|
||||
final File javaSucks = file;
|
||||
|
||||
final String path = MiscUtils.append(file, ".zip"); // cheap hax cause
|
||||
// string is final
|
||||
|
||||
JOptionPane pane = new JOptionPane(
|
||||
"What decompiler will you use?");
|
||||
Object[] options = new String[]{"Procyon", "CFR",
|
||||
Object[] options = new String[]{"All", "Procyon", "CFR",
|
||||
"Fernflower", "Krakatau", "Cancel"};
|
||||
pane.setOptions(options);
|
||||
JDialog dialog = pane.createDialog(BytecodeViewer.viewer,
|
||||
|
@ -1099,12 +1129,21 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier {
|
|||
if (options[k].equals(obj))
|
||||
result = k;
|
||||
|
||||
if (result == 0) {
|
||||
BytecodeViewer.viewer.setIcon(true);
|
||||
|
||||
File tempZip = new File(BytecodeViewer.tempDirectory + BytecodeViewer.fs + "temp_"+BytecodeViewer.getRandomizedName()+".jar");
|
||||
if (tempZip.exists())
|
||||
tempZip.delete();
|
||||
|
||||
JarUtils.saveAsJarClassesOnly(BytecodeViewer.getLoadedClasses(), tempZip.getAbsolutePath());
|
||||
|
||||
if (result == 0)
|
||||
{
|
||||
Thread t = new Thread() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
Decompiler.procyon.decompileToZip(path);
|
||||
Decompiler.procyon.decompileToZip(tempZip.getAbsolutePath(), MiscUtils.append(javaSucks, "-proycon.zip"));
|
||||
BytecodeViewer.viewer.setIcon(false);
|
||||
} catch (Exception e) {
|
||||
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e);
|
||||
|
@ -1112,13 +1151,52 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier {
|
|||
}
|
||||
};
|
||||
t.start();
|
||||
Thread t2 = new Thread() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
BytecodeViewer.viewer.setIcon(true);
|
||||
Decompiler.cfr.decompileToZip(tempZip.getAbsolutePath(), MiscUtils.append(javaSucks, "-CFR.zip"));
|
||||
BytecodeViewer.viewer.setIcon(false);
|
||||
} catch (Exception e) {
|
||||
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e);
|
||||
}
|
||||
}
|
||||
};
|
||||
t2.start();
|
||||
Thread t3 = new Thread() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
BytecodeViewer.viewer.setIcon(true);
|
||||
Decompiler.fernflower.decompileToZip(tempZip.getAbsolutePath(), MiscUtils.append(javaSucks, "-fernflower.zip"));
|
||||
BytecodeViewer.viewer.setIcon(false);
|
||||
} catch (Exception e) {
|
||||
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e);
|
||||
}
|
||||
}
|
||||
};
|
||||
t3.start();
|
||||
Thread t4 = new Thread() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
BytecodeViewer.viewer.setIcon(true);
|
||||
Decompiler.krakatau.decompileToZip(tempZip.getAbsolutePath(), MiscUtils.append(javaSucks, "-kraktau.zip"));
|
||||
BytecodeViewer.viewer.setIcon(false);
|
||||
} catch (Exception e) {
|
||||
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e);
|
||||
}
|
||||
}
|
||||
};
|
||||
t4.start();
|
||||
}
|
||||
if (result == 1) {
|
||||
Thread t = new Thread() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
Decompiler.cfr.decompileToZip(path);
|
||||
Decompiler.procyon.decompileToZip(tempZip.getAbsolutePath(), path);
|
||||
BytecodeViewer.viewer.setIcon(false);
|
||||
} catch (Exception e) {
|
||||
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e);
|
||||
|
@ -1132,7 +1210,7 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier {
|
|||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
Decompiler.fernflower.decompileToZip(path);
|
||||
Decompiler.cfr.decompileToZip(tempZip.getAbsolutePath(), path);
|
||||
BytecodeViewer.viewer.setIcon(false);
|
||||
} catch (Exception e) {
|
||||
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e);
|
||||
|
@ -1141,13 +1219,12 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier {
|
|||
};
|
||||
t.start();
|
||||
}
|
||||
|
||||
if (result == 3) {
|
||||
Thread t = new Thread() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
Decompiler.krakatau.decompileToZip(path);
|
||||
Decompiler.fernflower.decompileToZip(tempZip.getAbsolutePath(), path);
|
||||
BytecodeViewer.viewer.setIcon(false);
|
||||
} catch (Exception e) {
|
||||
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e);
|
||||
|
@ -1158,6 +1235,21 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier {
|
|||
}
|
||||
|
||||
if (result == 4) {
|
||||
Thread t = new Thread() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
Decompiler.krakatau.decompileToZip(tempZip.getAbsolutePath(), path);
|
||||
BytecodeViewer.viewer.setIcon(false);
|
||||
} catch (Exception e) {
|
||||
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e);
|
||||
}
|
||||
}
|
||||
};
|
||||
t.start();
|
||||
}
|
||||
|
||||
if (result == 5) {
|
||||
BytecodeViewer.viewer.setIcon(false);
|
||||
}
|
||||
}
|
||||
|
@ -1178,7 +1270,11 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier {
|
|||
public void run() {
|
||||
if (autoCompileSmali.isSelected() && !BytecodeViewer.compile(false))
|
||||
return;
|
||||
final String s = workPane.getCurrentViewer().name;
|
||||
|
||||
final String s = workPane.getCurrentViewer().cn.name;
|
||||
|
||||
if(s == null)
|
||||
return;
|
||||
|
||||
JFileChooser fc = new JFileChooser();
|
||||
fc.setFileFilter(new FileFilter() {
|
||||
|
@ -1225,7 +1321,7 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier {
|
|||
|
||||
JOptionPane pane = new JOptionPane(
|
||||
"What decompiler will you use?");
|
||||
Object[] options = new String[]{"Procyon", "CFR",
|
||||
Object[] options = new String[]{"All", "Procyon", "CFR",
|
||||
"Fernflower", "Krakatau", "Cancel"};
|
||||
pane.setOptions(options);
|
||||
JDialog dialog = pane.createDialog(BytecodeViewer.viewer,
|
||||
|
@ -1254,12 +1350,47 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier {
|
|||
} catch (InterruptedException e1) {
|
||||
}
|
||||
}
|
||||
String contents = Decompiler.procyon.decompileClassNode(cn, cw.toByteArray());
|
||||
DiskWriter.replaceFile(path, contents, false);
|
||||
|
||||
try
|
||||
{
|
||||
DiskWriter.replaceFile(MiscUtils.append(file, "-proycon.java"), Decompiler.procyon.decompileClassNode(cn, cw.toByteArray()), false);
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
DiskWriter.replaceFile(MiscUtils.append(file, "-CFR.java"), Decompiler.cfr.decompileClassNode(cn, cw.toByteArray()), false);
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
DiskWriter.replaceFile(MiscUtils.append(file, "-fernflower.java"), Decompiler.fernflower.decompileClassNode(cn, cw.toByteArray()), false);
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
DiskWriter.replaceFile(MiscUtils.append(file, "-kraktau.java"), Decompiler.krakatau.decompileClassNode(cn, cw.toByteArray()), false);
|
||||
}
|
||||
catch(Exception e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
BytecodeViewer.viewer.setIcon(false);
|
||||
} catch (Exception e) {
|
||||
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(
|
||||
e);
|
||||
BytecodeViewer.viewer.setIcon(false);
|
||||
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(e);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
@ -1282,10 +1413,11 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier {
|
|||
} catch (InterruptedException e1) {
|
||||
}
|
||||
}
|
||||
String contents = Decompiler.cfr.decompileClassNode(cn, cw.toByteArray());
|
||||
String contents = Decompiler.procyon.decompileClassNode(cn, cw.toByteArray());
|
||||
DiskWriter.replaceFile(path, contents, false);
|
||||
BytecodeViewer.viewer.setIcon(false);
|
||||
} catch (Exception e) {
|
||||
BytecodeViewer.viewer.setIcon(false);
|
||||
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(
|
||||
e);
|
||||
}
|
||||
|
@ -1298,7 +1430,6 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier {
|
|||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
|
||||
ClassNode cn = BytecodeViewer.getClassNode(s);
|
||||
final ClassWriter cw = new ClassWriter(0);
|
||||
try {
|
||||
|
@ -1311,10 +1442,11 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier {
|
|||
} catch (InterruptedException e1) {
|
||||
}
|
||||
}
|
||||
String contents = Decompiler.fernflower.decompileClassNode(cn, cw.toByteArray());
|
||||
String contents = Decompiler.cfr.decompileClassNode(cn, cw.toByteArray());
|
||||
DiskWriter.replaceFile(path, contents, false);
|
||||
BytecodeViewer.viewer.setIcon(false);
|
||||
} catch (Exception e) {
|
||||
BytecodeViewer.viewer.setIcon(false);
|
||||
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(
|
||||
e);
|
||||
}
|
||||
|
@ -1335,14 +1467,16 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier {
|
|||
e.printStackTrace();
|
||||
try {
|
||||
Thread.sleep(200);
|
||||
if(cn != null)
|
||||
cn.accept(cw);
|
||||
} catch (InterruptedException e1) {
|
||||
}
|
||||
}
|
||||
String contents = Decompiler.krakatau.decompileClassNode(cn, cw.toByteArray());
|
||||
String contents = Decompiler.fernflower.decompileClassNode(cn, cw.toByteArray());
|
||||
DiskWriter.replaceFile(path, contents, false);
|
||||
BytecodeViewer.viewer.setIcon(false);
|
||||
} catch (Exception e) {
|
||||
BytecodeViewer.viewer.setIcon(false);
|
||||
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(
|
||||
e);
|
||||
}
|
||||
|
@ -1351,6 +1485,35 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier {
|
|||
t.start();
|
||||
}
|
||||
if (result == 4) {
|
||||
Thread t = new Thread() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
ClassNode cn = BytecodeViewer.getClassNode(s);
|
||||
final ClassWriter cw = new ClassWriter(0);
|
||||
try {
|
||||
cn.accept(cw);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
try {
|
||||
Thread.sleep(200);
|
||||
cn.accept(cw);
|
||||
} catch (InterruptedException e1) {
|
||||
}
|
||||
}
|
||||
String contents = Decompiler.krakatau.decompileClassNode(cn, cw.toByteArray());
|
||||
DiskWriter.replaceFile(path, contents, false);
|
||||
BytecodeViewer.viewer.setIcon(false);
|
||||
} catch (Exception e) {
|
||||
BytecodeViewer.viewer.setIcon(false);
|
||||
new the.bytecode.club.bytecodeviewer.api.ExceptionUI(
|
||||
e);
|
||||
}
|
||||
}
|
||||
};
|
||||
t.start();
|
||||
}
|
||||
if (result == 5) {
|
||||
BytecodeViewer.viewer.setIcon(false);
|
||||
}
|
||||
}
|
||||
|
@ -2002,7 +2165,13 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier {
|
|||
mnNewMenu_1.add(mntmZstringarrayDecrypter);
|
||||
mnNewMenu_1.add(mntmStackFramesRemover);
|
||||
|
||||
menuBar.add(mntmNewMenuItem_4);
|
||||
waitIcons = new JMenuItem[10];
|
||||
for(int i = 0; i < 10; i++)
|
||||
{
|
||||
waitIcons[i] = new JMenuItem("");
|
||||
waitIcons[i].setMaximumSize(new Dimension(20, 50));
|
||||
menuBar.add(waitIcons[i]);
|
||||
}
|
||||
|
||||
mntmStartExternalPlugin.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue
Block a user