diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java index 2579f75ab..b1dbd4971 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/SWF.java @@ -2341,7 +2341,7 @@ public final class SWF implements SWFContainerItem, Timelined { public static ActionList getCachedActionList(ASMSource src, final List listeners) throws InterruptedException { synchronized (src) { SWF swf = src.getSwf(); - int deobfuscationMode = Configuration.autoDeobfuscate.get() ? (Configuration.deobfuscationOldMode.get() ? 0 : 1) : -1; + int deobfuscationMode = Configuration.autoDeobfuscate.get() ? 1 : 0; if (swf != null && swf.as2PcodeCache.contains(src)) { ActionList result = swf.as2PcodeCache.get(src); if (result.deobfuscationMode == deobfuscationMode) { @@ -3107,7 +3107,6 @@ public final class SWF implements SWFContainerItem, Timelined { tag.getABC().removeTraps(); } else if (level == DeobfuscationLevel.LEVEL_RESTORE_CONTROL_FLOW) { tag.getABC().removeTraps(); - tag.getABC().restoreControlFlow(); } ((Tag) tag).setModified(true); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/ABC.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/ABC.java index 3fc4f2087..7cbf0523e 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/ABC.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/ABC.java @@ -197,12 +197,6 @@ public class ABC { return rem; } - public void restoreControlFlow() throws InterruptedException { - for (MethodBody body : bodies) { - body.restoreControlFlow(constants, null/*FIXME*/, method_info.get(body.method_info)); - } - } - public Set getNsStringUsages() { Set ret = new HashSet<>(); for (int n = 1; n < constants.getNamespaceCount(); n++) { diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Code.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Code.java index 711a701fc..23fb0c645 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Code.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Code.java @@ -19,13 +19,10 @@ package com.jpexs.decompiler.flash.abc.avm2; import com.jpexs.decompiler.flash.EndOfStreamException; import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.ABCInputStream; -import com.jpexs.decompiler.flash.abc.AVM2LocalData; import com.jpexs.decompiler.flash.abc.CopyOutputStream; import com.jpexs.decompiler.flash.abc.avm2.deobfuscation.AVM2DeobfuscatorGetSet; import com.jpexs.decompiler.flash.abc.avm2.deobfuscation.AVM2DeobfuscatorJumps; -import com.jpexs.decompiler.flash.abc.avm2.deobfuscation.AVM2DeobfuscatorRegisters; import com.jpexs.decompiler.flash.abc.avm2.deobfuscation.AVM2DeobfuscatorRegistersOld; -import com.jpexs.decompiler.flash.abc.avm2.deobfuscation.AVM2DeobfuscatorSimple; import com.jpexs.decompiler.flash.abc.avm2.deobfuscation.AVM2DeobfuscatorSimpleOld; import com.jpexs.decompiler.flash.abc.avm2.exceptions.AVM2ExecutionException; import com.jpexs.decompiler.flash.abc.avm2.exceptions.AVM2VerifyErrorException; @@ -33,7 +30,6 @@ import com.jpexs.decompiler.flash.abc.avm2.graph.AVM2Graph; import com.jpexs.decompiler.flash.abc.avm2.graph.AVM2GraphSource; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instructions; -import com.jpexs.decompiler.flash.abc.avm2.instructions.DeobfuscatePopIns; import com.jpexs.decompiler.flash.abc.avm2.instructions.IfTypeIns; import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; import com.jpexs.decompiler.flash.abc.avm2.instructions.UnknownInstruction; @@ -247,9 +243,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.xml.DXNSIns; import com.jpexs.decompiler.flash.abc.avm2.instructions.xml.DXNSLateIns; import com.jpexs.decompiler.flash.abc.avm2.instructions.xml.EscXAttrIns; import com.jpexs.decompiler.flash.abc.avm2.instructions.xml.EscXElemIns; -import com.jpexs.decompiler.flash.abc.avm2.model.BooleanAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.FullMultinameAVM2Item; -import com.jpexs.decompiler.flash.abc.avm2.model.HasNextAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.InitPropertyAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.LocalRegAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.NewFunctionAVM2Item; @@ -262,8 +256,6 @@ import com.jpexs.decompiler.flash.abc.avm2.model.WithAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.clauses.DeclarationAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.clauses.ForEachInAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.clauses.ForInAVM2Item; -import com.jpexs.decompiler.flash.abc.avm2.parser.AVM2ParseException; -import com.jpexs.decompiler.flash.abc.avm2.parser.pcode.ASM3Parser; import com.jpexs.decompiler.flash.abc.avm2.parser.script.PropertyAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.parser.script.Reference; import com.jpexs.decompiler.flash.abc.types.ABCException; @@ -280,7 +272,6 @@ import com.jpexs.decompiler.flash.abc.types.traits.TraitSlotConst; import com.jpexs.decompiler.flash.abc.types.traits.Traits; import com.jpexs.decompiler.flash.configuration.Configuration; import com.jpexs.decompiler.flash.dumpview.DumpInfo; -import com.jpexs.decompiler.flash.ecma.EcmaScript; import com.jpexs.decompiler.flash.ecma.Undefined; import com.jpexs.decompiler.flash.exporters.modes.ScriptExportMode; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; @@ -289,13 +280,10 @@ import com.jpexs.decompiler.flash.helpers.SWFDecompilerPlugin; import com.jpexs.decompiler.flash.helpers.hilight.HighlightSpecialType; import com.jpexs.decompiler.graph.Block; import com.jpexs.decompiler.graph.DottedChain; -import com.jpexs.decompiler.graph.Graph; import com.jpexs.decompiler.graph.GraphPart; import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; -import com.jpexs.decompiler.graph.NotCompileTimeItem; import com.jpexs.decompiler.graph.ScopeStack; -import com.jpexs.decompiler.graph.TranslateException; import com.jpexs.decompiler.graph.TranslateStack; import com.jpexs.decompiler.graph.TypeItem; import com.jpexs.decompiler.graph.model.ExitItem; @@ -306,7 +294,6 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.OutputStream; -import java.io.StringReader; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; @@ -351,7 +338,8 @@ public class AVM2Code implements Cloneable { public static final int DAT_DEBUG_TYPE = OPT_U8 + 0x05; - //public static final int DAT_REGISTER_INDEX = OPT_U8 + 0x06; + public static final int DAT_REGISTER_INDEX = OPT_U8 + 0x06; + public static final int DAT_LINENUM = OPT_U30 + 0x07; public static final int DAT_LOCAL_REG_INDEX = OPT_U30 + 0x08; @@ -843,152 +831,158 @@ public class AVM2Code implements Cloneable { try { ais.seek(address); while (ais.available() > 0) { - DumpInfo di = ais.newDumpLevel("instruction", "instruction"); long startOffset = ais.getPosition(); if (codeMap.containsKey(startOffset) && !(codeMap.get(startOffset).definition instanceof NopIns)) { continue loopaddr; } - int instructionCode = ais.read("instructionCode"); - InstructionDefinition instr = instructionSet[instructionCode]; - if (instructionCode == AVM2Instructions.LookupSwitch) { - if (!isSwitch) { - switchAddresses.add(startOffset); - continue loopaddr; - } else { - isSwitch = false; - } - } - if (di != null) { - di.name = instr.instructionName; - } - if (instr != null) { - int[] actualOperands = null; - - if (instructionCode == AVM2Instructions.LookupSwitch) { // switch - int firstOperand = ais.readS24("default_offset"); - int case_count = ais.readU30("case_count"); - long afterCasePos = ais.getPosition() + 3 * (case_count + 1); - - boolean invalidSwitch = false; - //If there are already some instructions in the lookupswitch bytes, the lookupswitch is invalid (obfuscation) - for (long a = startOffset; a < afterCasePos; a++) { - if (codeMap.containsKey(a) && (!(codeMap.get(a).definition instanceof NopIns))) { - invalidSwitch = true; - break; - } - } - - long totalBytes = ais.getPosition() + ais.available(); - - //If the lookupswitch case_count are larger than available bytes, the lookupswitch is invalid (obfuscation) - if (afterCasePos > totalBytes) { - invalidSwitch = true; - } - if (invalidSwitch) { + DumpInfo di = ais.newDumpLevel("instruction", "instruction"); + InstructionDefinition instr = null; + try { + int instructionCode = ais.read("instructionCode"); + instr = instructionSet[instructionCode]; + if (instructionCode == AVM2Instructions.LookupSwitch) { + if (!isSwitch) { + switchAddresses.add(startOffset); continue loopaddr; } else { - actualOperands = new int[case_count + 3]; - actualOperands[0] = firstOperand; - actualOperands[1] = case_count; - for (int c = 0; c < case_count + 1; c++) { - actualOperands[2 + c] = ais.readS24("actualOperand"); - } + isSwitch = false; } - } else { - if (instr.operands.length > 0) { - actualOperands = new int[instr.operands.length]; - for (int op = 0; op < instr.operands.length; op++) { - switch (instr.operands[op] & 0xff00) { - case OPT_U30: - actualOperands[op] = ais.readU30("operand"); - break; - case OPT_U30_SHORT: - actualOperands[op] = (short) ais.readU30("operand"); - break; - case OPT_U8: - actualOperands[op] = ais.read("operand"); - break; - case OPT_BYTE: - actualOperands[op] = (byte) ais.read("operand"); - break; - case OPT_S24: - actualOperands[op] = ais.readS24("operand"); - break; + } + if (di != null) { + di.name = instr.instructionName; + } + if (instr != null) { + int[] actualOperands = null; + + if (instructionCode == AVM2Instructions.LookupSwitch) { // switch + int firstOperand = ais.readS24("default_offset"); + int case_count = ais.readU30("case_count"); + long afterCasePos = ais.getPosition() + 3 * (case_count + 1); + + boolean invalidSwitch = false; + //If there are already some instructions in the lookupswitch bytes, the lookupswitch is invalid (obfuscation) + for (long a = startOffset; a < afterCasePos; a++) { + if (codeMap.containsKey(a) && (!(codeMap.get(a).definition instanceof NopIns))) { + invalidSwitch = true; + break; + } + } + + long totalBytes = ais.getPosition() + ais.available(); + + //If the lookupswitch case_count are larger than available bytes, the lookupswitch is invalid (obfuscation) + if (afterCasePos > totalBytes) { + invalidSwitch = true; + } + if (invalidSwitch) { + continue loopaddr; + } else { + actualOperands = new int[case_count + 3]; + actualOperands[0] = firstOperand; + actualOperands[1] = case_count; + for (int c = 0; c < case_count + 1; c++) { + actualOperands[2 + c] = ais.readS24("actualOperand"); + } + } + } else { + if (instr.operands.length > 0) { + actualOperands = new int[instr.operands.length]; + for (int op = 0; op < instr.operands.length; op++) { + switch (instr.operands[op] & 0xff00) { + case OPT_U30: + actualOperands[op] = ais.readU30("operand"); + break; + case OPT_U30_SHORT: + actualOperands[op] = (short) ais.readU30("operand"); + break; + case OPT_U8: + actualOperands[op] = ais.read("operand"); + break; + case OPT_BYTE: + actualOperands[op] = (byte) ais.read("operand"); + break; + case OPT_S24: + actualOperands[op] = ais.readS24("operand"); + break; + } } } } - } - AVM2Instruction ai = new AVM2Instruction(startOffset, instr, actualOperands); - long endOffset = ais.getPosition(); + AVM2Instruction ai = new AVM2Instruction(startOffset, instr, actualOperands); + long endOffset = ais.getPosition(); - boolean hasRoom = true; - for (long p = startOffset; p < endOffset; p++) { - if (codeMap.containsKey(p) && !(codeMap.get(p).definition instanceof NopIns)) { - hasRoom = false; - } - } - - //There is no room for this instruction (it is invalid?) - if (!hasRoom) { - continue loopaddr; - } - for (long p = startOffset; p < endOffset; p++) { - codeMap.put(p, ai); - } - - ais.endDumpLevel(instr.instructionCode); - - if ((instr instanceof IfTypeIns)) { - if (handleJumps) { - long target = ais.getPosition() + actualOperands[0]; - addresses.add(target); - } else { - actualOperands[0] = 0; - } - } - - if (instr instanceof JumpIns) { - if (handleJumps) { - long target = ais.getPosition() + actualOperands[0]; - addresses.add(target); - unAdresses.add(ais.getPosition()); - continue loopaddr; - } else { - actualOperands[0] = 0; - } - } - - if (instr.isExitInstruction()) { //do not process jumps if there is return/throw instruction - if (handleJumps) { - unAdresses.add(ais.getPosition()); - continue loopaddr; - } - } - if ((instr instanceof LookupSwitchIns) && actualOperands != null) { - if (handleJumps) { - addresses.add(startOffset + actualOperands[0]); - - for (int c = 2; c < actualOperands.length; c++) { - addresses.add(startOffset + actualOperands[c]); - } - unAdresses.add(ais.getPosition()); - continue loopaddr; - } else { - int swlen = (int) (endOffset - startOffset); - actualOperands[0] = swlen; - for (int c = 2; c < actualOperands.length; c++) { - actualOperands[c] = swlen; + boolean hasRoom = true; + for (long p = startOffset; p < endOffset; p++) { + if (codeMap.containsKey(p) && !(codeMap.get(p).definition instanceof NopIns)) { + hasRoom = false; } } - } - } else { - ais.endDumpLevel(); - break; // Unknown instructions are ignored (Some of the obfuscators add unknown instructions) - //throw new UnknownInstructionCode(instructionCode); + //There is no room for this instruction (it is invalid?) + if (!hasRoom) { + continue loopaddr; + } + for (long p = startOffset; p < endOffset; p++) { + codeMap.put(p, ai); + } + + if ((instr instanceof IfTypeIns)) { + if (handleJumps) { + long target = ais.getPosition() + actualOperands[0]; + addresses.add(target); + } else { + actualOperands[0] = 0; + } + } + + if (instr instanceof JumpIns) { + if (handleJumps) { + long target = ais.getPosition() + actualOperands[0]; + addresses.add(target); + unAdresses.add(ais.getPosition()); + continue loopaddr; + } else { + actualOperands[0] = 0; + } + } + + if (instr.isExitInstruction()) { //do not process jumps if there is return/throw instruction + if (handleJumps) { + unAdresses.add(ais.getPosition()); + continue loopaddr; + } + } + if ((instr instanceof LookupSwitchIns) && actualOperands != null) { + if (handleJumps) { + addresses.add(startOffset + actualOperands[0]); + + for (int c = 2; c < actualOperands.length; c++) { + addresses.add(startOffset + actualOperands[c]); + } + unAdresses.add(ais.getPosition()); + continue loopaddr; + } else { + int swlen = (int) (endOffset - startOffset); + actualOperands[0] = swlen; + for (int c = 2; c < actualOperands.length; c++) { + actualOperands[c] = swlen; + } + } + } + + } else { + break; // Unknown instructions are ignored (Some of the obfuscators add unknown instructions) + //throw new UnknownInstructionCode(instructionCode); + } + } finally { + if (instr == null) { + ais.endDumpLevel(); + } else { + ais.endDumpLevel(instr.instructionCode); + } } } } catch (EndOfStreamException ex) { @@ -996,6 +990,11 @@ public class AVM2Code implements Cloneable { ais.endDumpLevelUntil(diParent); } } + + if (diParent != null) { + diParent.sortChildren(); + } + AVM2Instruction prev = null; for (int i = 0; i < availableBytes; i++) { AVM2Instruction ins = codeMap.get((long) i); @@ -1253,57 +1252,17 @@ public class AVM2Code implements Cloneable { ret.append("exceptiontarget " + e + ":"); } }*/ - if (ins.replaceWith != null) { - for (Object o : ins.replaceWith) { - if (o instanceof Integer) { - AVM2Instruction ins2 = code.get((Integer) o); - if (ins2.isIgnored()) { - continue; - } - writer.append("", ins2.mappedOffset > -1 ? ins2.mappedOffset : ofs); - writer.appendNoHilight(ins2.toStringNoAddress(constants, new ArrayList<>()) + " ;copy from " + Helper.formatAddress(pos2adr((Integer) o))); - writer.newLine(); - outputMap.add((Integer) o); - } else if (o instanceof ControlFlowTag) { - ControlFlowTag cft = (ControlFlowTag) o; - if (cft.name.equals("appendjump")) { - writer.appendNoHilight("jump ofs" + Helper.formatAddress(pos2adr(cft.value))).newLine(); - outputMap.add(-1); - } - if (cft.name.equals("mark")) { - writer.appendNoHilight("ofs" + Helper.formatAddress(pos2adr(cft.value)) + ":"); - } - } - } - } else { - if (!ins.isIgnored()) { - if (markOffsets) { - writer.append("", ins.mappedOffset > -1 ? ins.mappedOffset : ofs); - } - int fixBranch = ins.getFixBranch(); - if (fixBranch > -1) { - if (ins.definition instanceof IfTypeIns) { - for (int i = 0; i < -ins.definition.getStackDelta(ins, null/*IfTypeIns do not require ABCs*/); i++) { - writer.appendNoHilight(DeobfuscatePopIns.NAME).newLine(); - } - if (fixBranch == 0) { // jump - writer.appendNoHilight(JumpIns.NAME + " ofs" + Helper.formatAddress(ofs + ins.getBytesLength() + ins.operands[0])); - } else { - // nojump, ignore - } - } - // TODO: lookupswitch ? - } else { - if (ins.changeJumpTo > -1) { - writer.appendNoHilight(ins.definition.instructionName + " ofs" + Helper.formatAddress(pos2adr(ins.changeJumpTo))); - } else { - writer.appendNoHilight(ins.toStringNoAddress(constants, new ArrayList<>())); - } - } - writer.newLine(); - outputMap.add(ip); + + if (!ins.isIgnored()) { + if (markOffsets) { + writer.append("", ofs); } + + writer.appendNoHilight(ins.toStringNoAddress(constants, new ArrayList<>())); + writer.newLine(); + outputMap.add(ip); } + ip++; } } else if (exportMode == ScriptExportMode.CONSTANTS) { @@ -1325,16 +1284,6 @@ public class AVM2Code implements Cloneable { for (AVM2Instruction ins : code) { ret.addAll(ins.getOffsets()); - if (ins.replaceWith != null) { - for (Object o : ins.replaceWith) { - if (o instanceof ControlFlowTag) { - ControlFlowTag cft = (ControlFlowTag) o; - if (cft.name.equals("appendjump")) { - ret.add((long) pos2adr(cft.value)); - } - } - } - } } return ret; @@ -2278,71 +2227,21 @@ public class AVM2Code implements Cloneable { //checkValidOffsets(body); } - @SuppressWarnings("unchecked") - private static AVM2LocalData prepareBranchLocalData(AVM2LocalData localData) { - AVM2LocalData ret = new AVM2LocalData(); - ret.isStatic = localData.isStatic; - ret.classIndex = localData.classIndex; - ret.localRegs = new HashMap<>(localData.localRegs); - ret.scopeStack = (ScopeStack) (localData.scopeStack).clone(); - ret.methodBody = localData.methodBody; - ret.abc = localData.abc; - ret.localRegNames = localData.localRegNames; - ret.fullyQualifiedNames = localData.fullyQualifiedNames; - ret.parsedExceptions = localData.parsedExceptions; - ret.finallyJumps = localData.finallyJumps; - ret.ignoredSwitches = localData.ignoredSwitches; - ret.ignoredSwitches2 = localData.ignoredSwitches2; - ret.scriptIndex = localData.scriptIndex; - ret.localRegAssignmentIps = localData.localRegAssignmentIps; - ret.ip = localData.ip; - ret.refs = localData.refs; - ret.code = localData.code; - return ret; - } - - private int removeTrapsOld(Trait trait, int methodInfo, MethodBody body, ABC abc, int scriptIndex, int classIndex, boolean isStatic, String path) throws InterruptedException { - removeDeadCode(body); - AVM2LocalData localData = new AVM2LocalData(); - localData.isStatic = isStatic; - localData.classIndex = classIndex; - localData.localRegs = new HashMap<>(); - localData.scopeStack = new ScopeStack(); - localData.methodBody = body; - localData.abc = abc; - localData.localRegNames = body.getLocalRegNames(abc); - localData.scriptIndex = scriptIndex; - localData.ip = 0; - HashMap> refs = visitCode(body); - localData.refs = refs; - localData.code = this; - int ret = 0; - ret += removeTrapsOld(trait, methodInfo, body, localData, new AVM2GraphSource(this, false, -1, -1, new HashMap<>(), new ScopeStack(), abc, body, new HashMap<>(), new ArrayList<>(), new HashMap<>(), refs), 0, path, refs); - removeIgnored(body); - removeDeadCode(body); - - return ret; - } - public int removeTraps(Trait trait, int methodInfo, MethodBody body, ABC abc, int scriptIndex, int classIndex, boolean isStatic, String path) throws InterruptedException { - if (Configuration.deobfuscationOldMode.get()) { - return removeTrapsOld(trait, methodInfo, body, abc, scriptIndex, classIndex, isStatic, path); - } else { - SWFDecompilerPlugin.fireAvm2CodeRemoveTraps(path, classIndex, isStatic, scriptIndex, abc, trait, methodInfo, body); - try (Statistics s = new Statistics("AVM2DeobfuscatorGetSet")) { - new AVM2DeobfuscatorGetSet().avm2CodeRemoveTraps(path, classIndex, isStatic, scriptIndex, abc, trait, methodInfo, body); - } - try (Statistics s = new Statistics("AVM2DeobfuscatorSimple")) { - new AVM2DeobfuscatorSimpleOld().avm2CodeRemoveTraps(path, classIndex, isStatic, scriptIndex, abc, trait, methodInfo, body); - } - try (Statistics s = new Statistics("AVM2DeobfuscatorRegisters")) { - new AVM2DeobfuscatorRegistersOld().avm2CodeRemoveTraps(path, classIndex, isStatic, scriptIndex, abc, trait, methodInfo, body); - } - try (Statistics s = new Statistics("AVM2DeobfuscatorJumps")) { - new AVM2DeobfuscatorJumps().avm2CodeRemoveTraps(path, classIndex, isStatic, scriptIndex, abc, trait, methodInfo, body); - } - return 1; + SWFDecompilerPlugin.fireAvm2CodeRemoveTraps(path, classIndex, isStatic, scriptIndex, abc, trait, methodInfo, body); + try (Statistics s = new Statistics("AVM2DeobfuscatorGetSet")) { + new AVM2DeobfuscatorGetSet().avm2CodeRemoveTraps(path, classIndex, isStatic, scriptIndex, abc, trait, methodInfo, body); } + try (Statistics s = new Statistics("AVM2DeobfuscatorSimple")) { + new AVM2DeobfuscatorSimpleOld().avm2CodeRemoveTraps(path, classIndex, isStatic, scriptIndex, abc, trait, methodInfo, body); + } + try (Statistics s = new Statistics("AVM2DeobfuscatorRegisters")) { + new AVM2DeobfuscatorRegistersOld().avm2CodeRemoveTraps(path, classIndex, isStatic, scriptIndex, abc, trait, methodInfo, body); + } + try (Statistics s = new Statistics("AVM2DeobfuscatorJumps")) { + new AVM2DeobfuscatorJumps().avm2CodeRemoveTraps(path, classIndex, isStatic, scriptIndex, abc, trait, methodInfo, body); + } + return 1; } private void handleRegister(CodeStats stats, int reg) { @@ -2485,10 +2384,11 @@ public class AVM2Code implements Cloneable { nextIp = adr2pos(pos2adr(nextIp) + code.get(maxIp).operands[0]); } if (nextIp < stats.instructionStats.length) { - int origScopePos = stats.instructionStats[nextIp].scopepos; - int origStackPos = stats.instructionStats[nextIp].stackpos; + InstructionStats nextIpStat = stats.instructionStats[nextIp]; + int origScopePos = nextIpStat.scopepos; + int origStackPos = nextIpStat.stackpos; - if (prevStart == ex.start && ex.isFinally() && !code.get(nextIp).isExit() && stats.instructionStats[nextIp].seen) { + if (prevStart == ex.start && ex.isFinally() && !code.get(nextIp).isExit() && nextIpStat.seen) { for (int i = 0; i < stats.instructionStats.length; i++) { stats.instructionStats[i].seen = false; } @@ -2590,163 +2490,6 @@ public class AVM2Code implements Cloneable { return refs; } - private static class ControlFlowTag { - - public String name; - - public int value; - - public ControlFlowTag(String name, int value) { - this.name = name; - this.value = value; - } - } - - public void restoreControlFlow(int ip, HashMap> refs, int[] visited2, HashMap> appended) throws ConvertException { - List buf = new ArrayList<>(); - boolean cont = false; - int continueip; - for (; ip < code.size(); ip++) { - AVM2Instruction ins = code.get(ip); - - if ((refs.containsKey(ip) && refs.get(ip).size() > 1) || (visited2[ip] > 0)) { - if (cont) { - buf.add(new ControlFlowTag("appendjump", ip)); - } - cont = false; - if (visited2[ip] > 0) { - break; - } - } - visited2[ip]++; - if (ins.definition instanceof LookupSwitchIns) { - - if (cont) { - buf.add(new ControlFlowTag("appendjump", ip)); - } - //cont = false; - restoreControlFlow(adr2pos(pos2adr(ip) + ins.operands[0]), refs, visited2, appended); - for (int i = 2; i < ins.operands.length; i++) { - restoreControlFlow(adr2pos(pos2adr(ip) + ins.operands[i]), refs, visited2, appended); - } - break; - } - if (ins.definition instanceof JumpIns) { - int newip = adr2pos(pos2adr(ip + 1) + ins.operands[0]); - - boolean allJumpsOrIfs = true; - for (int ref : refs.get(ip)) { - if (ref < 0) { - continue; - } - if (!(code.get(ref).definition instanceof JumpIns)) { - if (!(code.get(ref).definition instanceof IfTypeIns)) { - allJumpsOrIfs = false; - break; - } else { - if (adr2pos(pos2adr(ref + 1) + code.get(ref).operands[0]) != ip) { - allJumpsOrIfs = false; - break; - } - } - } - } - if (allJumpsOrIfs) { - for (int ref : refs.get(ip)) { - if (ref < 0) { - continue; - } - code.get(ref).changeJumpTo = newip; - } - } - if ((newip < code.size()) && (refs.containsKey(newip) && refs.get(newip).size() == 1)) { - if (!cont) { - continueip = ip; - buf = new ArrayList<>(); - appended.put(continueip, buf); - } - cont = true; - } else { - if (cont) { - buf.add(new ControlFlowTag("appendjump", newip)); - } - cont = false; - } - ip = newip - 1; - } else if (ins.definition instanceof IfTypeIns) { - int newip = adr2pos(pos2adr(ip + 1) + ins.operands[0]); - if (cont) { - buf.add(new ControlFlowTag("appendjump", ip)); - } - cont = false; - restoreControlFlow(newip, refs, visited2, appended); - } else if ((ins.definition instanceof ReturnVoidIns) || (ins.definition instanceof ReturnValueIns) || (ins.definition instanceof ThrowIns)) { - if (cont) { - buf.add(ip); - } - break; - } else if (cont) { - buf.add(ip); - } - } - - } - - private void restoreControlFlowPass(AVM2ConstantPool constants, Trait trait, MethodInfo info, MethodBody body) throws InterruptedException { - try { - HashMap> refs; - int[] visited2 = new int[code.size()]; - refs = visitCode(body); - HashMap> appended = new HashMap<>(); - - restoreControlFlow(0, refs, visited2, appended); - for (ABCException e : body.exceptions) { - try { - restoreControlFlow(adr2pos(e.start, true), refs, visited2, appended); - restoreControlFlow(adr2pos(e.target), refs, visited2, appended); - restoreControlFlow(adr2pos(e.end, true), refs, visited2, appended); - } catch (ConvertException ex) { - logger.log(Level.FINE, null, ex); - } - } - - for (int ip : appended.keySet()) { - code.get(ip).replaceWith = appended.get(ip); - } - } catch (ConvertException cex) { - logger.log(Level.SEVERE, "Error during restore control flow", cex); - } - try { - List outputMap = new ArrayList<>(); - HighlightedTextWriter writer = new HighlightedTextWriter(Configuration.getCodeFormatting(), false); - toASMSource(constants, trait, info, body, outputMap, ScriptExportMode.PCODE, writer); - String src = writer.toString(); - - AVM2Code acode = ASM3Parser.parse(new StringReader(src), constants, null, body, info); - for (int i = 0; i < acode.code.size(); i++) { - if (outputMap.size() > i) { - int tpos = outputMap.get(i); - if (tpos == -1) { - } else if (code.get(tpos).mappedOffset >= 0) { - acode.code.get(i).mappedOffset = code.get(tpos).mappedOffset; - } else { - acode.code.get(i).mappedOffset = pos2adr(tpos); - } - } - } - this.code = acode.code; - } catch (IOException ex) { - logger.log(Level.SEVERE, null, ex); - } catch (AVM2ParseException ex) { - logger.log(Level.FINE, null, ex); - } - removeDeadCode(body); - } - - public void restoreControlFlow(AVM2ConstantPool constants, Trait trait, MethodInfo info, MethodBody body) throws InterruptedException { - restoreControlFlowPass(constants, trait, info, body); - } - public void removeIgnored(MethodBody body) throws InterruptedException { //System.err.println("removing ignored..."); for (int i = 0; i < code.size(); i++) { @@ -2822,25 +2565,6 @@ public class AVM2Code implements Cloneable { return modified; } - public void markMappedOffsets() { - int ofs = 0; - for (int i = 0; i < code.size(); i++) { - code.get(i).mappedOffset = ofs; - ofs += code.get(i).getBytesLength(); - } - } - - private static class Decision { - - public boolean jumpUsed = false; - - public boolean skipUsed = false; - - public Set casesUsed = new HashSet<>(); - - HashMap registers = new HashMap<>(); - } - private static int getMostCommonIp(AVM2GraphSource code, List branches) { List> reachable = new ArrayList<>(); for (int i = 0; i < branches.size(); i++) { @@ -2984,294 +2708,6 @@ public class AVM2Code implements Cloneable { return true; } - @SuppressWarnings("unchecked") - private static int removeTrapsOld(HashMap> refs, boolean secondPass, boolean indeterminate, AVM2LocalData localData, TranslateStack stack, List output, AVM2GraphSource code, int ip, HashMap visited, HashMap> visitedStates, HashMap decisions, String path, int recursionLevel) throws InterruptedException { - if (Thread.currentThread().isInterrupted()) { - throw new InterruptedException(); - } - if (recursionLevel > code.size() + 1) { - throw new TranslateException("removeTraps max recursion level reached."); - } - boolean debugMode = false; - int ret = 0; - iploop: - while ((ip > -1) && ip < code.size()) { - - if (false) { //useVisited) { - if (visited.containsKey(ip)) { - break; - } - if (!visited.containsKey(ip)) { - visited.put(ip, 0); - } else { - visited.put(ip, visited.get(ip) + 1); - } - } else { - HashMap currentState = localData.localRegs; - - if (visitedStates.containsKey(ip)) { - HashMap lastState = visitedStates.get(ip); - if (lastState.equals(currentState)) { - break; - } - } - visitedStates.put(ip, (HashMap) currentState.clone()); - - } - - int curVisited; - if (!visited.containsKey(ip)) { - curVisited = 1; - } else { - curVisited = visited.get(ip) + 1; - } - visited.put(ip, curVisited); - - List r = refs.get(ip); - /*if (r != null) { - if (r.size() > 1) { - if (!stack.isEmpty()) { - GraphTargetItem it = stack.pop(); - stack.push(new NotCompileTimeAVM2Item(null, it)); - } - } - }*/ - - AVM2Instruction ins = code.get(ip); - // Errorneous code inserted by some obfuscators - if (ins.definition instanceof NewObjectIns) { - if (ins.operands[0] > stack.size()) { - ins.setIgnored(true, 0); - } - } - if (ins.definition instanceof NewArrayIns) { - if (ins.operands[0] > stack.size()) { - ins.setIgnored(true, 0); - } - } - - if (ins.isIgnored()) { - ip++; - continue; - } - - if (debugMode) { - System.out.println((indeterminate ? "useV " : "") + (secondPass ? "secondPass " : "") + "Visit " + ip + ": " + ins + " stack:" + stack.toString()); - HashMap registers = localData.localRegs; - System.out.print("Registers:"); - for (int reg : registers.keySet()) { - try { - System.out.print(" r" + reg + ": " + registers.get(reg).getResult()); - } catch (NullPointerException npe) { - System.out.print(" r" + reg + ": " + "null"); - } - } - System.out.println(""); - } - if (secondPass) { - /*if ((ins instanceof AVM2Instruction) && (((AVM2Instruction) ins).definition instanceof PopIns)) { - GraphTargetItem top = stack.peek(); - for (GraphSourceItemPos p : top.getNeededSources()) { - if (p == null) { - continue; - } - if (p.item == null) { - continue; - } - if (p.item.isIgnored()) { - ins.setIgnored(true, 0); - break; - } - } - }*/ - } - - if (ins.definition instanceof NewFunctionIns) { - stack.push(new BooleanAVM2Item(null, null, true)); - } else { - localData.ip = ip; - ins.translate(localData, stack, output, Graph.SOP_USE_STATIC, path); - } - - if (ins.definition instanceof SetLocalTypeIns) { - SetLocalTypeIns slt = (SetLocalTypeIns) ins.definition; - int regId = slt.getRegisterId(ins); - if (indeterminate) { - HashMap registers = localData.localRegs; - GraphTargetItem regVal = registers.get(regId); - if (regVal.isCompileTime()) { - registers.put(regId, new NotCompileTimeItem(null, null, regVal)); - } - } - } - - if (ins.isExit()) { - break; - } - - if (ins.isBranch() || ins.isJump()) { - List branches = ins.getBranches(code); - if (ins.definition instanceof IfTypeIns - && (!(ins.definition instanceof JumpIns)) - && (!stack.isEmpty()) - && (stack.peek().isCompileTime()) - && (!stack.peek().hasSideEffect())) { - boolean condition = EcmaScript.toBoolean(stack.peek().getResult()); - if (debugMode) { - if (condition) { - System.out.println("JUMP"); - } else { - System.out.println("SKIP"); - } - } - Decision dec = new Decision(); - if (decisions.containsKey(ins)) { - dec = decisions.get(ins); - } else { - decisions.put(ins, dec); - } - if (condition) { - dec.jumpUsed = true; - } else { - dec.skipUsed = true; - } - - if (branches.size() > 1) { - if (secondPass) { - if (condition && (dec.jumpUsed) && (!dec.skipUsed)) { - ins.setFixBranch(0); - //ins.definition = AVM2Code.instructionSet[AVM2Instructions.Jump]; - } - if ((!condition) && (!dec.jumpUsed) && (dec.skipUsed)) { - ins.setFixBranch(1); - //ins.setIgnored(true, 0); - } - } - } - GraphTargetItem tar = stack.pop(); - /*if (secondPass && (dec.jumpUsed != dec.skipUsed)) { - for (GraphSourceItemPos pos : tar.getNeededSources()) { - if (pos.item instanceof AVM2Instruction) { - if (((AVM2Instruction) pos.item).definition instanceof DupIns) { - pos.item.setIgnored(true, 0); - break; - } - } - if (pos.item != ins) { - pos.item.setIgnored(true, 0); - } - } - - }*/ - if (branches.size() == 1) { - ip = branches.get(0); - } else { - ip = condition ? branches.get(0) : branches.get(1); - } - continue; - } else { - if (ins.isBranch() && (!ins.isJump())) { - GraphTargetItem top = stack.pop(); - - Decision dec = new Decision(); - if (decisions.containsKey(ins)) { - dec = decisions.get(ins); - } else { - decisions.put(ins, dec); - } - HashMap registers = localData.localRegs; - boolean regChanged = false; - if (!dec.registers.isEmpty()) { - if (dec.registers.size() != registers.size()) { - regChanged = true; - } else { - for (int reg : registers.keySet()) { - if (!dec.registers.containsKey(reg)) { - regChanged = true; - break; - } - if (!registers.get(reg).isCompileTime() && dec.registers.get(reg).isCompileTime()) { - regChanged = true; - break; - } - } - } - } - dec.registers.putAll(registers); - dec.jumpUsed = true; - dec.skipUsed = true; - - if (!regChanged && ((!(top instanceof HasNextAVM2Item) && curVisited > 1) || (curVisited > 2))) { - for (int b : branches) { - int visc = 0; - if (visited.containsKey(b)) { - visc = visited.get(b); - } - if (visc == 0) {//= 0) { //useVisited || (!ins.isJump()) - ret += removeTrapsOld(refs, secondPass, indeterminate, prepareBranchLocalData(localData), brStack, output, code, b, visited, visitedStates, decisions, path, recursionLevel + 1); - } else { - if (debugMode) { - System.out.println("Negative branch:" + b); - } - } - } - } - break; - } - ip++; - } - if (ip < 0 && debugMode) { - System.out.println("Visited Negative: " + ip); - } - return ret; - } - - public static int removeTrapsOld(Trait trait, int methodInfo, MethodBody body, AVM2LocalData localData, AVM2GraphSource code, int addr, String path, HashMap> refs) throws InterruptedException { - HashMap decisions = new HashMap<>(); - removeTrapsOld(refs, false, false, localData, new TranslateStack(path), new ArrayList<>(), code, code.adr2pos(addr), new HashMap<>(), new HashMap<>(), decisions, path, 0); - int cnt = 0; - for (AVM2Instruction src : decisions.keySet()) { - Decision dec = decisions.get(src); - if (dec != null) { - if (src.definition instanceof LookupSwitchIns) { - if (dec.casesUsed.size() == 1) { - for (int c : dec.casesUsed) { - src.setFixBranch(c); - cnt++; - } - } - } else { - if (dec.jumpUsed && !dec.skipUsed) { - src.setFixBranch(0); - cnt++; - } - if (!dec.jumpUsed && dec.skipUsed) { - src.setFixBranch(1); - cnt++; - } - } - } - } - code.getCode().removeIgnored(body); - return cnt; - } - /*public static int removeTraps(AVM2LocalData localData, AVM2GraphSource code, int addr) { - AVM2Graph.translateViaGraph(localData, "", code, new ArrayList(), Graph.SOP_REMOVE_STATIC); - return 1; - }*/ - @Override public AVM2Code clone() { try { diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/AVM2Instruction.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/AVM2Instruction.java index c999dc1da..1e97aff81 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/AVM2Instruction.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/AVM2Instruction.java @@ -53,10 +53,6 @@ public class AVM2Instruction implements Cloneable, GraphSourceItem { private boolean ignored = false; - public long mappedOffset = -1; - - public int changeJumpTo = -1; - private int line; private String file; @@ -329,8 +325,6 @@ public class AVM2Instruction implements Cloneable, GraphSourceItem { return s; } - public List replaceWith; - @Override public void translate(BaseLocalData localData, TranslateStack stack, List output, int staticOperation, String path) throws InterruptedException { AVM2LocalData aLocalData = (AVM2LocalData) localData; @@ -363,14 +357,11 @@ public class AVM2Instruction implements Cloneable, GraphSourceItem { @Override public boolean isJump() { - return (definition instanceof JumpIns) || (fixedBranch > -1); + return definition instanceof JumpIns; } @Override public boolean isBranch() { - if (fixedBranch > -1) { - return false; - } return (definition instanceof IfTypeIns) || (definition instanceof LookupSwitchIns); } @@ -381,7 +372,7 @@ public class AVM2Instruction implements Cloneable, GraphSourceItem { @Override public long getOffset() { - return mappedOffset > -1 ? mappedOffset : offset; + return offset; } @Override @@ -389,23 +380,15 @@ public class AVM2Instruction implements Cloneable, GraphSourceItem { List ret = new ArrayList<>(); if (definition instanceof IfTypeIns) { - if (fixedBranch == -1 || fixedBranch == 0) { - ret.add(code.adr2pos(offset + getBytesLength() + operands[0])); - } + ret.add(code.adr2pos(offset + getBytesLength() + operands[0])); if (!(definition instanceof JumpIns)) { - if (fixedBranch == -1 || fixedBranch == 1) { - ret.add(code.adr2pos(offset + getBytesLength())); - } + ret.add(code.adr2pos(offset + getBytesLength())); } } if (definition instanceof LookupSwitchIns) { - if (fixedBranch == -1 || fixedBranch == 0) { - ret.add(code.adr2pos(offset + operands[0])); - } + ret.add(code.adr2pos(offset + operands[0])); for (int k = 2; k < operands.length; k++) { - if (fixedBranch == -1 || fixedBranch == k - 1) { - ret.add(code.adr2pos(offset + operands[k])); - } + ret.add(code.adr2pos(offset + operands[k])); } } return ret; @@ -421,16 +404,6 @@ public class AVM2Instruction implements Cloneable, GraphSourceItem { this.ignored = ignored; } - public void setFixBranch(int pos) { - this.fixedBranch = pos; - } - - private int fixedBranch = -1; - - public int getFixBranch() { - return fixedBranch; - } - @Override public boolean isDeobfuscatePop() { return definition instanceof DeobfuscatePopIns; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/debug/DebugIns.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/debug/DebugIns.java index d8d907661..768b623ff 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/debug/DebugIns.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/debug/DebugIns.java @@ -25,7 +25,7 @@ import com.jpexs.decompiler.flash.abc.avm2.instructions.InstructionDefinition; public class DebugIns extends InstructionDefinition { public DebugIns() { - super(0xef, "debug", new int[]{AVM2Code.DAT_DEBUG_TYPE, AVM2Code.DAT_STRING_INDEX, AVM2Code.DAT_LOCAL_REG_INDEX, AVM2Code.OPT_U30}, false); + super(0xef, "debug", new int[]{AVM2Code.DAT_DEBUG_TYPE, AVM2Code.DAT_STRING_INDEX, AVM2Code.DAT_REGISTER_INDEX, AVM2Code.OPT_U30}, false); } @Override diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/NewFunctionAVM2Item.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/NewFunctionAVM2Item.java index 28cf6ecca..ca00f458e 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/NewFunctionAVM2Item.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/NewFunctionAVM2Item.java @@ -17,7 +17,6 @@ package com.jpexs.decompiler.flash.abc.avm2.model; import com.jpexs.decompiler.flash.abc.ABC; -import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction; import com.jpexs.decompiler.flash.abc.types.ConvertData; import com.jpexs.decompiler.flash.abc.types.MethodBody; import com.jpexs.decompiler.flash.configuration.Configuration; @@ -25,7 +24,8 @@ import com.jpexs.decompiler.flash.exporters.modes.ScriptExportMode; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; import com.jpexs.decompiler.flash.helpers.NulWriter; import com.jpexs.decompiler.graph.DottedChain; -import com.jpexs.decompiler.graph.GraphTargetItem;import com.jpexs.decompiler.graph.GraphSourceItem; +import com.jpexs.decompiler.graph.GraphSourceItem; +import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.ScopeStack; import com.jpexs.decompiler.graph.TypeItem; import com.jpexs.decompiler.graph.model.LocalData; @@ -49,7 +49,7 @@ public class NewFunctionAVM2Item extends AVM2Item { public int methodIndex; - public NewFunctionAVM2Item(GraphSourceItem instruction, GraphSourceItem lineStartIns, String functionName, String path, boolean isStatic, int scriptIndex, int classIndex, ABC abc, List fullyQualifiedNames, int methodIndex) { + public NewFunctionAVM2Item(GraphSourceItem instruction, GraphSourceItem lineStartIns, String functionName, String path, boolean isStatic, int scriptIndex, int classIndex, ABC abc, List fullyQualifiedNames, int methodIndex) { super(instruction, lineStartIns, PRECEDENCE_PRIMARY); this.functionName = functionName; this.path = path; @@ -71,8 +71,10 @@ public class NewFunctionAVM2Item extends AVM2Item { abc.method_info.get(methodIndex).getParamStr(writer, abc.constants, body, abc, fullyQualifiedNames); writer.appendNoHilight("):"); if (Configuration.showMethodBodyId.get()) { - writer.appendNoHilight("// method body id: "); + writer.appendNoHilight("// method body index: "); writer.appendNoHilight(abc.findBodyIndex(methodIndex)); + writer.appendNoHilight(" method index: "); + writer.appendNoHilight(methodIndex); writer.newLine(); } abc.method_info.get(methodIndex).getReturnTypeStr(writer, abc.constants, fullyQualifiedNames); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/AVM2SourceGenerator.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/AVM2SourceGenerator.java index 453151aff..d5d2f8992 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/AVM2SourceGenerator.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/AVM2SourceGenerator.java @@ -91,7 +91,6 @@ import com.jpexs.decompiler.graph.model.TernarOpItem; import com.jpexs.decompiler.graph.model.TrueItem; import com.jpexs.decompiler.graph.model.UnboundedTypeItem; import com.jpexs.decompiler.graph.model.WhileItem; -import com.jpexs.helpers.Helper; import java.io.ByteArrayOutputStream; import java.io.IOException; import java.util.ArrayList; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ActionScript3Parser.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ActionScript3Parser.java index 85da16cbe..e3045dbfc 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ActionScript3Parser.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/parser/script/ActionScript3Parser.java @@ -20,7 +20,6 @@ import com.jpexs.decompiler.flash.SWC; import com.jpexs.decompiler.flash.SWF; import com.jpexs.decompiler.flash.SourceGeneratorLocalData; import com.jpexs.decompiler.flash.abc.ABC; -import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.model.ApplyTypeAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.BooleanAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.CoerceAVM2Item; @@ -38,7 +37,6 @@ import com.jpexs.decompiler.flash.abc.avm2.model.LocalRegAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.NameValuePair; import com.jpexs.decompiler.flash.abc.avm2.model.NanAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.NewArrayAVM2Item; -import com.jpexs.decompiler.flash.abc.avm2.model.NewFunctionAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.NewObjectAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.NullAVM2Item; import com.jpexs.decompiler.flash.abc.avm2.model.PostDecrementAVM2Item; @@ -2486,12 +2484,9 @@ public class ActionScript3Parser { addScriptFromTree(allOpenedNamespaces, traits, documentClass, classPos); } - public ActionScript3Parser(ABC abc, List otherAbcs) { - try { - initPlayer(); - } catch (IOException | InterruptedException ex) { + public ActionScript3Parser(ABC abc, List otherAbcs) throws IOException, InterruptedException { + initPlayer(); - } abcIndex = new AbcIndexing(playerGlobalAbcIndex); for (ABC a : otherAbcs) { abcIndex.addAbc(a); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/ConvertData.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/ConvertData.java index 59f7f8d3f..9eba72b81 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/ConvertData.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/ConvertData.java @@ -32,6 +32,6 @@ public class ConvertData { public Map assignedValues = new HashMap<>(); public ConvertData() { - deobfuscationMode = Configuration.autoDeobfuscate.get() ? (Configuration.deobfuscationOldMode.get() ? 0 : 1) : -1; + deobfuscationMode = Configuration.autoDeobfuscate.get() ? 1 : 0; } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/MethodBody.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/MethodBody.java index 03ce1a3e3..4477770a9 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/MethodBody.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/MethodBody.java @@ -179,10 +179,6 @@ public final class MethodBody implements Cloneable { return getCode().removeDeadCode(this); } - public void restoreControlFlow(AVM2ConstantPool constants, Trait trait, MethodInfo info) throws InterruptedException { - getCode().restoreControlFlow(constants, trait, info, this); - } - public int removeTraps(ABC abc, Trait trait, int scriptIndex, int classIndex, boolean isStatic, String path) throws InterruptedException { return getCode().removeTraps(trait, method_info, this, abc, scriptIndex, classIndex, isStatic, path); @@ -195,7 +191,6 @@ public final class MethodBody implements Cloneable { removeTraps(abc, trait, scriptIndex, classIndex, isStatic, path); } else if (level == DeobfuscationLevel.LEVEL_RESTORE_CONTROL_FLOW) { removeTraps(abc, trait, scriptIndex, classIndex, isStatic, path); - restoreControlFlow(abc.constants, trait, abc.method_info.get(method_info)); } ((Tag) abc.parentTag).setModified(true); @@ -360,8 +355,10 @@ public final class MethodBody implements Cloneable { HashMap localRegNames = getLocalRegNames(abc); //writer.startMethod(this.method_info); if (Configuration.showMethodBodyId.get()) { - writer.appendNoHilight("// method body id: "); + writer.appendNoHilight("// method body index: "); writer.appendNoHilight(abc.findBodyIndex(this.method_info)); + writer.appendNoHilight(" method index: "); + writer.appendNoHilight(this.method_info); writer.newLine(); } Graph.graphToString(convertedItems, writer, LocalData.create(abc.constants, localRegNames, fullyQualifiedNames)); @@ -381,10 +378,9 @@ public final class MethodBody implements Cloneable { public MethodBody convertMethodBody(ConvertData convertData, String path, boolean isStatic, int scriptIndex, int classIndex, ABC abc, Trait trait, ScopeStack scopeStack, boolean isStaticInitializer, List fullyQualifiedNames, List initTraits) throws InterruptedException { MethodBody body = clone(); AVM2Code code = body.getCode(); - code.markMappedOffsets(); code.fixJumps(path, body); - if (convertData.deobfuscationMode != -1) { + if (convertData.deobfuscationMode != 0) { try { code.removeTraps(trait, method_info, body, abc, scriptIndex, classIndex, isStatic, path); } catch (ThreadDeath | InterruptedException ex) { @@ -394,7 +390,6 @@ public final class MethodBody implements Cloneable { logger.log(Level.SEVERE, "Deobfuscation failed in: " + path, ex); body = clone(); code = body.getCode(); - code.markMappedOffsets(); code.fixJumps(path, body); return body; } @@ -405,7 +400,7 @@ public final class MethodBody implements Cloneable { public String toSource() { ConvertData convertData = new ConvertData(); - convertData.deobfuscationMode = -1; + convertData.deobfuscationMode = 0; try { convert(convertData, "", ScriptExportMode.AS, false, method_info, 0, 0, abc, null, new ScopeStack(), 0, new NulWriter(), new ArrayList<>(), new ArrayList<>(), true); HighlightedTextWriter writer = new HighlightedTextWriter(Configuration.getCodeFormatting(), false); diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/traits/TraitSlotConst.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/traits/TraitSlotConst.java index cdd490eee..0d6e4f207 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/traits/TraitSlotConst.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/traits/TraitSlotConst.java @@ -19,7 +19,6 @@ package com.jpexs.decompiler.flash.abc.types.traits; import com.jpexs.decompiler.flash.abc.ABC; import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool; import com.jpexs.decompiler.flash.abc.avm2.model.NewFunctionAVM2Item; -import com.jpexs.decompiler.flash.abc.avm2.parser.script.FunctionAVM2Item; import com.jpexs.decompiler.flash.abc.types.AssignedValue; import com.jpexs.decompiler.flash.abc.types.ConvertData; import com.jpexs.decompiler.flash.abc.types.Multiname; @@ -106,8 +105,10 @@ public class TraitSlotConst extends Trait implements TraitWithSlot { writer.startTrait(assignment.initializer); writer.startMethod(assignment.method); if (Configuration.showMethodBodyId.get()) { - writer.appendNoHilight("// method body id: "); + writer.appendNoHilight("// method body index: "); writer.appendNoHilight(abc.findBodyIndex(assignment.method)); + writer.appendNoHilight(" method index: "); + writer.appendNoHilight(assignment.method); writer.newLine(); } @@ -199,5 +200,4 @@ public class TraitSlotConst extends Trait implements TraitWithSlot { super.getImportsUsages(customNs, abc, imports, uses, ignorePackage, fullyQualifiedNames); parseImportsUsagesFromMultiname(customNs, abc, imports, uses, abc.constants.getMultiname(type_index), getPackage(abc), fullyQualifiedNames); } - } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/Action.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/Action.java index 30aed124c..4cb80f780 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/Action.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/Action.java @@ -838,8 +838,7 @@ public abstract class Action implements GraphSourceItem { int staticOperation = Graph.SOP_USE_STATIC; //(Boolean) Configuration.getConfig("autoDeobfuscate", true) ? Graph.SOP_SKIP_STATIC : Graph.SOP_USE_STATIC; List tree = actionsToTree(new HashMap<>(), new HashMap<>(), new HashMap<>(), actions, version, staticOperation, path); SWFDecompilerPlugin.fireActionTreeCreated(tree, swf); - int deobfuscationMode = Configuration.autoDeobfuscate.get() ? (Configuration.deobfuscationOldMode.get() ? 0 : 1) : -1; - if (deobfuscationMode == 1) { + if (Configuration.autoDeobfuscate.get()) { new ActionDeobfuscator().actionTreeCreated(tree, swf); } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/ActionListReader.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/ActionListReader.java index 0dabf6967..54d259fed 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/ActionListReader.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/ActionListReader.java @@ -20,45 +20,26 @@ import com.jpexs.decompiler.flash.DisassemblyListener; import com.jpexs.decompiler.flash.SWFInputStream; import com.jpexs.decompiler.flash.action.deobfuscation.ActionDeobfuscator; import com.jpexs.decompiler.flash.action.model.ConstantPool; -import com.jpexs.decompiler.flash.action.model.DirectValueActionItem; import com.jpexs.decompiler.flash.action.special.ActionDeobfuscateJump; import com.jpexs.decompiler.flash.action.special.ActionEnd; import com.jpexs.decompiler.flash.action.special.ActionNop; import com.jpexs.decompiler.flash.action.special.ActionStore; -import com.jpexs.decompiler.flash.action.swf4.ActionEquals; import com.jpexs.decompiler.flash.action.swf4.ActionIf; import com.jpexs.decompiler.flash.action.swf4.ActionJump; import com.jpexs.decompiler.flash.action.swf4.ActionPush; import com.jpexs.decompiler.flash.action.swf5.ActionConstantPool; -import com.jpexs.decompiler.flash.action.swf5.ActionDefineFunction; -import com.jpexs.decompiler.flash.action.swf5.ActionEquals2; -import com.jpexs.decompiler.flash.action.swf5.ActionStoreRegister; -import com.jpexs.decompiler.flash.action.swf7.ActionDefineFunction2; import com.jpexs.decompiler.flash.configuration.Configuration; -import com.jpexs.decompiler.flash.ecma.EcmaScript; -import com.jpexs.decompiler.flash.ecma.Null; -import com.jpexs.decompiler.flash.exporters.modes.ScriptExportMode; import com.jpexs.decompiler.flash.helpers.SWFDecompilerPlugin; -import com.jpexs.decompiler.graph.Graph; -import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphSourceItemContainer; -import com.jpexs.decompiler.graph.GraphTargetItem; -import com.jpexs.decompiler.graph.NotCompileTimeItem; -import com.jpexs.decompiler.graph.TranslateException; -import com.jpexs.decompiler.graph.TranslateStack; -import com.jpexs.decompiler.graph.model.LocalData; import com.jpexs.helpers.CancellableWorker; -import com.jpexs.helpers.Helper; import com.jpexs.helpers.stat.Statistics; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; -import java.util.HashSet; import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Queue; -import java.util.Scanner; import java.util.TreeMap; import java.util.concurrent.Callable; import java.util.concurrent.ExecutionException; @@ -169,17 +150,9 @@ public class ActionListReader { actions = fixActionList(actions, null); } - if (deobfuscationMode == 0) { + if (deobfuscationMode == 1) { try { - actions = deobfuscateActionListOld(listeners, actions, version, 0, path); - updateActionLengths(actions); - } catch (OutOfMemoryError | StackOverflowError | TranslateException ex) { - // keep orignal (not deobfuscated) actions - logger.log(Level.SEVERE, null, ex); - } - } else if (deobfuscationMode == 1) { - try { - try (Statistics s = new Statistics("ActionDeobfuscatorSimpleFast")) { + try (Statistics s = new Statistics("ActionDeobfuscator")) { new ActionDeobfuscator().actionListParsed(actions, sis.getSwf()); } } catch (ThreadDeath | InterruptedException ex) { @@ -249,81 +222,6 @@ public class ActionListReader { return new ArrayList<>(actionMap.values()); } - /** - * Reads list of actions from the stream. Reading ends with - * ActionEndFlag(=0) or end of the stream. - * - * @param listeners - * @param actions - * @param version - * @param ip - * @param path - * @return List of actions - * @throws IOException - * @throws java.lang.InterruptedException - */ - private static ActionList deobfuscateActionListOld(List listeners, ActionList actions, int version, int ip, String path) throws IOException, InterruptedException { - if (actions.isEmpty()) { - return actions; - } - - Action lastAction = actions.get(actions.size() - 1); - int endIp = (int) lastAction.getAddress(); - - List retMap = new ArrayList<>(endIp); - for (int i = 0; i < endIp; i++) { - retMap.add(null); - } - List actionMap = new ArrayList<>(endIp + 1); - for (int i = 0; i <= endIp; i++) { - actionMap.add(null); - } - for (Action a : actions) { - actionMap.set((int) a.getAddress(), a); - } - - int maxRecursionLevel = 0; - for (int i = 0; i < actions.size(); i++) { - Action a = actions.get(i); - if (a instanceof ActionIf || a instanceof GraphSourceItemContainer) { - maxRecursionLevel++; - } - if (a instanceof ActionIf) { - ActionIf aif = (ActionIf) a; - aif.ignoreUsed = false; - aif.jumpUsed = false; - } - } - - deobfustaceActionListAtPosRecursiveOld(listeners, - new ArrayList<>(), - new HashMap<>(), - new ActionLocalData(), - new TranslateStack(path), - new ConstantPool(), - actionMap, ip, retMap, ip, endIp, path, - new HashMap<>(), false, - new HashMap<>(), - version, 0, maxRecursionLevel); - - ActionList ret = new ActionList(); - Action last = null; - for (Action a : retMap) { - if (a != last && a != null) { - ret.add(a); - } - last = a; - } - ret.removeNops(); - ActionList reta = new ActionList(); - for (Object o : ret) { - if (o instanceof Action) { - reta.add((Action) o); - } - } - return reta; - } - private static long getNearAddress(ActionList actions, long address, boolean next) { int min = 0; int max = actions.size() - 1; @@ -997,252 +895,4 @@ public class ActionListReader { return ret; } - - private static void deobfustaceActionListAtPosRecursiveOld(List listeners, List output, HashMap> containers, ActionLocalData localData, TranslateStack stack, ConstantPool cpool, List actions, int ip, List ret, int startIp, int endip, String path, Map visited, boolean indeterminate, Map> decisionStates, int version, int recursionLevel, int maxRecursionLevel) throws IOException, InterruptedException { - boolean debugMode = false; - boolean decideBranch = false; - - if (recursionLevel > maxRecursionLevel + 1) { - throw new TranslateException("deobfustaceActionListAtPosRecursive max recursion level reached."); - } - - Action a; - Scanner sc = null; - loopip: - while (((endip == -1) || (endip > ip)) && (a = actions.get(ip)) != null) { - if (Thread.currentThread().isInterrupted()) { - throw new InterruptedException(); - } - - int actionLen = a.getTotalActionLength(); - if (!visited.containsKey(ip)) { - visited.put(ip, 0); - } - int curVisited = visited.get(ip); - curVisited++; - visited.put(ip, curVisited); - for (int i = 0; i < listeners.size(); i++) { - listeners.get(i).progressDeobfuscating(ip, actions.size()); - } - int info = a.getTotalActionLength(); - - if (a instanceof ActionPush) { - if (cpool != null) { - ((ActionPush) a).constantPool = cpool.constants; - } - } - - if (debugMode) { - String atos = a.getASMSource(new ActionList(), new HashSet<>(), ScriptExportMode.PCODE); - if (a instanceof GraphSourceItemContainer) { - atos = a.toString(); - } - System.err.println("readActionListAtPos ip: " + (ip - startIp) + " (0x" + Helper.formatAddress(ip - startIp) + ") " + " action(len " + a.actionLength + "): " + atos + (a.isIgnored() ? " (ignored)" : "") + " stack:" + Helper.stackToString(stack, LocalData.create(cpool)) + " " + Helper.byteArrToString(a.getBytes(version))); - System.err.print("variables: "); - for (Map.Entry v : localData.variables.entrySet()) { - System.err.print("'" + v + "' = " + v.getValue().toString(LocalData.create(cpool)) + ", "); - } - System.err.println(); - String add = ""; - if (a instanceof ActionIf) { - add = " change: " + ((ActionIf) a).getJumpOffset(); - } - if (a instanceof ActionJump) { - add = " change: " + ((ActionJump) a).getJumpOffset(); - } - System.err.println(add); - } - - int newip = -1; - - if (a instanceof ActionConstantPool) { - if (cpool == null) { - cpool = new ConstantPool(); - } - cpool.setNew(((ActionConstantPool) a).constantPool); - } - ActionIf aif = null; - boolean goaif = false; - if (!a.isIgnored()) { - String varname = null; - if (a instanceof StoreTypeAction) { - StoreTypeAction sta = (StoreTypeAction) a; - varname = sta.getVariableName(stack, cpool); - } - - try { - if (a instanceof ActionIf) { - aif = (ActionIf) a; - - GraphTargetItem top = stack.pop(); - int nip = ip + actionLen + aif.getJumpOffset(); - - if (decideBranch) { - System.out.print("newip " + nip + ", "); - System.out.print("Action: jump(j),ignore(i),compute(c)?"); - if (sc == null) { - sc = new Scanner(System.in); - } - String next = sc.next(); - switch (next) { - case "j": - newip = nip; - break; - case "i": - break; - case "c": - goaif = true; - break; - } - } else if (top.isCompileTime() && (!top.hasSideEffect())) { - if (debugMode) { - System.err.print("is compiletime -> "); - } - if (EcmaScript.toBoolean(top.getResult())) { - newip = nip; - aif.jumpUsed = true; - if (debugMode) { - System.err.println("jump"); - } - } else { - aif.ignoreUsed = true; - if (debugMode) { - System.err.println("ignore"); - } - } - } else { - if (debugMode) { - System.err.println("goaif"); - } - goaif = true; - } - } else if (a instanceof ActionJump) { - newip = ip + actionLen + ((ActionJump) a).getJumpOffset(); - } else if (!(a instanceof GraphSourceItemContainer)) { - //return in for..in, TODO:Handle this better way - if (((a instanceof ActionEquals) || (a instanceof ActionEquals2)) && (stack.size() == 1) && (stack.peek() instanceof DirectValueActionItem)) { - stack.push(new DirectValueActionItem(null, null, 0, Null.INSTANCE, new ArrayList<>())); - } - if ((a instanceof ActionStoreRegister) && stack.isEmpty()) { - stack.push(new DirectValueActionItem(null, null, 0, Null.INSTANCE, new ArrayList<>())); - } - a.translate(localData, stack, output, Graph.SOP_USE_STATIC/*Graph.SOP_SKIP_STATIC*/, path); - } - } catch (RuntimeException ex) { - logger.log(Level.SEVERE, "Disassembly exception", ex); - break; - } - - HashMap vars = localData.variables; - if (varname != null) { - GraphTargetItem varval = vars.get(varname); - if (varval != null && varval.isCompileTime() && indeterminate) { - vars.put(varname, new NotCompileTimeItem(null, null, varval)); - } - } - } - for (int i = 0; i < actionLen; i++) { - ret.set(ip + i, a); - } - - if (a instanceof GraphSourceItemContainer) { - GraphSourceItemContainer cnt = (GraphSourceItemContainer) a; - if (a instanceof Action) { - long endAddr = a.getAddress() + cnt.getHeaderSize(); - String cntName = cnt.getName(); - List> output2s = new ArrayList<>(); - for (long size : cnt.getContainerSizes()) { - if (size == 0) { - output2s.add(new ArrayList<>()); - continue; - } - ActionLocalData localData2; - List output2 = new ArrayList<>(); - if ((cnt instanceof ActionDefineFunction) || (cnt instanceof ActionDefineFunction2)) { - localData2 = new ActionLocalData(); - } else { - localData2 = localData; - } - deobfustaceActionListAtPosRecursiveOld(listeners, output2, containers, localData2, new TranslateStack(path), cpool, actions, (int) endAddr, ret, startIp, (int) (endAddr + size), path + (cntName == null ? "" : "/" + cntName), visited, indeterminate, decisionStates, version, recursionLevel + 1, maxRecursionLevel); - output2s.add(output2); - endAddr += size; - } - GraphSourceItem lineStartItem = null; - if (cnt instanceof GraphSourceItem) { - lineStartItem = (GraphSourceItem) cnt; - } - cnt.translateContainer(output2s, lineStartItem, stack, output, localData.regNames, localData.variables, localData.functions); - ip = (int) endAddr; - continue; - } - } - - if (a instanceof ActionEnd) { - break; - } - if (goaif && aif != null) { - aif.ignoreUsed = true; - aif.jumpUsed = true; - indeterminate = true; - - HashMap vars = localData.variables; - boolean stateChanged = false; - if (decisionStates.containsKey(ip)) { - HashMap oldstate = decisionStates.get(ip); - if (oldstate.size() != vars.size()) { - stateChanged = true; - } else { - for (String k : vars.keySet()) { - if (!oldstate.containsKey(k)) { - stateChanged = true; - break; - } - if (!vars.get(k).isCompileTime() && oldstate.get(k).isCompileTime()) { - stateChanged = true; - break; - } - } - } - } - HashMap curstate = new HashMap<>(); - curstate.putAll(vars); - decisionStates.put(ip, curstate); - - if ((!stateChanged) && curVisited > 1) { - List branches = new ArrayList<>(); - branches.add(ip + actionLen + aif.getJumpOffset()); - branches.add(ip + actionLen); - for (int br : branches) { - int visc = 0; - if (visited.containsKey(br)) { - visc = visited.get(br); - } - if (visc == 0) {//(localData.regNames), - new HashMap<>(localData.variables), new HashMap<>(localData.functions)); - deobfustaceActionListAtPosRecursiveOld(listeners, output, containers, subLocalData, subStack, cpool, actions, ip + actionLen + aif.getJumpOffset(), ret, startIp, endip, path, visited, indeterminate, decisionStates, version, recursionLevel + 1, maxRecursionLevel); - } - - if (newip > -1) { - ip = newip; - } else { - ip += info; - } - - if (a.isExit()) { - break; - } - } - for (DisassemblyListener listener : listeners) { - listener.progressDeobfuscating(ip, actions.size()); - } - } } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf4/ActionPush.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf4/ActionPush.java index 64fc253ff..d875277e9 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf4/ActionPush.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf4/ActionPush.java @@ -37,7 +37,6 @@ import com.jpexs.decompiler.flash.helpers.GraphTextWriter; import com.jpexs.decompiler.flash.helpers.HighlightedTextWriter; import com.jpexs.decompiler.flash.types.annotations.SWFVersion; import com.jpexs.decompiler.graph.GraphSourceItem; -import com.jpexs.decompiler.graph.GraphSourceItem; import com.jpexs.decompiler.graph.GraphTargetItem; import com.jpexs.decompiler.graph.TranslateStack; import com.jpexs.decompiler.graph.model.FalseItem; @@ -60,31 +59,6 @@ public class ActionPush extends Action { public List constantPool; - public List ignoredParts = new ArrayList<>(); - - @Override - public boolean isIgnored() { - return ignoredParts.size() == values.size(); - } - - @Override - public void setIgnored(boolean ignored, int pos) { - if (ignored) { - if (!ignoredParts.contains(pos)) { - ignoredParts.add(pos); - if (ignoredParts.size() == values.size()) { - super.setIgnored(ignored, 0); - } - } - } else { - if (ignoredParts.contains(pos)) { - ignoredParts.remove(pos); - super.setIgnored(false, 0); - } - } - - } - public ActionPush(int actionLength, SWFInputStream sis, int version) throws IOException { super(0x96, actionLength); int type; @@ -360,9 +334,6 @@ public class ActionPush extends Action { public GraphTextWriter paramsToString(GraphTextWriter writer) { int pos = 0; for (int i = 0; i < values.size(); i++) { - if (ignoredParts.contains(i)) { - continue; - } if (pos > 0) { writer.appendNoHilight(" "); } @@ -404,10 +375,6 @@ public class ActionPush extends Action { public void translate(GraphSourceItem lineStartAction, TranslateStack stack, List output, HashMap regNames, HashMap variables, HashMap functions, int staticOperation, String path) { int pos = 0; for (Object o : values) { - if (ignoredParts.contains(pos)) { - pos++; - continue; - } if (o instanceof ConstantIndex) { if ((constantPool == null) || (((ConstantIndex) o).index >= constantPool.size())) { o = "§§constant" + ((ConstantIndex) o).index; diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/configuration/Configuration.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/configuration/Configuration.java index 260d37d76..7f1444791 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/configuration/Configuration.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/configuration/Configuration.java @@ -92,10 +92,6 @@ public class Configuration { @ConfigurationCategory("script") public static final ConfigurationItem autoDeobfuscate = null; - @ConfigurationDefaultBoolean(false) - @ConfigurationCategory("") - public static final ConfigurationItem deobfuscationOldMode = null; - @ConfigurationDefaultBoolean(false) @ConfigurationCategory("") public static final ConfigurationItem cacheOnDisk = null; @@ -262,6 +258,7 @@ public class Configuration { public static final ConfigurationItem> swfSpecificConfigs = null; + @ConfigurationDefaultCalendar(0) public static final ConfigurationItem lastUpdatesCheckDate = null; @ConfigurationDefaultInt(1000) @@ -741,12 +738,6 @@ public class Configuration { } //limit paralel threads? //int processorCount = Runtime.getRuntime().availableProcessors(); - - if (lastUpdatesCheckDate.get() == null) { - GregorianCalendar mingc = new GregorianCalendar(); - mingc.setTime(new Date(Long.MIN_VALUE)); - lastUpdatesCheckDate.set(mingc); - } } @SuppressWarnings("unchecked") @@ -817,6 +808,12 @@ public class Configuration { if (aDouble != null) { defaultValue = aDouble.value(); } + ConfigurationDefaultCalendar aCalendar = field.getAnnotation(ConfigurationDefaultCalendar.class); + if (aCalendar != null) { + GregorianCalendar mingc = new GregorianCalendar(); + mingc.setTime(new Date(aCalendar.value())); + defaultValue = mingc; + } return defaultValue; } diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/configuration/ConfigurationDefaultCalendar.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/configuration/ConfigurationDefaultCalendar.java new file mode 100644 index 000000000..5edc52472 --- /dev/null +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/configuration/ConfigurationDefaultCalendar.java @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2010-2015 JPEXS, All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3.0 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library. + */ +package com.jpexs.decompiler.flash.configuration; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * + * @author JPEXS + */ +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.FIELD) +public @interface ConfigurationDefaultCalendar { + + long value(); +} diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/dumpview/DumpInfo.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/dumpview/DumpInfo.java index 7a88f11f3..0c5a0eddf 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/dumpview/DumpInfo.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/dumpview/DumpInfo.java @@ -18,6 +18,8 @@ package com.jpexs.decompiler.flash.dumpview; import com.jpexs.decompiler.flash.tags.TagStub; import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; import java.util.List; /** @@ -77,6 +79,25 @@ public class DumpInfo { return childInfos; } + public void sortChildren() { + if (childInfos == null) { + return; + } + + Collections.sort(childInfos, new Comparator() { + + @Override + public int compare(DumpInfo o1, DumpInfo o2) { + int res = Long.compare(o1.startByte, o2.startByte); + if (res != 0) { + return res; + } + + return Integer.compare(o1.startBit, o1.startBit); + } + }); + } + public long getEndByte() { int end = (int) startByte; if (lengthBytes != 0) { diff --git a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/Graph.java b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/Graph.java index f72207f65..1a9e633eb 100644 --- a/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/Graph.java +++ b/libsrc/ffdec_lib/src/com/jpexs/decompiler/graph/Graph.java @@ -18,7 +18,6 @@ package com.jpexs.decompiler.graph; import com.jpexs.decompiler.flash.BaseLocalData; import com.jpexs.decompiler.flash.FinalProcessLocalData; -import com.jpexs.decompiler.flash.abc.avm2.parser.script.Reference; import com.jpexs.decompiler.flash.action.Action; import com.jpexs.decompiler.flash.action.model.FunctionActionItem; import com.jpexs.decompiler.flash.helpers.GraphTextWriter; @@ -298,11 +297,9 @@ public class Graph { getReachableParts(part, ret, loops, true); } - /** - * Non recursive version of getReachablePartsOld - */ private void getReachableParts(GraphPart part, LinkedHashSet ret, List loops, boolean first) { + // todo: honfika: why call with first = true parameter always? Stack stack = new Stack<>(); GraphPartQueue queue = new GraphPartQueue(); queue.add(part); @@ -386,77 +383,6 @@ public class Graph { } } - private void getReachablePartsOld(GraphPart part, LinkedHashSet ret, List loops, boolean first) { - - // todo: honfika: why call with first = true parameter always? - if (first) { - for (Loop l : loops) { - l.reachableMark = 0; - } - } - - Loop currentLoop = null; - for (Loop l : loops) { - if ((l.phase == 1) || (l.reachableMark == 1)) { - if (l.loopContinue == part) { - return; - } - if (l.loopBreak == part) { - return; - } - if (l.loopPreContinue == part) { - return; - } - } - if (l.reachableMark == 0) { - if (l.loopContinue == part) { - l.reachableMark = 1; - currentLoop = l; - } - } - } - - List newparts = new ArrayList<>(); - loopnext: - for (GraphPart next : part.nextParts) { - for (Loop l : loops) { - if ((l.phase == 1) || (l.reachableMark == 1)) { - if (l.loopContinue == next) { - continue loopnext; - } - if (l.loopBreak == next) { - continue loopnext; - } - if (l.loopPreContinue == next) { - continue loopnext; - } - } - - } - if (!ret.contains(next)) { - newparts.add(next); - } - } - - ret.addAll(newparts); - for (GraphPart next : newparts) { - getReachableParts(next, ret, loops, true); - } - - if (currentLoop != null) { - if (currentLoop.loopBreak != null) { - if (!ret.contains(currentLoop.loopBreak)) { - ret.add(currentLoop.loopBreak); - currentLoop.reachableMark = 2; - getReachableParts(currentLoop.loopBreak, ret, loops, true); - } - } - } - } - - /* public GraphPart getNextCommonPart(GraphPart part, List loops) { - return getNextCommonPart(part, new ArrayList(),loops); - }*/ public GraphPart getNextCommonPart(BaseLocalData localData, GraphPart part, List loops) throws InterruptedException { return getCommonPart(localData, part.nextParts, loops); } diff --git a/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/ActionScript2DeobfuscatorTest.java b/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/ActionScript2DeobfuscatorTest.java index 8eada6b87..90b2cca1c 100644 --- a/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/ActionScript2DeobfuscatorTest.java +++ b/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/ActionScript2DeobfuscatorTest.java @@ -49,7 +49,6 @@ public class ActionScript2DeobfuscatorTest extends ActionScript2TestBase { public void init() throws IOException, InterruptedException { //Main.initLogging(false); Configuration.autoDeobfuscate.set(true); - Configuration.deobfuscationOldMode.set(false); swf = new SWF(new BufferedInputStream(new FileInputStream("testdata/as2/as2.swf")), false); } diff --git a/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/ActionScript3AssemblerTest.java b/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/ActionScript3AssemblerTest.java index e182195c0..8a13a1020 100644 --- a/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/ActionScript3AssemblerTest.java +++ b/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/ActionScript3AssemblerTest.java @@ -53,7 +53,6 @@ public class ActionScript3AssemblerTest extends ActionScriptTestBase { public void init() throws IOException, InterruptedException { //Main.initLogging(false); Configuration.autoDeobfuscate.set(true); - Configuration.deobfuscationOldMode.set(false); swf = new SWF(new BufferedInputStream(new FileInputStream("testdata/as3/as3.swf")), false); } diff --git a/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/ActionScript3DeobfuscatorTest.java b/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/ActionScript3DeobfuscatorTest.java index c933604a2..c6f01932c 100644 --- a/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/ActionScript3DeobfuscatorTest.java +++ b/libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/ActionScript3DeobfuscatorTest.java @@ -55,7 +55,6 @@ public class ActionScript3DeobfuscatorTest extends ActionScript2TestBase { public void init() throws IOException, InterruptedException { //Main.initLogging(false); Configuration.autoDeobfuscate.set(true); - Configuration.deobfuscationOldMode.set(false); Configuration.decimalAddress.set(false); Configuration.decompilationTimeoutSingleMethod.set(Integer.MAX_VALUE); swf = new SWF(new BufferedInputStream(new FileInputStream("testdata/as3/as3.swf")), false); diff --git a/src/com/jpexs/decompiler/flash/gui/AdvancedSettingsDialog.java b/src/com/jpexs/decompiler/flash/gui/AdvancedSettingsDialog.java index af5fc0a93..e78d23043 100644 --- a/src/com/jpexs/decompiler/flash/gui/AdvancedSettingsDialog.java +++ b/src/com/jpexs/decompiler/flash/gui/AdvancedSettingsDialog.java @@ -34,7 +34,6 @@ import java.awt.Graphics2D; import java.awt.Insets; import java.awt.RenderingHints; import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; import java.io.File; import java.lang.reflect.Field; import java.lang.reflect.ParameterizedType; @@ -94,6 +93,8 @@ public class AdvancedSettingsDialog extends AppDialog { /** * Creates new form AdvancedSettingsDialog + * + * @param selectedCategory */ public AdvancedSettingsDialog(String selectedCategory) { initComponents(selectedCategory); @@ -387,7 +388,7 @@ public class AdvancedSettingsDialog extends AppDialog { val = ""; } if (itemType == Calendar.class) { - tf.setText(new SimpleDateFormat().format(((Calendar) item.get()).getTime())); + tf.setText(new SimpleDateFormat().format(((Calendar) val).getTime())); } else { tf.setText(val.toString()); } diff --git a/src/com/jpexs/decompiler/flash/gui/MainFrameMenu.java b/src/com/jpexs/decompiler/flash/gui/MainFrameMenu.java index 6015ab0cc..ea287bcc2 100644 --- a/src/com/jpexs/decompiler/flash/gui/MainFrameMenu.java +++ b/src/com/jpexs/decompiler/flash/gui/MainFrameMenu.java @@ -17,7 +17,6 @@ package com.jpexs.decompiler.flash.gui; import com.jpexs.debugger.flash.DebuggerCommands; -import com.jpexs.debugger.flash.messages.out.OutStepContinue; import com.jpexs.decompiler.flash.ApplicationInfo; import com.jpexs.decompiler.flash.SWF; import com.jpexs.decompiler.flash.SWFBundle; @@ -29,7 +28,6 @@ import com.jpexs.decompiler.flash.gui.helpers.CheckResources; import com.jpexs.decompiler.flash.tags.ABCContainerTag; import com.jpexs.helpers.ByteArrayRange; import com.jpexs.helpers.Cache; -import com.jpexs.helpers.CancellableWorker; import com.jpexs.helpers.Helper; import com.jpexs.helpers.utf8.Utf8Helper; import com.sun.jna.Platform; @@ -44,21 +42,15 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.KeyEvent; import java.awt.event.WindowEvent; -import java.io.BufferedOutputStream; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; import java.io.IOException; -import java.io.OutputStream; import java.io.PrintStream; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Timer; import java.util.TimerTask; -import java.util.concurrent.atomic.AtomicBoolean; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.AbstractButton; @@ -79,6 +71,7 @@ public abstract class MainFrameMenu implements MenuBuilder { private KeyEventDispatcher keyEventDispatcher; private SWF swf; + protected final Map menuHotkeys = new HashMap<>(); @Override @@ -326,26 +319,6 @@ public abstract class MainFrameMenu implements MenuBuilder { return false; } - protected void restoreControlFlow(ActionEvent evt) { - if (Main.isWorking()) { - return; - } - - restoreControlFlow(false); - } - - protected void restoreControlFlowAll(ActionEvent evt) { - if (Main.isWorking()) { - return; - } - - restoreControlFlow(true); - } - - protected void restoreControlFlow(boolean all) { - mainFrame.getPanel().restoreControlFlow(all); - } - protected void showProxyActionPerformed(ActionEvent evt) { if (Main.isWorking()) { return; diff --git a/src/com/jpexs/decompiler/flash/gui/MainPanel.java b/src/com/jpexs/decompiler/flash/gui/MainPanel.java index 0932db1c6..2c7fefdc0 100644 --- a/src/com/jpexs/decompiler/flash/gui/MainPanel.java +++ b/src/com/jpexs/decompiler/flash/gui/MainPanel.java @@ -23,7 +23,6 @@ import com.jpexs.decompiler.flash.SWF; import com.jpexs.decompiler.flash.SWFBundle; import com.jpexs.decompiler.flash.SWFSourceInfo; import com.jpexs.decompiler.flash.abc.ABC; -import com.jpexs.decompiler.flash.abc.ClassPath; import com.jpexs.decompiler.flash.abc.RenameType; import com.jpexs.decompiler.flash.abc.ScriptPack; import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool; @@ -84,7 +83,6 @@ import com.jpexs.decompiler.flash.gui.controls.JPersistentSplitPane; import com.jpexs.decompiler.flash.gui.dumpview.DumpTree; import com.jpexs.decompiler.flash.gui.dumpview.DumpTreeModel; import com.jpexs.decompiler.flash.gui.dumpview.DumpViewPanel; -import com.jpexs.decompiler.flash.gui.editor.LineMarkedEditorPane; import com.jpexs.decompiler.flash.gui.helpers.ObservableList; import com.jpexs.decompiler.flash.gui.player.FlashPlayerPanel; import com.jpexs.decompiler.flash.gui.tagtree.TagTree; @@ -142,7 +140,6 @@ import com.jpexs.decompiler.flash.types.MATRIX; import com.jpexs.decompiler.flash.types.RECT; import com.jpexs.decompiler.flash.types.sound.SoundFormat; import com.jpexs.decompiler.flash.xfl.FLAVersion; -import com.jpexs.decompiler.graph.DottedChain; import com.jpexs.helpers.CancellableWorker; import com.jpexs.helpers.Helper; import com.jpexs.helpers.Path; @@ -2275,47 +2272,6 @@ public final class MainPanel extends JPanel implements TreeSelectionListener, Se } } - public void restoreControlFlow(final boolean all) { - if ((!all) || confirmExperimental()) { - new CancellableWorker() { - @Override - protected Void doInBackground() throws Exception { - ABCPanel abcPanel = getABCPanel(); - if (all) { - for (ABCContainerTag tag : abcPanel.getAbcList()) { - tag.getABC().restoreControlFlow(); - } - } else { - ABC abc = abcPanel.abc; - int bi = abcPanel.detailPanel.methodTraitPanel.methodCodePanel.getBodyIndex(); - if (bi != -1) { - abc.bodies.get(bi).restoreControlFlow(abc.constants, abcPanel.decompiledTextArea.getCurrentTrait(), abc.method_info.get(abc.bodies.get(bi).method_info)); - } - - abcPanel.detailPanel.methodTraitPanel.methodCodePanel.setBodyIndex(bi, abc, abcPanel.decompiledTextArea.getCurrentTrait(), abcPanel.detailPanel.methodTraitPanel.methodCodePanel.getScriptIndex()); - } - return null; - } - - @Override - protected void onStart() { - Main.startWork(translate("work.restoringControlFlow"), this); - } - - @Override - protected void done() { - View.execInEventDispatch(() -> { - Main.stopWork(); - View.showMessageDialog(null, translate("work.restoringControlFlow.complete")); - - getABCPanel().reload(); - updateClassesList(); - }); - } - }.execute(); - } - } - public void renameIdentifiers(final SWF swf) { if (swf == null) { return; diff --git a/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog.properties b/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog.properties index 1dd334940..a5b48e386 100644 --- a/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog.properties +++ b/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog.properties @@ -263,9 +263,6 @@ config.description.lzmaFastBytes = Fast bytes parameter of the LZMA encoder config.name.pluginPath = Plugin Path config.description.pluginPath = - -config.name.deobfuscationMode = Deobfuscation mode -config.description.deobfuscationMode = Run deobfuscation on every file before ActionScript decompilation - config.name.showMethodBodyId = Show method body id config.description.showMethodBodyId = Shows the id of the methodbody for commandline import @@ -362,9 +359,6 @@ config.description.swfSpecificConfigs = Contains the SWF specific configurations config.name.exeExportMode = EXE export mode config.description.exeExportMode = EXE export mode -config.name.deobfuscationOldMode = Switch deobfuscation to old (5.x) mode -config.description.deobfuscationOldMode = Disable new deobfuscation and use the old one from previous versions. NOT RECOMMENDED. - config.name.ignoreCLikePackages = Ignore FlashCC / Alchemy or similar packages config.description.ignoreCLikePackages = FlashCC/Alchemy packages cannot usually be decompiled correctly. You can disable them to speedup other packages decompilation. diff --git a/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog_ca.properties b/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog_ca.properties index 58ac0d655..efdadb8e7 100644 --- a/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog_ca.properties +++ b/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog_ca.properties @@ -263,9 +263,6 @@ config.description.lzmaFastBytes = Par\u00e0metre de bytes r\u00e0pids del codif config.name.pluginPath = Cam\u00ed de l'Extensi\u00f3 config.description.pluginPath = - -config.name.deobfuscationMode = Mode de desofuscaci\u00f3 -config.description.deobfuscationMode = Executa la desofuscaci\u00f3 a cada fitxer abans de la descompilaci\u00f3 d'ActionScript - config.name.showMethodBodyId = Mostra l'id del methodbody config.description.showMethodBodyId = Mostra l'identificador del methodbody per a importaci\u00f3 de l\u00ednia d'ordres diff --git a/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog_cs.properties b/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog_cs.properties index d3477c38c..3adba5575 100644 --- a/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog_cs.properties +++ b/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog_cs.properties @@ -263,9 +263,6 @@ config.description.lzmaFastBytes = Parametr fast bytes LZMA enkoderu config.name.pluginPath = Plugin Path config.description.pluginPath = - -config.name.deobfuscationMode = M\u00f3d deobfuskace -config.description.deobfuscationMode = Typ deobfuskace - config.name.showMethodBodyId = Zobrazovat id body metod config.description.showMethodBodyId = Zobrazuje id body metody pro import p\u0159es p\u0159\u00edkazovou \u0159\u00e1dku diff --git a/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog_es.properties b/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog_es.properties index 924845565..5e5853643 100644 --- a/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog_es.properties +++ b/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog_es.properties @@ -263,9 +263,6 @@ config.description.lzmaFastBytes = Par\u00e1metro de bytes r\u00e1pidos del codi config.name.pluginPath = Directorio de Plugin config.description.pluginPath = - -config.name.deobfuscationMode = Deobfuscation mode -config.description.deobfuscationMode = Ejecutar desofuscaci\u00f3n en cada archivo antes de la decompilaci\u00f3n de ActionScript - config.name.showMethodBodyId = Mostrar identificador el cuerpo del m\u00e9todo config.description.showMethodBodyId = Mostrar el identificador del methodbody para la importaci\u00f3n de linea de comandos @@ -362,9 +359,6 @@ config.description.swfSpecificConfigs = Contiene las configuraciones espec\u00ed config.name.exeExportMode = Modo de exportaci\u00f3n de EXE config.description.exeExportMode = Modo de exportaci\u00f3n de EXE -config.name.deobfuscationOldMode = Cambiar desofuscaci\u00f3n al viejo modo (5.x) -config.description.deobfuscationOldMode = Deshabilitar la nueva desofuscaci\u00f3n y utilizar la vieja de versiones anteriores. NO RECOMENDADO. - config.name.ignoreCLikePackages = Ignorar paquetes FlashCC / Alchemy o similares config.description.ignoreCLikePackages = Los paquetes FlashCC/Alchemy usualmente no pueden ser decompilados correctamente. Puede deshabilitarlos para acelerar la decompilaci\u00f3n de otros paquetes. diff --git a/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog_fr.properties b/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog_fr.properties index 001003154..5dc1d24b4 100644 --- a/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog_fr.properties +++ b/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog_fr.properties @@ -263,9 +263,6 @@ config.description.lzmaFastBytes = Param\u00e8tre vitesse des octets de l'encode config.name.pluginPath = Plugin Path config.description.pluginPath = - -config.name.deobfuscationMode = Mode de d\u00e9sobfuscation -config.description.deobfuscationMode = D\u00e9marrer la d\u00e9sobfuscation pour chaque fichiers avant la d\u00e9compilation ActionScript - config.name.showMethodBodyId = Afficher l'identifiant dans le corps de texte config.description.showMethodBodyId = Afficher l'identifiant dans le corps de la m\u00e9thode lors de l'importation en ligne de commande diff --git a/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog_hu.properties b/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog_hu.properties index ebce28516..72251492c 100644 --- a/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog_hu.properties +++ b/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog_hu.properties @@ -263,9 +263,6 @@ config.description.lzmaFastBytes = Az LZMA t\u00f6m\u00f6r\u00edt\u0151 "Fast by config.name.pluginPath = Plugin Path config.description.pluginPath = - -config.name.deobfuscationMode = Deobfuszk\u00e1l\u00e1si m\u00f3d -config.description.deobfuscationMode = Futtassa a deobfuszk\u00e1l\u00e1st minden f\u00e1jlon az ActionScript visszaford\u00edt\u00e1sa el\u0151tt - config.name.showMethodBodyId = Method body azonos\u00edt\u00f3 mutat\u00e1sa config.description.showMethodBodyId = Megmutatja a methodbody azonos\u00edt\u00f3t a parancssori import\u00e1l\u00e1shoz @@ -362,9 +359,6 @@ config.description.swfSpecificConfigs = Az SWF specifikus be\u00e1llt\u00e1sokat config.name.exeExportMode = EXE export m\u00f3d config.description.exeExportMode = EXE export m\u00f3d -config.name.deobfuscationOldMode = Kapcsol\u00f3 a r\u00e9gi (5.x) deobfuszk\u00e1l\u00e1si m\u00f3d haszn\u00e1lat\u00e1hoz -config.description.deobfuscationOldMode = Kikapcsolja az \u00faj deobfuszk\u00e1l\u00e1si m\u00f3dot \u00e9s az el\u0151z\u0151 verzi\u00f3kban l\u00e9v\u0151 m\u00f3dot haszn\u00e1lja. NEM AJ\u00c1NLOTT. - config.name.ignoreCLikePackages = FlashCC / Alchemy vagy hasonl\u00f3 csomagok figyelmen k\u00edv\u00fcl hagy\u00e1sa config.description.ignoreCLikePackages = FlashCC/Alchemy csomagok \u00e1ltal\u00e1ban nem ford\u00edthat\u00f3ak vissza hib\u00e1tlanul. Kikapcsolhatod hogy gyorsabban visszaford\u00edtsa a t\u00f6bbi csomagot. diff --git a/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog_it.properties b/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog_it.properties index d3e3af331..9497d1c43 100644 --- a/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog_it.properties +++ b/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog_it.properties @@ -263,9 +263,6 @@ config.description.lzmaFastBytes = Parametro byte veloci del codificatore LZMA config.name.pluginPath = Percorso Plugin config.description.pluginPath = - -config.name.deobfuscationMode = Modalit\u00e0 di deoffuscamento -config.description.deobfuscationMode = Esegui deoffuscamento su ogni file prima della decompilazione ActionScript - config.name.showMethodBodyId = Mostra id corpo del metodo config.description.showMethodBodyId = Mostra id del corpo del metodo per importazione da riga di comando @@ -362,9 +359,6 @@ config.description.swfSpecificConfigs = Contiene le configurazioni specifiche ag config.name.exeExportMode = Modalit\u00e0 di esportazione EXE config.description.exeExportMode = Modalit\u00e0 di esportazione EXE -config.name.deobfuscationOldMode = Passa alla vecchia modalit\u00e0 di deoffuscamento (5.x) -config.description.deobfuscationOldMode = Disabilita il nuovo deoffuscamento ed utilizza quello delle versioni precedenti. SCONSIGLIATO. - config.name.ignoreCLikePackages = Ignora FlashCC / Alchimia o package simili config.description.ignoreCLikePackages = I package FlashCC / Alchimia non possono solitamente essere decompilati correttamente.\r\n\u00c8 possibile disattivarli per velocizzare la decompilazione di altri package. diff --git a/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog_pl.properties b/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog_pl.properties index d82063894..482ef752c 100644 --- a/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog_pl.properties +++ b/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog_pl.properties @@ -265,6 +265,3 @@ config.description.showMethodBodyId = Pokazuje id korpusu metody dla importu lin config.name.pluginPath = Plugin Path config.description.pluginPath = - - -config.name.deobfuscationMode = Deobfuscation mode -config.description.deobfuscationMode = Run deobfuscation on every file before ActionScript decompilation \ No newline at end of file diff --git a/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog_sv.properties b/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog_sv.properties index 15740b5be..4a81a319a 100644 --- a/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog_sv.properties +++ b/src/com/jpexs/decompiler/flash/gui/locales/AdvancedSettingsDialog_sv.properties @@ -263,9 +263,6 @@ config.description.lzmaFastBytes = Snabb bytes parameter av LZMA kodare config.name.pluginPath = Plugin S\u00f6kv\u00e4g config.description.pluginPath = - -config.name.deobfuscationMode = Deobfuscation mode -config.description.deobfuscationMode = K\u00f6r deobfuskering p\u00e5 alla filer innan ActionSctipt dekompilering - config.name.showMethodBodyId = Visa metod kropps id config.description.showMethodBodyId = Visar id:t utav methodbody f\u00f6r commandline importering