mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-06-14 18:44:25 +00:00
Merge origin/master
This commit is contained in:
@@ -2341,7 +2341,7 @@ public final class SWF implements SWFContainerItem, Timelined {
|
||||
public static ActionList getCachedActionList(ASMSource src, final List<DisassemblyListener> 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);
|
||||
|
||||
@@ -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<Integer> getNsStringUsages() {
|
||||
Set<Integer> ret = new HashSet<>();
|
||||
for (int n = 1; n < constants.getNamespaceCount(); n++) {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -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<Object> replaceWith;
|
||||
|
||||
@Override
|
||||
public void translate(BaseLocalData localData, TranslateStack stack, List<GraphTargetItem> 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<Integer> 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;
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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<DottedChain> fullyQualifiedNames, int methodIndex) {
|
||||
public NewFunctionAVM2Item(GraphSourceItem instruction, GraphSourceItem lineStartIns, String functionName, String path, boolean isStatic, int scriptIndex, int classIndex, ABC abc, List<DottedChain> 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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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<ABC> otherAbcs) {
|
||||
try {
|
||||
initPlayer();
|
||||
} catch (IOException | InterruptedException ex) {
|
||||
public ActionScript3Parser(ABC abc, List<ABC> otherAbcs) throws IOException, InterruptedException {
|
||||
initPlayer();
|
||||
|
||||
}
|
||||
abcIndex = new AbcIndexing(playerGlobalAbcIndex);
|
||||
for (ABC a : otherAbcs) {
|
||||
abcIndex.addAbc(a);
|
||||
|
||||
@@ -32,6 +32,6 @@ public class ConvertData {
|
||||
public Map<TraitSlotConst, AssignedValue> assignedValues = new HashMap<>();
|
||||
|
||||
public ConvertData() {
|
||||
deobfuscationMode = Configuration.autoDeobfuscate.get() ? (Configuration.deobfuscationOldMode.get() ? 0 : 1) : -1;
|
||||
deobfuscationMode = Configuration.autoDeobfuscate.get() ? 1 : 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<Integer, String> 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<DottedChain> fullyQualifiedNames, List<Traits> 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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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<GraphTargetItem> 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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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<DisassemblyListener> 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<Action> retMap = new ArrayList<>(endIp);
|
||||
for (int i = 0; i < endIp; i++) {
|
||||
retMap.add(null);
|
||||
}
|
||||
List<Action> 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<DisassemblyListener> listeners, List<GraphTargetItem> output, HashMap<Long, List<GraphSourceItemContainer>> containers, ActionLocalData localData, TranslateStack stack, ConstantPool cpool, List<Action> actions, int ip, List<Action> ret, int startIp, int endip, String path, Map<Integer, Integer> visited, boolean indeterminate, Map<Integer, HashMap<String, GraphTargetItem>> 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<String, GraphTargetItem> 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<String, GraphTargetItem> 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<List<GraphTargetItem>> output2s = new ArrayList<>();
|
||||
for (long size : cnt.getContainerSizes()) {
|
||||
if (size == 0) {
|
||||
output2s.add(new ArrayList<>());
|
||||
continue;
|
||||
}
|
||||
ActionLocalData localData2;
|
||||
List<GraphTargetItem> 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<String, GraphTargetItem> vars = localData.variables;
|
||||
boolean stateChanged = false;
|
||||
if (decisionStates.containsKey(ip)) {
|
||||
HashMap<String, GraphTargetItem> 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<String, GraphTargetItem> curstate = new HashMap<>();
|
||||
curstate.putAll(vars);
|
||||
decisionStates.put(ip, curstate);
|
||||
|
||||
if ((!stateChanged) && curVisited > 1) {
|
||||
List<Integer> 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) {//<curVisited){
|
||||
ip = br;
|
||||
continue loopip;
|
||||
}
|
||||
}
|
||||
break loopip;
|
||||
}
|
||||
|
||||
TranslateStack subStack = (TranslateStack) stack.clone();
|
||||
ActionLocalData subLocalData = new ActionLocalData(new HashMap<>(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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<String> constantPool;
|
||||
|
||||
public List<Integer> 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<GraphTargetItem> output, HashMap<Integer, String> regNames, HashMap<String, GraphTargetItem> variables, HashMap<String, GraphTargetItem> 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;
|
||||
|
||||
@@ -92,10 +92,6 @@ public class Configuration {
|
||||
@ConfigurationCategory("script")
|
||||
public static final ConfigurationItem<Boolean> autoDeobfuscate = null;
|
||||
|
||||
@ConfigurationDefaultBoolean(false)
|
||||
@ConfigurationCategory("")
|
||||
public static final ConfigurationItem<Boolean> deobfuscationOldMode = null;
|
||||
|
||||
@ConfigurationDefaultBoolean(false)
|
||||
@ConfigurationCategory("")
|
||||
public static final ConfigurationItem<Boolean> cacheOnDisk = null;
|
||||
@@ -262,6 +258,7 @@ public class Configuration {
|
||||
|
||||
public static final ConfigurationItem<HashMap<String, SwfSpecificConfiguration>> swfSpecificConfigs = null;
|
||||
|
||||
@ConfigurationDefaultCalendar(0)
|
||||
public static final ConfigurationItem<Calendar> 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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
@@ -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<DumpInfo>() {
|
||||
|
||||
@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) {
|
||||
|
||||
@@ -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<GraphPart> ret, List<Loop> loops, boolean first) {
|
||||
|
||||
// todo: honfika: why call with first = true parameter always?
|
||||
Stack<GraphPartQueue> stack = new Stack<>();
|
||||
GraphPartQueue queue = new GraphPartQueue();
|
||||
queue.add(part);
|
||||
@@ -386,77 +383,6 @@ public class Graph {
|
||||
}
|
||||
}
|
||||
|
||||
private void getReachablePartsOld(GraphPart part, LinkedHashSet<GraphPart> ret, List<Loop> 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<GraphPart> 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<Loop> loops) {
|
||||
return getNextCommonPart(part, new ArrayList<GraphPart>(),loops);
|
||||
}*/
|
||||
public GraphPart getNextCommonPart(BaseLocalData localData, GraphPart part, List<Loop> loops) throws InterruptedException {
|
||||
return getCommonPart(localData, part.nextParts, loops);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
@@ -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<String, HotKey> 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;
|
||||
|
||||
@@ -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<Void>() {
|
||||
@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;
|
||||
|
||||
@@ -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.
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user