mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-10 03:53:44 +00:00
Auto deobfuscation can be now disabled in menu
This commit is contained in:
@@ -79,7 +79,6 @@ public class SWFInputStream extends InputStream {
|
||||
private List<byte[]> buffered = new ArrayList<byte[]>();
|
||||
private ByteArrayOutputStream buffer;
|
||||
private static boolean DEOBFUSCATION_ALL_CODE_IN_PREVIOUS_TAG = (Boolean) Configuration.getConfig("deobfuscateUsePrevTagOnly", true);
|
||||
private static boolean AUTO_DEOBFUSCATE = (Boolean) Configuration.getConfig("autoDeobfuscate", true);
|
||||
|
||||
public int getBufferLength() {
|
||||
return buffer.size();
|
||||
@@ -587,7 +586,7 @@ public class SWFInputStream extends InputStream {
|
||||
|
||||
if (ins.isBranch() || ins.isJump()) {
|
||||
|
||||
if (AUTO_DEOBFUSCATE && (ins instanceof ActionIf) && !stack.isEmpty() && (stack.peek().isCompileTime() && (!stack.peek().hasSideEffect()))) {
|
||||
if ((Boolean) Configuration.getConfig("autoDeobfuscate", false) && (ins instanceof ActionIf) && !stack.isEmpty() && (stack.peek().isCompileTime() && (!stack.peek().hasSideEffect()))) {
|
||||
ActionIf aif = (ActionIf) ins;
|
||||
if (aif.ignoreUsed && (!aif.jumpUsed)) {
|
||||
ins.setIgnored(true);
|
||||
@@ -874,7 +873,7 @@ public class SWFInputStream extends InputStream {
|
||||
} else if (next.equals("c")) {
|
||||
goaif = true;
|
||||
}
|
||||
} else if (AUTO_DEOBFUSCATE && top.isCompileTime() && (!top.hasSideEffect()) && ((!top.isVariableComputed()) || (top.isVariableComputed() && enableVariables && (!notCompileTime)))) {
|
||||
} else if ((Boolean) Configuration.getConfig("autoDeobfuscate", false) && top.isCompileTime() && (!top.hasSideEffect()) && ((!top.isVariableComputed()) || (top.isVariableComputed() && enableVariables && (!notCompileTime)))) {
|
||||
//if(top.isCompileTime()) {
|
||||
//if(false){
|
||||
if (enableVariables) {
|
||||
|
||||
@@ -43,7 +43,6 @@ public class MethodBody implements Cloneable, Serializable {
|
||||
public AVM2Code code;
|
||||
public ABCException exceptions[] = new ABCException[0];
|
||||
public Traits traits = new Traits();
|
||||
private static boolean AUTO_DEOBFUSCATE = (Boolean) Configuration.getConfig("autoDeobfuscate", true);
|
||||
|
||||
public List<Integer> getExceptionEntries() {
|
||||
List<Integer> ret = new ArrayList<Integer>();
|
||||
@@ -117,7 +116,7 @@ public class MethodBody implements Cloneable, Serializable {
|
||||
MethodBody b = (MethodBody) Helper.deepCopy(this);
|
||||
deobfuscated = b.code;
|
||||
deobfuscated.markMappedOffsets();
|
||||
if (AUTO_DEOBFUSCATE) {
|
||||
if ((Boolean) Configuration.getConfig("autoDeobfuscate", true)) {
|
||||
deobfuscated.removeTraps(constants, b, abc);
|
||||
}
|
||||
//deobfuscated.restoreControlFlow(constants, b);
|
||||
|
||||
@@ -163,6 +163,7 @@ public class MainFrame extends JFrame implements ActionListener, TreeSelectionLi
|
||||
private JPanel detailPanel;
|
||||
private JTextField filterField = new JTextField("");
|
||||
private JPanel searchPanel;
|
||||
private JCheckBoxMenuItem autoDeobfuscateMenuItem;
|
||||
|
||||
public void setPercent(int percent) {
|
||||
progressBar.setValue(percent);
|
||||
@@ -268,6 +269,12 @@ public class MainFrame extends JFrame implements ActionListener, TreeSelectionLi
|
||||
miDeobfuscation.setActionCommand("DEOBFUSCATE");
|
||||
miDeobfuscation.addActionListener(this);
|
||||
|
||||
autoDeobfuscateMenuItem = new JCheckBoxMenuItem("Automatic deobfuscation");
|
||||
autoDeobfuscateMenuItem.setState((Boolean) Configuration.getConfig("autoDeobfuscate", true));
|
||||
autoDeobfuscateMenuItem.addActionListener(this);
|
||||
autoDeobfuscateMenuItem.setActionCommand("AUTODEOBFUSCATE");
|
||||
|
||||
menuDeobfuscation.add(autoDeobfuscateMenuItem);
|
||||
JCheckBoxMenuItem miSubLimiter = new JCheckBoxMenuItem("Enable sub limiter");
|
||||
miSubLimiter.setActionCommand("SUBLIMITER");
|
||||
miSubLimiter.addActionListener(this);
|
||||
@@ -954,6 +961,13 @@ public class MainFrame extends JFrame implements ActionListener, TreeSelectionLi
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
if (e.getActionCommand().equals("AUTODEOBFUSCATE")) {
|
||||
if (JOptionPane.showConfirmDialog(this, "Automatic deobfuscation is a way to decompile obfuscated code.\r\nDeobfuscation leads to slower decompilation and some of the dead code may be eliminated.\r\nIf the code is not obfuscated, it's better to turn autodeobfuscation off.\r\nDo you really want to " + (autoDeobfuscateMenuItem.getState() ? "turn ON" : "turn OFF") + " automatic debfuscation?", "Confirm", JOptionPane.OK_CANCEL_OPTION) == JOptionPane.OK_OPTION) {
|
||||
Configuration.setConfig("autoDeobfuscate", autoDeobfuscateMenuItem.getState());
|
||||
} else {
|
||||
autoDeobfuscateMenuItem.setState(!autoDeobfuscateMenuItem.getState());
|
||||
}
|
||||
}
|
||||
if (e.getActionCommand().equals("EXIT")) {
|
||||
setVisible(false);
|
||||
if (Main.proxyFrame != null) {
|
||||
|
||||
Reference in New Issue
Block a user