mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-09-26 21:30:46 +00:00
Print SafeStr list at the bottom (AS3)
This commit is contained in:
@@ -20,6 +20,7 @@ import com.jpexs.decompiler.graph.GraphPart;
|
||||
import com.jpexs.decompiler.graph.GraphSourceItem;
|
||||
import com.jpexs.decompiler.graph.SecondPassData;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
@@ -48,6 +49,11 @@ public abstract class BaseLocalData {
|
||||
* SWF version
|
||||
*/
|
||||
public int swfVersion = -1;
|
||||
|
||||
/**
|
||||
* Used deobfuscations
|
||||
*/
|
||||
public Set<String> usedDeobfuscations = new LinkedHashSet<>();
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
|
||||
@@ -31,6 +31,7 @@ import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
@@ -539,13 +540,15 @@ public class IdentifiersDeobfuscation {
|
||||
/**
|
||||
* Ensures identifier is valid and if not, uses paragraph syntax.
|
||||
*
|
||||
* @param swf SWF
|
||||
* @param used Set of used obfuscated identifiers in this script - the method will add to it
|
||||
* @param as3 Is ActionScript3
|
||||
* @param s Identifier
|
||||
* @param validExceptions Exceptions which are valid (e.g. some reserved
|
||||
* words)
|
||||
* @return Printable identifier
|
||||
*/
|
||||
public static String printIdentifier(SWF swf, boolean as3, String s, String... validExceptions) {
|
||||
public static String printIdentifier(SWF swf, Set<String> used, boolean as3, String s, String... validExceptions) {
|
||||
if (s == null || s.isEmpty()) {
|
||||
return "";
|
||||
}
|
||||
@@ -553,6 +556,7 @@ public class IdentifiersDeobfuscation {
|
||||
if (Configuration.useSafeStr.get() && as3) {
|
||||
Map<String, String> map = swf.getAs3ObfuscatedIdentifiers();
|
||||
if (map.containsKey(s)) {
|
||||
used.add(s);
|
||||
return map.get(s);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3367,7 +3367,7 @@ public final class SWF implements SWFContainerItem, Timelined, Openable {
|
||||
}
|
||||
return String.join(File.separator, parts);
|
||||
}
|
||||
return DottedChain.parseNoSuffix(pkg.getName()).toPrintableString(this, false);
|
||||
return DottedChain.parseNoSuffix(pkg.getName()).toPrintableString(new LinkedHashSet<>(), this, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3378,7 +3378,7 @@ public final class SWF implements SWFContainerItem, Timelined, Openable {
|
||||
String expName = tag.getSwf().getExportName(tag.getCharacterId());
|
||||
if (expName != null && !expName.isEmpty()) {
|
||||
String[] pathParts = expName.contains(".") ? expName.split("\\.") : new String[]{expName};
|
||||
return IdentifiersDeobfuscation.printIdentifier(this, false, pathParts[pathParts.length - 1]);
|
||||
return IdentifiersDeobfuscation.printIdentifier(this, new LinkedHashSet<>(), false, pathParts[pathParts.length - 1]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3717,7 +3717,7 @@ public final class SWF implements SWFContainerItem, Timelined, Openable {
|
||||
GraphSourceItem ins = code.get(ip);
|
||||
|
||||
if (debugMode) {
|
||||
System.err.println("Visit " + ip + ": ofs" + Helper.formatAddress(((Action) ins).getAddress()) + ":" + ((Action) ins).getASMSource(new ActionList(code.getCharset()), new HashSet<>(), ScriptExportMode.PCODE) + " stack:" + Helper.stackToString(stack, LocalData.create(new ConstantPool(), swf)));
|
||||
System.err.println("Visit " + ip + ": ofs" + Helper.formatAddress(((Action) ins).getAddress()) + ":" + ((Action) ins).getASMSource(new ActionList(code.getCharset()), new HashSet<>(), ScriptExportMode.PCODE) + " stack:" + Helper.stackToString(stack, LocalData.create(new ConstantPool(), swf, new LinkedHashSet<>())));
|
||||
}
|
||||
if (ins.isExit()) {
|
||||
break;
|
||||
@@ -3881,7 +3881,7 @@ public final class SWF implements SWFContainerItem, Timelined, Openable {
|
||||
* @throws InterruptedException On interrupt
|
||||
*/
|
||||
private static void getVariables(SWF swf, boolean insideDoInitAction, List<MyEntry<DirectValueActionItem, ConstantPool>> variables, List<GraphSourceItem> functions, HashMap<DirectValueActionItem, ConstantPool> strings, HashMap<DirectValueActionItem, String> usageTypes, ActionGraphSource code, int addr, String path) throws InterruptedException {
|
||||
ActionLocalData localData = new ActionLocalData(null, insideDoInitAction, new HashMap<>() /*??*/);
|
||||
ActionLocalData localData = new ActionLocalData(null, insideDoInitAction, new HashMap<>() /*??*/, new LinkedHashSet<>());
|
||||
getVariables(swf, null, localData, new TranslateStack(path), new ArrayList<>(), code, code.adr2pos(addr), variables, functions, strings, new ArrayList<>(), usageTypes, path);
|
||||
}
|
||||
|
||||
@@ -4176,7 +4176,7 @@ public final class SWF implements SWFContainerItem, Timelined, Openable {
|
||||
int staticOperation = 0;
|
||||
List<GraphTargetItem> dec;
|
||||
try {
|
||||
dec = Action.actionsToTree(false, new HashMap<>() /*??*/, true /*Yes, inside doInitAction*/, false, dia.getActions(), version, staticOperation, ""/*FIXME*/, getCharset());
|
||||
dec = Action.actionsToTree(new LinkedHashSet<>(), false, new HashMap<>() /*??*/, true /*Yes, inside doInitAction*/, false, dia.getActions(), version, staticOperation, ""/*FIXME*/, getCharset());
|
||||
} catch (EmptyStackException ex) {
|
||||
continue;
|
||||
}
|
||||
@@ -5982,10 +5982,10 @@ public final class SWF implements SWFContainerItem, Timelined, Openable {
|
||||
if (firstTrait instanceof TraitClass) {
|
||||
int cindex = ((TraitClass) firstTrait).class_info;
|
||||
Multiname superName = documentPack.abc.constants.getMultiname(documentPack.abc.instance_info.get(cindex).super_index);
|
||||
String parentClass = superName.getNameWithNamespace(documentPack.abc, documentPack.abc.constants, true).toRawString();
|
||||
String parentClass = superName.getNameWithNamespace(new LinkedHashSet<>(), documentPack.abc, documentPack.abc.constants, true).toRawString();
|
||||
if ("mx.managers.SystemManager".equals(parentClass)) {
|
||||
for (Trait t : documentPack.abc.instance_info.get(cindex).instance_traits.traits) {
|
||||
if ((t instanceof TraitMethodGetterSetter) && "info".equals(t.getName(documentPack.abc).getName(documentPack.abc, documentPack.abc.constants, new ArrayList<>(), true, true))) {
|
||||
if ((t instanceof TraitMethodGetterSetter) && "info".equals(t.getName(documentPack.abc).getName(new LinkedHashSet<>(), documentPack.abc, documentPack.abc.constants, new ArrayList<>(), true, true))) {
|
||||
|
||||
int mi = ((TraitMethodGetterSetter) t).method_info;
|
||||
try {
|
||||
@@ -5995,7 +5995,7 @@ public final class SWF implements SWFContainerItem, Timelined, Openable {
|
||||
if (documentPack.getOpenable() instanceof SWF) {
|
||||
swfVersion = ((SWF) documentPack.getOpenable()).version;
|
||||
}
|
||||
documentPack.abc.findBody(mi).convert(swfVersion, callStack, getAbcIndex(), new ConvertData(), "??", ScriptExportMode.AS, true, mi, documentPack.scriptIndex, cindex, documentPack.abc, t, new ScopeStack(), 0, new NulWriter(), new ArrayList<>(), new Traits(), true, new HashSet<>(), new ArrayList<>());
|
||||
documentPack.abc.findBody(mi).convert(swfVersion, callStack, getAbcIndex(), new ConvertData(), "??", ScriptExportMode.AS, true, mi, documentPack.scriptIndex, cindex, documentPack.abc, t, new ScopeStack(), 0, new NulWriter(), new ArrayList<>(), new Traits(), true, new HashSet<>(), new ArrayList<>(), new LinkedHashSet<>());
|
||||
List<GraphTargetItem> infos = documentPack.abc.findBody(mi).convertedItems;
|
||||
if (!infos.isEmpty()) {
|
||||
if (infos.get(0) instanceof IfItem) {
|
||||
@@ -6073,13 +6073,13 @@ public final class SWF implements SWFContainerItem, Timelined, Openable {
|
||||
int cinit = p.abc.class_info.get(ci).cinit_index;
|
||||
callStack = new ArrayList<>();
|
||||
callStack.add(p.abc.findBody(cinit));
|
||||
p.abc.findBody(cinit).convert(swfVersion, callStack, getAbcIndex(), new ConvertData(), "??", ScriptExportMode.AS, true, cinit, p.scriptIndex, cindex, p.abc, t, new ScopeStack(), 0, new NulWriter(), new ArrayList<>(), new Traits(), true, new HashSet<>(), new ArrayList<>());
|
||||
p.abc.findBody(cinit).convert(swfVersion, callStack, getAbcIndex(), new ConvertData(), "??", ScriptExportMode.AS, true, cinit, p.scriptIndex, cindex, p.abc, t, new ScopeStack(), 0, new NulWriter(), new ArrayList<>(), new Traits(), true, new HashSet<>(), new ArrayList<>(), new LinkedHashSet<>());
|
||||
List<GraphTargetItem> cinitBody = p.abc.findBody(cinit).convertedItems;
|
||||
for (GraphTargetItem cit : cinitBody) {
|
||||
if (cit instanceof SetPropertyAVM2Item) {
|
||||
if (cit.value instanceof GetLexAVM2Item) {
|
||||
GetLexAVM2Item gl = (GetLexAVM2Item) cit.value;
|
||||
ignoredClasses.add(gl.propertyName.getNameWithNamespace(p.abc, p.abc.constants, true).toRawString());
|
||||
ignoredClasses.add(gl.propertyName.getNameWithNamespace(new LinkedHashSet<>(), p.abc, p.abc.constants, true).toRawString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -782,7 +782,7 @@ public class ABC implements Openable {
|
||||
int mIndex = body.getCode().code.get(ip).operands[0];
|
||||
if (mIndex > 0 && mIndex < constants.getMultinameCount()) {
|
||||
Multiname m = constants.getMultiname(mIndex);
|
||||
if (m.getNameWithNamespace(this, constants, true).toRawString().equals("flash.utils.getDefinitionByName")) {
|
||||
if (m.getNameWithNamespace(new LinkedHashSet<>(), this, constants, true).toRawString().equals("flash.utils.getDefinitionByName")) {
|
||||
if (ip > 0) {
|
||||
if (body.getCode().code.get(ip - 1).definition instanceof PushStringIns) {
|
||||
int strIndex = body.getCode().code.get(ip - 1).operands[0];
|
||||
@@ -1352,7 +1352,7 @@ public class ABC implements Openable {
|
||||
*/
|
||||
public MethodBody findBodyClassInitializerByClass(String classNameWithSuffix) {
|
||||
for (int i = 0; i < instance_info.size(); i++) {
|
||||
if (classNameWithSuffix.equals(constants.getMultiname(instance_info.get(i).name_index).getName(this, constants, null, true, true))) {
|
||||
if (classNameWithSuffix.equals(constants.getMultiname(instance_info.get(i).name_index).getName(new LinkedHashSet<>(), this, constants, null, true, true))) {
|
||||
MethodBody body = findBody(class_info.get(i).cinit_index);
|
||||
if (body != null) {
|
||||
return body;
|
||||
@@ -1371,7 +1371,7 @@ public class ABC implements Openable {
|
||||
*/
|
||||
public MethodBody findBodyInstanceInitializerByClass(String classNameWithSuffix) {
|
||||
for (int i = 0; i < instance_info.size(); i++) {
|
||||
if (classNameWithSuffix.equals(constants.getMultiname(instance_info.get(i).name_index).getName(this, constants, null, true, true))) {
|
||||
if (classNameWithSuffix.equals(constants.getMultiname(instance_info.get(i).name_index).getName(new LinkedHashSet<>(), this, constants, null, true, true))) {
|
||||
MethodBody body = findBody(instance_info.get(i).iinit_index);
|
||||
if (body != null) {
|
||||
return body;
|
||||
@@ -1391,11 +1391,11 @@ public class ABC implements Openable {
|
||||
*/
|
||||
public MethodBody findBodyByClassAndName(String classNameWithSuffix, String methodNameWithSuffix) {
|
||||
for (int i = 0; i < instance_info.size(); i++) {
|
||||
if (classNameWithSuffix.equals(constants.getMultiname(instance_info.get(i).name_index).getName(this, constants, null, true, true))) {
|
||||
if (classNameWithSuffix.equals(constants.getMultiname(instance_info.get(i).name_index).getName(new LinkedHashSet<>(), this, constants, null, true, true))) {
|
||||
for (Trait t : instance_info.get(i).instance_traits.traits) {
|
||||
if (t instanceof TraitMethodGetterSetter) {
|
||||
TraitMethodGetterSetter t2 = (TraitMethodGetterSetter) t;
|
||||
if (methodNameWithSuffix.equals(t2.getName(this).getName(this, constants, null, true, true))) {
|
||||
if (methodNameWithSuffix.equals(t2.getName(this).getName(new LinkedHashSet<>(), this, constants, null, true, true))) {
|
||||
MethodBody body = findBody(t2.method_info);
|
||||
if (body != null) {
|
||||
return body;
|
||||
@@ -1407,7 +1407,7 @@ public class ABC implements Openable {
|
||||
for (Trait t : class_info.get(i).static_traits.traits) {
|
||||
if (t instanceof TraitMethodGetterSetter) {
|
||||
TraitMethodGetterSetter t2 = (TraitMethodGetterSetter) t;
|
||||
if (methodNameWithSuffix.equals(t2.getName(this).getName(this, constants, null, true, true))) {
|
||||
if (methodNameWithSuffix.equals(t2.getName(this).getName(new LinkedHashSet<>(), this, constants, null, true, true))) {
|
||||
MethodBody body = findBody(t2.method_info);
|
||||
if (body != null) {
|
||||
return body;
|
||||
@@ -1520,7 +1520,7 @@ public class ABC implements Openable {
|
||||
TraitSlotConst s = ((TraitSlotConst) t);
|
||||
if (s.isNamespace()) {
|
||||
String key = constants.getNamespace(s.value_index).getName(constants).toRawString(); // assume not null
|
||||
DottedChain val = constants.getMultiname(s.name_index).getNameWithNamespace(this, constants, true);
|
||||
DottedChain val = constants.getMultiname(s.name_index).getNameWithNamespace(new LinkedHashSet<>(), this, constants, true);
|
||||
map.put(key, val);
|
||||
}
|
||||
}
|
||||
@@ -1701,7 +1701,7 @@ public class ABC implements Openable {
|
||||
for (int multinameIndex = 1; multinameIndex < constants.getMultinameCount(); multinameIndex++) {
|
||||
Multiname m = constants.getMultiname(multinameIndex);
|
||||
if (m.kind == Multiname.QNAME || m.kind == Multiname.QNAMEA) {
|
||||
String name = m.getName(this, constants, new ArrayList<>(), true, false);
|
||||
String name = m.getName(new LinkedHashSet<>(), this, constants, new ArrayList<>(), true, false);
|
||||
List<Integer> indices = nameToQNameIndices.get(name);
|
||||
if (indices == null) {
|
||||
indices = new ArrayList<>();
|
||||
@@ -1772,7 +1772,7 @@ public class ABC implements Openable {
|
||||
if (classId > -1) {
|
||||
for (Trait t : instance_info.get(classId).instance_traits.traits) {
|
||||
if (t instanceof TraitMethodGetterSetter) {
|
||||
if (t.getName(this).getName(this, constants, null, true, true).equals(methodNameWithSuffix)) {
|
||||
if (t.getName(this).getName(new LinkedHashSet<>(), this, constants, null, true, true).equals(methodNameWithSuffix)) {
|
||||
return ((TraitMethodGetterSetter) t).method_info;
|
||||
}
|
||||
}
|
||||
@@ -1792,7 +1792,7 @@ public class ABC implements Openable {
|
||||
if (classId > -1) {
|
||||
for (Trait t : instance_info.get(classId).instance_traits.traits) {
|
||||
if (t instanceof TraitMethodGetterSetter) {
|
||||
if (t.getName(this).getName(this, constants, null, true, true).equals(methodNameWithSuffix)) {
|
||||
if (t.getName(this).getName(new LinkedHashSet<>(), this, constants, null, true, true).equals(methodNameWithSuffix)) {
|
||||
return findBodyIndex(((TraitMethodGetterSetter) t).method_info);
|
||||
}
|
||||
}
|
||||
@@ -1835,7 +1835,7 @@ public class ABC implements Openable {
|
||||
if (instance_info.get(c).deleted) {
|
||||
continue;
|
||||
}
|
||||
DottedChain s = constants.getMultiname(instance_info.get(c).name_index).getNameWithNamespace(this, constants, true);
|
||||
DottedChain s = constants.getMultiname(instance_info.get(c).name_index).getNameWithNamespace(new LinkedHashSet<>(), this, constants, true);
|
||||
if (nameWithSuffix.equals(s.toRawString())) {
|
||||
return c;
|
||||
}
|
||||
|
||||
@@ -297,6 +297,7 @@ public class AVM2LocalData extends BaseLocalData {
|
||||
seenMethods = localData.seenMethods;
|
||||
bottomSetLocals = localData.bottomSetLocals;
|
||||
swfVersion = localData.swfVersion;
|
||||
usedDeobfuscations = localData.usedDeobfuscations;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash.abc;
|
||||
import com.jpexs.decompiler.flash.SWF;
|
||||
import com.jpexs.decompiler.graph.DottedChain;
|
||||
import java.io.Serializable;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
@@ -70,7 +71,7 @@ public class ClassPath implements Serializable {
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
return packageStr.add(className, namespaceSuffix).toPrintableString(swf, true);
|
||||
return packageStr.add(className, namespaceSuffix).toPrintableString(new LinkedHashSet<>() /*???*/, swf, true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -50,6 +50,8 @@ import com.jpexs.decompiler.flash.treeitems.AS3ClassTreeItem;
|
||||
import com.jpexs.decompiler.flash.treeitems.Openable;
|
||||
import com.jpexs.decompiler.graph.DottedChain;
|
||||
import com.jpexs.decompiler.graph.ScopeStack;
|
||||
import com.jpexs.decompiler.graph.model.CommentItem;
|
||||
import com.jpexs.decompiler.graph.model.LocalData;
|
||||
import com.jpexs.helpers.CancellableWorker;
|
||||
import com.jpexs.helpers.Helper;
|
||||
import com.jpexs.helpers.Path;
|
||||
@@ -61,6 +63,7 @@ import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
@@ -73,6 +76,7 @@ import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import natorder.NaturalOrderComparator;
|
||||
|
||||
/**
|
||||
* Script pack class. A script pack is a collection of traits that are in the
|
||||
@@ -207,7 +211,7 @@ public class ScriptPack extends AS3ClassTreeItem {
|
||||
Multiname name = abc.script_info.get(scriptIndex).traits.traits.get(t).getName(abc);
|
||||
int nskind = name.getSimpleNamespaceKind(abc.constants);
|
||||
if ((nskind == Namespace.KIND_PACKAGE) || (nskind == Namespace.KIND_PACKAGE_INTERNAL)) {
|
||||
scriptName = name.getName(abc, abc.constants, null, false, true);
|
||||
scriptName = name.getName(new LinkedHashSet<>(), abc, abc.constants, null, false, true);
|
||||
}
|
||||
}
|
||||
return scriptName;
|
||||
@@ -247,6 +251,7 @@ public class ScriptPack extends AS3ClassTreeItem {
|
||||
/**
|
||||
* Converts the script pack.
|
||||
*
|
||||
* @param usedDeobfuscations Used deobfuscations
|
||||
* @param abcIndex Abc indexing
|
||||
* @param writer Writer
|
||||
* @param traits Traits
|
||||
@@ -255,7 +260,7 @@ public class ScriptPack extends AS3ClassTreeItem {
|
||||
* @param parallel Parallel
|
||||
* @throws InterruptedException On interrupt
|
||||
*/
|
||||
public void convert(AbcIndexing abcIndex, final NulWriter writer, final List<Trait> traits, final ConvertData convertData, final ScriptExportMode exportMode, final boolean parallel) throws InterruptedException {
|
||||
public void convert(Set<String> usedDeobfuscations, AbcIndexing abcIndex, final NulWriter writer, final List<Trait> traits, final ConvertData convertData, final ScriptExportMode exportMode, final boolean parallel) throws InterruptedException {
|
||||
|
||||
int swfVersion = -1;
|
||||
if (getOpenable() instanceof SWF) {
|
||||
@@ -274,7 +279,7 @@ public class ScriptPack extends AS3ClassTreeItem {
|
||||
writer.mark();
|
||||
List<MethodBody> callStack = new ArrayList<>();
|
||||
callStack.add(abc.bodies.get(sinit_bodyIndex));
|
||||
abc.bodies.get(sinit_bodyIndex).convert(swfVersion, callStack, abcIndex, convertData, path + "/.scriptinitializer", exportMode, true, sinit_index, scriptIndex, -1, abc, null, new ScopeStack(), GraphTextWriter.TRAIT_SCRIPT_INITIALIZER, writer, new ArrayList<>(), abc.script_info.get(scriptIndex).traits, true, new HashSet<>(), initClasses);
|
||||
abc.bodies.get(sinit_bodyIndex).convert(swfVersion, callStack, abcIndex, convertData, path + "/.scriptinitializer", exportMode, true, sinit_index, scriptIndex, -1, abc, null, new ScopeStack(), GraphTextWriter.TRAIT_SCRIPT_INITIALIZER, writer, new ArrayList<>(), abc.script_info.get(scriptIndex).traits, true, new HashSet<>(), initClasses, usedDeobfuscations);
|
||||
scriptInitializerIsEmpty = !writer.getMark();
|
||||
|
||||
}
|
||||
@@ -286,9 +291,9 @@ public class ScriptPack extends AS3ClassTreeItem {
|
||||
Multiname name = trait.getName(abc);
|
||||
int nskind = name.getSimpleNamespaceKind(abc.constants);
|
||||
if ((nskind == Namespace.KIND_PACKAGE) || (nskind == Namespace.KIND_PACKAGE_INTERNAL)) {
|
||||
trait.convertPackaged(swfVersion, abcIndex, null, convertData, "", abc, false, exportMode, scriptIndex, -1, writer, new ArrayList<>(), parallel, scopeStack);
|
||||
trait.convertPackaged(usedDeobfuscations, swfVersion, abcIndex, null, convertData, "", abc, false, exportMode, scriptIndex, -1, writer, new ArrayList<>(), parallel, scopeStack);
|
||||
} else {
|
||||
trait.convert(swfVersion, abcIndex, null, convertData, "", abc, false, exportMode, scriptIndex, -1, writer, new ArrayList<>(), parallel, scopeStack);
|
||||
trait.convert(usedDeobfuscations, swfVersion, abcIndex, null, convertData, "", abc, false, exportMode, scriptIndex, -1, writer, new ArrayList<>(), parallel, scopeStack);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -296,6 +301,7 @@ public class ScriptPack extends AS3ClassTreeItem {
|
||||
/**
|
||||
* Append script to writer.
|
||||
*
|
||||
* @param usedDeobfuscations Used deobfuscations
|
||||
* @param abcIndex Abc indexing
|
||||
* @param writer Writer
|
||||
* @param traits Traits
|
||||
@@ -306,7 +312,8 @@ public class ScriptPack extends AS3ClassTreeItem {
|
||||
* class
|
||||
* @throws InterruptedException On interrupt
|
||||
*/
|
||||
private void appendTo(AbcIndexing abcIndex, GraphTextWriter writer, List<Trait> traits, ConvertData convertData, ScriptExportMode exportMode, boolean parallel, boolean exportAllClasses) throws InterruptedException {
|
||||
@SuppressWarnings("unchecked")
|
||||
private void appendTo(Set<String> usedDeobfuscations, AbcIndexing abcIndex, GraphTextWriter writer, List<Trait> traits, ConvertData convertData, ScriptExportMode exportMode, boolean parallel, boolean exportAllClasses) throws InterruptedException {
|
||||
|
||||
int swfVersion = -1;
|
||||
if (getOpenable() instanceof SWF) {
|
||||
@@ -325,7 +332,7 @@ public class ScriptPack extends AS3ClassTreeItem {
|
||||
continue;
|
||||
}
|
||||
|
||||
String fullName = t.getName(abc).getNameWithNamespace(abc, abc.constants, false).toPrintableString(abc.getSwf(), true);
|
||||
String fullName = t.getName(abc).getNameWithNamespace(usedDeobfuscations, abc, abc.constants, false).toPrintableString(usedDeobfuscations, abc.getSwf(), true);
|
||||
writer.appendNoHilight("include \"" + fullName.replace(".", "/") + ".as\";").newLine();
|
||||
}
|
||||
writer.newLine();
|
||||
@@ -355,7 +362,7 @@ public class ScriptPack extends AS3ClassTreeItem {
|
||||
writer.newLine();
|
||||
}
|
||||
writer.startTrait(traitIndicesList.get(t));
|
||||
trait.toStringPackaged(swfVersion, abcIndex, null, convertData, "", abc, false, exportMode, scriptIndex, -1, writer, fullyQualifiedNames, parallel, false);
|
||||
trait.toStringPackaged(usedDeobfuscations, swfVersion, abcIndex, null, convertData, "", abc, false, exportMode, scriptIndex, -1, writer, fullyQualifiedNames, parallel, false);
|
||||
|
||||
if (!(trait instanceof TraitClass)) {
|
||||
writer.endTrait();
|
||||
@@ -374,7 +381,7 @@ public class ScriptPack extends AS3ClassTreeItem {
|
||||
if (isSimple) {
|
||||
ignorePackage = getPathPackage();
|
||||
}
|
||||
Trait.writeImports(traitList, script_init, abcIndex, scriptIndex, -1, true, abc, writer, ignorePackage, fullyQualifiedNames);
|
||||
Trait.writeImports(usedDeobfuscations, traitList, script_init, abcIndex, scriptIndex, -1, true, abc, writer, ignorePackage, fullyQualifiedNames);
|
||||
first = true;
|
||||
|
||||
for (int t = 0; t < traitList.size(); t++) {
|
||||
@@ -386,7 +393,7 @@ public class ScriptPack extends AS3ClassTreeItem {
|
||||
writer.newLine();
|
||||
}
|
||||
writer.startTrait(traitIndicesList.get(t));
|
||||
trait.toString(swfVersion, abcIndex, pkg, null, convertData, "", abc, false, exportMode, scriptIndex, -1, writer, new ArrayList<>(), parallel, false);
|
||||
trait.toString(usedDeobfuscations, swfVersion, abcIndex, pkg, null, convertData, "", abc, false, exportMode, scriptIndex, -1, writer, new ArrayList<>(), parallel, false);
|
||||
|
||||
if (!(trait instanceof TraitClass)) {
|
||||
writer.endTrait();
|
||||
@@ -417,9 +424,9 @@ public class ScriptPack extends AS3ClassTreeItem {
|
||||
Multiname name = trait.getName(abc);
|
||||
int nskind = name.getSimpleNamespaceKind(abc.constants);
|
||||
if ((nskind == Namespace.KIND_PACKAGE) || (nskind == Namespace.KIND_PACKAGE_INTERNAL)) {
|
||||
trait.toStringPackaged(swfVersion, abcIndex, null, convertData, "", abc, false, exportMode, scriptIndex, -1, writer, new ArrayList<>(), parallel, false);
|
||||
trait.toStringPackaged(usedDeobfuscations, swfVersion, abcIndex, null, convertData, "", abc, false, exportMode, scriptIndex, -1, writer, new ArrayList<>(), parallel, false);
|
||||
} else {
|
||||
trait.toString(swfVersion, abcIndex, pkg, null, convertData, "", abc, false, exportMode, scriptIndex, -1, writer, new ArrayList<>(), parallel, false);
|
||||
trait.toString(usedDeobfuscations, swfVersion, abcIndex, pkg, null, convertData, "", abc, false, exportMode, scriptIndex, -1, writer, new ArrayList<>(), parallel, false);
|
||||
}
|
||||
writer.endTrait();
|
||||
first = false;
|
||||
@@ -436,7 +443,7 @@ public class ScriptPack extends AS3ClassTreeItem {
|
||||
if (!first) {
|
||||
writer.newLine();
|
||||
}
|
||||
abc.bodies.get(bodyIndex).toString(swfVersion, callStack, abcIndex, path + "/.scriptinitializer", exportMode, abc, null, writer, fullyQualifiedNames, new HashSet<>());
|
||||
abc.bodies.get(bodyIndex).toString(usedDeobfuscations, swfVersion, callStack, abcIndex, path + "/.scriptinitializer", exportMode, abc, null, writer, fullyQualifiedNames, new HashSet<>());
|
||||
} else {
|
||||
writer.append("");
|
||||
}
|
||||
@@ -458,6 +465,22 @@ public class ScriptPack extends AS3ClassTreeItem {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!usedDeobfuscations.isEmpty()) {
|
||||
writer.newLine();
|
||||
List<String> commentLines = new ArrayList<>();
|
||||
commentLines.add("@deobfuscated");
|
||||
Map<String, String> fullMap = abc.getSwf().getAs3ObfuscatedIdentifiers();
|
||||
int i = 0;
|
||||
for (String obfuscated : usedDeobfuscations) {
|
||||
String deobfuscated = fullMap.get(obfuscated);
|
||||
commentLines.add(deobfuscated + " = \"" + Helper.escapeActionScriptString(obfuscated) + "\"");
|
||||
i++;
|
||||
}
|
||||
commentLines.sort(new NaturalOrderComparator());
|
||||
commentLines.add("");
|
||||
String[] commentLinesArr = commentLines.toArray(new String[commentLines.size()]);
|
||||
new CommentItem(commentLinesArr).appendTo(writer, LocalData.empty);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -475,12 +498,13 @@ public class ScriptPack extends AS3ClassTreeItem {
|
||||
*/
|
||||
public void toSource(AbcIndexing abcIndex, GraphTextWriter writer, final List<Trait> traits, final ConvertData convertData, final ScriptExportMode exportMode, final boolean parallel, boolean ignoreFrameScripts, boolean exportAllClasses) throws InterruptedException {
|
||||
writer.suspendMeasure();
|
||||
Set<String> usedDeobfuscations = Collections.synchronizedSet(new LinkedHashSet<>());
|
||||
int timeout = Configuration.decompilationTimeoutFile.get();
|
||||
try {
|
||||
CancellableWorker.call("script.scriptPack.toSource", new Callable<Void>() {
|
||||
@Override
|
||||
public Void call() throws Exception {
|
||||
convert(abcIndex, new NulWriter(), traits, convertData, exportMode, parallel);
|
||||
convert(usedDeobfuscations, abcIndex, new NulWriter(), traits, convertData, exportMode, parallel);
|
||||
return null;
|
||||
}
|
||||
}, timeout, TimeUnit.SECONDS);
|
||||
@@ -511,7 +535,7 @@ public class ScriptPack extends AS3ClassTreeItem {
|
||||
}
|
||||
writer.continueMeasure();
|
||||
|
||||
appendTo(abcIndex, writer, traits, convertData, exportMode, parallel, exportAllClasses);
|
||||
appendTo(usedDeobfuscations, abcIndex, writer, traits, convertData, exportMode, parallel, exportAllClasses);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1857,7 +1857,7 @@ public class AVM2Code implements Cloneable {
|
||||
* @throws ConvertException On convert error
|
||||
* @throws InterruptedException On interrupt
|
||||
*/
|
||||
public void toSourceOutput(List<GraphTargetItem> output, int swfVersion, Set<GraphPart> switchParts, List<MethodBody> callStack, AbcIndexing abcIndex, Map<Integer, Set<Integer>> setLocalPosToGetLocalPos, boolean thisHasDefaultToPrimitive, Reference<GraphSourceItem> lineStartItem, String path, GraphPart part, boolean processJumps, boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, TranslateStack stack, ScopeStack scopeStack, ScopeStack localScopeStack, ABC abc, MethodBody body, int start, int end, HashMap<Integer, String> localRegNames, HashMap<Integer, GraphTargetItem> localRegTypes, List<DottedChain> fullyQualifiedNames, boolean[] visited, HashMap<Integer, Integer> localRegAssignmentIps, LinkedIdentityHashSet<SetLocalAVM2Item> bottomStackSetLocals) throws ConvertException, InterruptedException {
|
||||
public void toSourceOutput(List<GraphTargetItem> output, int swfVersion, Set<GraphPart> switchParts, List<MethodBody> callStack, AbcIndexing abcIndex, Map<Integer, Set<Integer>> setLocalPosToGetLocalPos, boolean thisHasDefaultToPrimitive, Reference<GraphSourceItem> lineStartItem, String path, GraphPart part, boolean processJumps, boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, TranslateStack stack, ScopeStack scopeStack, ScopeStack localScopeStack, ABC abc, MethodBody body, int start, int end, HashMap<Integer, String> localRegNames, HashMap<Integer, GraphTargetItem> localRegTypes, List<DottedChain> fullyQualifiedNames, boolean[] visited, HashMap<Integer, Integer> localRegAssignmentIps, LinkedIdentityHashSet<SetLocalAVM2Item> bottomStackSetLocals, Set<String> usedDeobfuscations) throws ConvertException, InterruptedException {
|
||||
boolean debugMode = DEBUG_MODE;
|
||||
if (debugMode) {
|
||||
System.err.println("OPEN SubSource:" + start + "-" + end + " " + code.get(start).toString() + " to " + code.get(end).toString());
|
||||
@@ -1976,7 +1976,7 @@ public class AVM2Code implements Cloneable {
|
||||
} else
|
||||
*/
|
||||
if ((ins.definition instanceof ReturnValueIns) || (ins.definition instanceof ReturnVoidIns) || (ins.definition instanceof ThrowIns)) {
|
||||
ins.definition.translate(swfVersion, switchParts, callStack, abcIndex, setLocalPosToGetLocalPos, lineStartItem, isStatic, scriptIndex, classIndex, localRegs, stack, scopeStack, localScopeStack, ins, output, body, abc, localRegNames, localRegTypes, fullyQualifiedNames, path, localRegAssignmentIps, ip, this, thisHasDefaultToPrimitive, bottomStackSetLocals);
|
||||
ins.definition.translate(usedDeobfuscations, swfVersion, switchParts, callStack, abcIndex, setLocalPosToGetLocalPos, lineStartItem, isStatic, scriptIndex, classIndex, localRegs, stack, scopeStack, localScopeStack, ins, output, body, abc, localRegNames, localRegTypes, fullyQualifiedNames, path, localRegAssignmentIps, ip, this, thisHasDefaultToPrimitive, bottomStackSetLocals);
|
||||
//ip = end + 1;
|
||||
break;
|
||||
} else if (ins.definition instanceof NewFunctionIns) {
|
||||
@@ -1998,7 +1998,7 @@ public class AVM2Code implements Cloneable {
|
||||
if (code.get(ip + plus + 2).definition instanceof SwapIns) {
|
||||
if (code.get(ip + plus + 4).definition instanceof PopScopeIns) {
|
||||
if (code.get(ip + plus + 3).definition instanceof SetPropertyIns) {
|
||||
functionName = abc.constants.getMultiname(code.get(ip + plus + 3).operands[0]).getName(abc, abc.constants, fullyQualifiedNames, true, true);
|
||||
functionName = abc.constants.getMultiname(code.get(ip + plus + 3).operands[0]).getName(usedDeobfuscations, abc, abc.constants, fullyQualifiedNames, true, true);
|
||||
localScopeStack.pop(); // with
|
||||
output.remove(output.size() - 1); // with
|
||||
ip = ip + plus + 4; // +1 below
|
||||
@@ -2012,13 +2012,13 @@ public class AVM2Code implements Cloneable {
|
||||
}
|
||||
}
|
||||
// What to do when hasDup is false?
|
||||
ins.definition.translate(swfVersion, switchParts, callStack, abcIndex, setLocalPosToGetLocalPos, lineStartItem, isStatic, scriptIndex, classIndex, localRegs, stack, scopeStack, localScopeStack, ins, output, body, abc, localRegNames, localRegTypes, fullyQualifiedNames, path, localRegAssignmentIps, ip, this, thisHasDefaultToPrimitive, bottomStackSetLocals);
|
||||
ins.definition.translate(usedDeobfuscations, swfVersion, switchParts, callStack, abcIndex, setLocalPosToGetLocalPos, lineStartItem, isStatic, scriptIndex, classIndex, localRegs, stack, scopeStack, localScopeStack, ins, output, body, abc, localRegNames, localRegTypes, fullyQualifiedNames, path, localRegAssignmentIps, ip, this, thisHasDefaultToPrimitive, bottomStackSetLocals);
|
||||
NewFunctionAVM2Item nft = (NewFunctionAVM2Item) stack.peek();
|
||||
nft.functionName = functionName;
|
||||
ip++;
|
||||
} else {
|
||||
try {
|
||||
ins.definition.translate(swfVersion, switchParts, callStack, abcIndex, setLocalPosToGetLocalPos, lineStartItem, isStatic, scriptIndex, classIndex, localRegs, stack, scopeStack, localScopeStack, ins, output, body, abc, localRegNames, localRegTypes, fullyQualifiedNames, path, localRegAssignmentIps, ip, this, thisHasDefaultToPrimitive, bottomStackSetLocals);
|
||||
ins.definition.translate(usedDeobfuscations, swfVersion, switchParts, callStack, abcIndex, setLocalPosToGetLocalPos, lineStartItem, isStatic, scriptIndex, classIndex, localRegs, stack, scopeStack, localScopeStack, ins, output, body, abc, localRegNames, localRegTypes, fullyQualifiedNames, path, localRegAssignmentIps, ip, this, thisHasDefaultToPrimitive, bottomStackSetLocals);
|
||||
|
||||
if (stack.size() == 1 && (stack.peek() instanceof SetLocalAVM2Item)) {
|
||||
bottomStackSetLocals.add((SetLocalAVM2Item) stack.peek());
|
||||
@@ -2070,19 +2070,20 @@ public class AVM2Code implements Cloneable {
|
||||
/**
|
||||
* Gets types of local registers.
|
||||
*
|
||||
* @param usedDeobfuscations Used deobfuscations
|
||||
* @param abc ABC
|
||||
* @param constants Constant pool
|
||||
* @param fullyQualifiedNames Fully qualified names
|
||||
* @return Map from register id to type
|
||||
*/
|
||||
public HashMap<Integer, GraphTargetItem> getLocalRegTypes(ABC abc, AVM2ConstantPool constants, List<DottedChain> fullyQualifiedNames) {
|
||||
public HashMap<Integer, GraphTargetItem> getLocalRegTypes(Set<String> usedDeobfuscations, ABC abc, AVM2ConstantPool constants, List<DottedChain> fullyQualifiedNames) {
|
||||
HashMap<Integer, GraphTargetItem> ret = new HashMap<>();
|
||||
AVM2Instruction prev = null;
|
||||
for (AVM2Instruction ins : code) {
|
||||
if (ins.definition instanceof SetLocalTypeIns) {
|
||||
if (prev != null) {
|
||||
if (prev.definition instanceof CoerceOrConvertTypeIns) {
|
||||
ret.put(((SetLocalTypeIns) ins.definition).getRegisterId(ins), ((CoerceOrConvertTypeIns) prev.definition).getTargetType(abc, constants, prev));
|
||||
ret.put(((SetLocalTypeIns) ins.definition).getRegisterId(ins), ((CoerceOrConvertTypeIns) prev.definition).getTargetType(usedDeobfuscations,abc, constants, prev));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2239,6 +2240,7 @@ public class AVM2Code implements Cloneable {
|
||||
/**
|
||||
* Injects declarations of registers/slots/properties etc.
|
||||
*
|
||||
* @param usedDeobfuscations Used deobfuscations
|
||||
* @param level Level
|
||||
* @param paramNames Parameter names
|
||||
* @param items Items
|
||||
@@ -2251,14 +2253,14 @@ public class AVM2Code implements Cloneable {
|
||||
* @param abc ABC
|
||||
* @param body Method body
|
||||
*/
|
||||
private void injectDeclarations(int level, List<String> paramNames, List<GraphTargetItem> items, int minreg, DeclarationAVM2Item[] declaredRegisters, List<Slot> declaredSlots, List<DeclarationAVM2Item> declaredSlotsDec, List<String> declaredProperties, List<DeclarationAVM2Item> declaredPropsDec, ABC abc, MethodBody body) {
|
||||
private void injectDeclarations(Set<String> usedDeobfuscations, int level, List<String> paramNames, List<GraphTargetItem> items, int minreg, DeclarationAVM2Item[] declaredRegisters, List<Slot> declaredSlots, List<DeclarationAVM2Item> declaredSlotsDec, List<String> declaredProperties, List<DeclarationAVM2Item> declaredPropsDec, ABC abc, MethodBody body) {
|
||||
//boolean hasActivation = abc.method_info.get(body.method_info).flagNeed_activation();
|
||||
Map<String, TraitSlotConst> traits = new LinkedHashMap<>();
|
||||
for (Trait t : body.traits.traits) {
|
||||
if (t instanceof TraitSlotConst) {
|
||||
TraitSlotConst tsc = (TraitSlotConst) t;
|
||||
Multiname tratMultiname = abc.constants.getMultiname(tsc.name_index);
|
||||
String bodyTraitName = tratMultiname.getName(abc, abc.constants, new ArrayList<>(), true, true);
|
||||
String bodyTraitName = tratMultiname.getName(usedDeobfuscations, abc, abc.constants, new ArrayList<>(), true, true);
|
||||
traits.put(bodyTraitName, tsc);
|
||||
}
|
||||
}
|
||||
@@ -2276,7 +2278,7 @@ public class AVM2Code implements Cloneable {
|
||||
if (ss.slotName == null) {
|
||||
break;
|
||||
}
|
||||
propNameStr = ss.slotName.getName(abc, abc.constants, new ArrayList<>(), true, true);
|
||||
propNameStr = ss.slotName.getName(usedDeobfuscations, abc, abc.constants, new ArrayList<>(), true, true);
|
||||
value = ss.value;
|
||||
} else if (item instanceof SetPropertyAVM2Item) {
|
||||
SetPropertyAVM2Item sp = (SetPropertyAVM2Item) item;
|
||||
@@ -2324,7 +2326,7 @@ public class AVM2Code implements Cloneable {
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
propertyName = propertyMultiName.getName(abc, abc.constants, new ArrayList<>(), true, true);
|
||||
propertyName = propertyMultiName.getName(usedDeobfuscations, abc, abc.constants, new ArrayList<>(), true, true);
|
||||
|
||||
if (traits.containsKey(propertyName)) {
|
||||
Slot sl = new Slot(new NewActivationAVM2Item(null, null), propertyMultiName);
|
||||
@@ -2349,8 +2351,8 @@ public class AVM2Code implements Cloneable {
|
||||
if (!beginDeclaredSlotsNames.contains(traitName)) {
|
||||
Slot sl = new Slot(new NewActivationAVM2Item(null, null), abc.constants.getMultiname(traits.get(traitName).name_index));
|
||||
TraitSlotConst tsc = (TraitSlotConst) traits.get(traitName);
|
||||
GraphTargetItem type = AbcIndexing.multinameToType(tsc.type_index, abc, abc.constants);
|
||||
DeclarationAVM2Item d = new DeclarationAVM2Item(new GetLexAVM2Item(null, null, sl.multiname, abc, abc.constants, type, TypeItem.UNBOUNDED /*?*/, false), type);
|
||||
GraphTargetItem type = AbcIndexing.multinameToType(usedDeobfuscations, tsc.type_index, abc, abc.constants);
|
||||
DeclarationAVM2Item d = new DeclarationAVM2Item(new GetLexAVM2Item(null, null, sl.multiname, abc, abc.constants, type, TypeItem.UNBOUNDED /*?*/, false, usedDeobfuscations), type);
|
||||
declaredSlotsDec.add(d);
|
||||
declaredSlots.add(sl);
|
||||
|
||||
@@ -2416,7 +2418,7 @@ public class AVM2Code implements Cloneable {
|
||||
if (!declaredProperties.contains(propName.resolvedMultinameName)) {
|
||||
if (traits.containsKey(propName.resolvedMultinameName)) {
|
||||
TraitSlotConst tsc = traits.get(propName.resolvedMultinameName);
|
||||
GraphTargetItem type = AbcIndexing.multinameToType(tsc.type_index, abc, abc.constants);
|
||||
GraphTargetItem type = AbcIndexing.multinameToType(usedDeobfuscations, tsc.type_index, abc, abc.constants);
|
||||
DeclarationAVM2Item d = new DeclarationAVM2Item(subItem, type);
|
||||
sp.setDeclaration(d);
|
||||
declaredPropsDec.add(d);
|
||||
@@ -2446,14 +2448,14 @@ public class AVM2Code implements Cloneable {
|
||||
SetSlotAVM2Item ssti = (SetSlotAVM2Item) subItem;
|
||||
if (ssti.scope instanceof NewActivationAVM2Item) {
|
||||
Slot sl = new Slot(ssti.scope, ssti.slotName);
|
||||
String slotPropertyName = sl.multiname.getName(abc, abc.constants, new ArrayList<>(), true, false);
|
||||
String slotPropertyName = sl.multiname.getName(usedDeobfuscations, abc, abc.constants, new ArrayList<>(), true, false);
|
||||
if (!paramNames.contains(slotPropertyName)) {
|
||||
|
||||
int index = slotListIndexOf(declaredSlots, slotPropertyName, abc);
|
||||
if (index == -1) {
|
||||
GraphTargetItem type = TypeItem.UNBOUNDED;
|
||||
if (traits.containsKey(slotPropertyName)) {
|
||||
type = AbcIndexing.multinameToType(traits.get(slotPropertyName).type_index, abc, abc.constants);
|
||||
type = AbcIndexing.multinameToType(usedDeobfuscations, traits.get(slotPropertyName).type_index, abc, abc.constants);
|
||||
}
|
||||
DeclarationAVM2Item d = new DeclarationAVM2Item(subItem, type);
|
||||
ssti.setDeclaration(d);
|
||||
@@ -2482,7 +2484,7 @@ public class AVM2Code implements Cloneable {
|
||||
if (currentItem instanceof Block) {
|
||||
Block blk = (Block) currentItem;
|
||||
for (List<GraphTargetItem> sub : blk.getSubs()) {
|
||||
injectDeclarations(level + 1, paramNames, sub, minreg, declaredRegisters, declaredSlots, declaredSlotsDec, declaredProperties, declaredPropsDec, abc, body);
|
||||
injectDeclarations(usedDeobfuscations, level + 1, paramNames, sub, minreg, declaredRegisters, declaredSlots, declaredSlotsDec, declaredProperties, declaredPropsDec, abc, body);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2516,6 +2518,7 @@ public class AVM2Code implements Cloneable {
|
||||
/**
|
||||
* Converts code to source - list of GraphTargetItems.
|
||||
*
|
||||
* @param usedDeobfuscations Used deobfuscations
|
||||
* @param swfVersion SWF version
|
||||
* @param callStack Call stack
|
||||
* @param abcIndex ABC indexing
|
||||
@@ -2539,7 +2542,7 @@ public class AVM2Code implements Cloneable {
|
||||
* @return List of GraphTargetItems
|
||||
* @throws InterruptedException On interrupt
|
||||
*/
|
||||
public List<GraphTargetItem> toGraphTargetItems(int swfVersion, List<MethodBody> callStack, AbcIndexing abcIndex, boolean thisHasDefaultToPrimitive, ConvertData convertData, String path, int methodIndex, boolean isStatic, int scriptIndex, int classIndex, ABC abc, MethodBody body, HashMap<Integer, String> localRegNames, ScopeStack scopeStack, int initializerType, List<DottedChain> fullyQualifiedNames, Traits initTraits, int staticOperation, HashMap<Integer, Integer> localRegAssignmentIps, List<Integer> initTraitClasses) throws InterruptedException {
|
||||
public List<GraphTargetItem> toGraphTargetItems(Set<String> usedDeobfuscations, int swfVersion, List<MethodBody> callStack, AbcIndexing abcIndex, boolean thisHasDefaultToPrimitive, ConvertData convertData, String path, int methodIndex, boolean isStatic, int scriptIndex, int classIndex, ABC abc, MethodBody body, HashMap<Integer, String> localRegNames, ScopeStack scopeStack, int initializerType, List<DottedChain> fullyQualifiedNames, Traits initTraits, int staticOperation, HashMap<Integer, Integer> localRegAssignmentIps, List<Integer> initTraitClasses) throws InterruptedException {
|
||||
initToSource();
|
||||
List<GraphTargetItem> list;
|
||||
HashMap<Integer, GraphTargetItem> localRegs = new HashMap<>();
|
||||
@@ -2550,13 +2553,13 @@ public class AVM2Code implements Cloneable {
|
||||
}
|
||||
HashMap<Integer, GraphTargetItem> localRegTypes = new HashMap<>();
|
||||
for (int i = 0; i < abc.method_info.get(methodIndex).param_types.length; i++) {
|
||||
localRegTypes.put(i + 1, AbcIndexing.multinameToType(abc.method_info.get(methodIndex).param_types[i], abc, abc.constants));
|
||||
localRegTypes.put(i + 1, AbcIndexing.multinameToType(usedDeobfuscations, abc.method_info.get(methodIndex).param_types[i], abc, abc.constants));
|
||||
}
|
||||
|
||||
try {
|
||||
list = AVM2Graph.translateViaGraph(swfVersion, null, callStack, abcIndex, path, this, abc, body, isStatic, scriptIndex, classIndex, localRegs, scopeStack, localRegNames, localRegTypes, fullyQualifiedNames, staticOperation, localRegAssignmentIps, thisHasDefaultToPrimitive);
|
||||
list = AVM2Graph.translateViaGraph(usedDeobfuscations, swfVersion, null, callStack, abcIndex, path, this, abc, body, isStatic, scriptIndex, classIndex, localRegs, scopeStack, localRegNames, localRegTypes, fullyQualifiedNames, staticOperation, localRegAssignmentIps, thisHasDefaultToPrimitive);
|
||||
} catch (SecondPassException spe) {
|
||||
list = AVM2Graph.translateViaGraph(swfVersion, spe.getData(), callStack, abcIndex, path, this, abc, body, isStatic, scriptIndex, classIndex, localRegs, scopeStack, localRegNames, localRegTypes, fullyQualifiedNames, staticOperation, localRegAssignmentIps, thisHasDefaultToPrimitive);
|
||||
list = AVM2Graph.translateViaGraph(usedDeobfuscations, swfVersion, spe.getData(), callStack, abcIndex, path, this, abc, body, isStatic, scriptIndex, classIndex, localRegs, scopeStack, localRegNames, localRegTypes, fullyQualifiedNames, staticOperation, localRegAssignmentIps, thisHasDefaultToPrimitive);
|
||||
}
|
||||
if (initTraits != null) {
|
||||
|
||||
@@ -2582,7 +2585,7 @@ public class AVM2Code implements Cloneable {
|
||||
if (value != null && !convertData.assignedValues.containsKey(tsc)) {
|
||||
if (value instanceof NewFunctionAVM2Item) {
|
||||
NewFunctionAVM2Item f = (NewFunctionAVM2Item) value;
|
||||
f.functionName = tsc.getName(abc).getName(abc, abc.constants, fullyQualifiedNames, true, true);
|
||||
f.functionName = tsc.getName(abc).getName(usedDeobfuscations, abc, abc.constants, fullyQualifiedNames, true, true);
|
||||
}
|
||||
AssignedValue av = new AssignedValue(ti, value, initializerType, methodIndex);
|
||||
convertData.assignedValues.put(tsc, av);
|
||||
@@ -2671,7 +2674,7 @@ public class AVM2Code implements Cloneable {
|
||||
}
|
||||
if (value instanceof NewFunctionAVM2Item) {
|
||||
NewFunctionAVM2Item f = (NewFunctionAVM2Item) value;
|
||||
f.functionName = tsc.getName(abc).getName(abc, abc.constants, fullyQualifiedNames, true, true);
|
||||
f.functionName = tsc.getName(abc).getName(usedDeobfuscations, abc, abc.constants, fullyQualifiedNames, true, true);
|
||||
}
|
||||
AssignedValue av = new AssignedValue(classMultiname == -1 ? ti : null, value, initializerType, methodIndex);
|
||||
convertData.assignedValues.put(tsc, av);
|
||||
@@ -2889,7 +2892,7 @@ public class AVM2Code implements Cloneable {
|
||||
if (param_types[i] == 0) {
|
||||
type = TypeItem.UNBOUNDED;
|
||||
} else {
|
||||
type = new TypeItem(abc.constants.getMultiname(param_types[i]).getNameWithNamespace(abc, abc.constants, true));
|
||||
type = new TypeItem(abc.constants.getMultiname(param_types[i]).getNameWithNamespace(usedDeobfuscations, abc, abc.constants, true));
|
||||
}
|
||||
if (d.length > r) {
|
||||
d[r] = new DeclarationAVM2Item(new SetLocalAVM2Item(null, null, r, new NullAVM2Item(null, null), type), type);
|
||||
@@ -2914,9 +2917,9 @@ public class AVM2Code implements Cloneable {
|
||||
HashMap<Integer, String> registerNames = body.getLocalRegNames(abc);
|
||||
List<String> paramNamesList = new ArrayList<>();
|
||||
for (int ir = 0; ir < r; ir++) {
|
||||
paramNamesList.add(AVM2Item.localRegName(abc.getSwf(), localRegNames, ir));
|
||||
paramNamesList.add(AVM2Item.localRegName(abc.getSwf(), localRegNames, ir, usedDeobfuscations));
|
||||
}
|
||||
injectDeclarations(0, paramNamesList, list, 1, d, new ArrayList<>(), new ArrayList<>(), new ArrayList<>(), new ArrayList<>(), abc, body);
|
||||
injectDeclarations(usedDeobfuscations, 0, paramNamesList, list, 1, d, new ArrayList<>(), new ArrayList<>(), new ArrayList<>(), new ArrayList<>(), abc, body);
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ import com.jpexs.helpers.HashArrayList;
|
||||
import com.jpexs.helpers.utf8.Utf8PrintWriter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Logger;
|
||||
@@ -1216,7 +1217,7 @@ public class AVM2ConstantPool implements Cloneable {
|
||||
writer.println("String[" + i + "]=" + constant_string.get(i));
|
||||
}
|
||||
for (int i = 1; i < constant_namespace.size(); i++) {
|
||||
writer.println("Namespace[" + i + "]=" + constant_namespace.get(i).toString(abc, this));
|
||||
writer.println("Namespace[" + i + "]=" + constant_namespace.get(i).toString(new LinkedHashSet<>(), abc, this));
|
||||
}
|
||||
for (int i = 1; i < constant_namespace_set.size(); i++) {
|
||||
writer.println("NamespaceSet[" + i + "]=" + constant_namespace_set.get(i).toString(this));
|
||||
@@ -1251,7 +1252,7 @@ public class AVM2ConstantPool implements Cloneable {
|
||||
if (index == 0) {
|
||||
return "null";
|
||||
}
|
||||
return constant_namespace.get(index).toString(abc, this);
|
||||
return constant_namespace.get(index).toString(new LinkedHashSet<>(), abc, this);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -23,6 +23,7 @@ import com.jpexs.decompiler.graph.DottedChain;
|
||||
import com.jpexs.decompiler.graph.model.LocalData;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -84,7 +85,7 @@ public class CodeStats {
|
||||
if (stats.stackpos > ms) {
|
||||
ms = stats.stackpos;
|
||||
}
|
||||
writer.appendNoHilight(i + ":" + stats.stackpos + (deltastack >= 0 ? "+" + deltastack : deltastack) + "," + stats.scopepos + " " + stats.ins.toString(writer, LocalData.create(new ArrayList<>(), null, abc, null, fullyQualifiedNames, new HashSet<>(), ScriptExportMode.AS, -1))).newLine();
|
||||
writer.appendNoHilight(i + ":" + stats.stackpos + (deltastack >= 0 ? "+" + deltastack : deltastack) + "," + stats.scopepos + " " + stats.ins.toString(writer, LocalData.create(new ArrayList<>(), null, abc, null, fullyQualifiedNames, new HashSet<>(), ScriptExportMode.AS, -1, new LinkedHashSet<>()))).newLine();
|
||||
i++;
|
||||
}
|
||||
return writer;
|
||||
|
||||
+3
-1
@@ -43,8 +43,10 @@ import com.jpexs.decompiler.graph.TranslateException;
|
||||
import com.jpexs.helpers.CancellableWorker;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* AVM2 Deobfuscator removing single get / set registers.
|
||||
@@ -164,7 +166,7 @@ public class AVM2DeobfuscatorGetSet extends SWFDecompilerAdapter {
|
||||
localData.localRegTypes = new HashMap<>();
|
||||
localData.scriptIndex = scriptIndex;
|
||||
localData.ip = 0;
|
||||
localData.code = body.getCode();
|
||||
localData.code = body.getCode();
|
||||
return localData;
|
||||
}
|
||||
|
||||
|
||||
@@ -743,6 +743,7 @@ public class AVM2Graph extends Graph {
|
||||
/**
|
||||
* Translates via Graph - decompiles.
|
||||
*
|
||||
* @param usedDeobfuscations Used deobfuscations
|
||||
* @param swfVersion SWF version
|
||||
* @param secondPassData Second pass data
|
||||
* @param callStack Call stack
|
||||
@@ -765,7 +766,7 @@ public class AVM2Graph extends Graph {
|
||||
* @return List of graph target items
|
||||
* @throws InterruptedException On interrupt
|
||||
*/
|
||||
public static List<GraphTargetItem> translateViaGraph(int swfVersion, SecondPassData secondPassData, List<MethodBody> callStack, AbcIndexing abcIndex, String path, AVM2Code code, ABC abc, MethodBody body, boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, ScopeStack scopeStack, HashMap<Integer, String> localRegNames, HashMap<Integer, GraphTargetItem> localRegTypes, List<DottedChain> fullyQualifiedNames, int staticOperation, HashMap<Integer, Integer> localRegAssignmentIps, boolean thisHasDefaultToPrimitive) throws InterruptedException {
|
||||
public static List<GraphTargetItem> translateViaGraph(Set<String> usedDeobfuscations, int swfVersion, SecondPassData secondPassData, List<MethodBody> callStack, AbcIndexing abcIndex, String path, AVM2Code code, ABC abc, MethodBody body, boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, ScopeStack scopeStack, HashMap<Integer, String> localRegNames, HashMap<Integer, GraphTargetItem> localRegTypes, List<DottedChain> fullyQualifiedNames, int staticOperation, HashMap<Integer, Integer> localRegAssignmentIps, boolean thisHasDefaultToPrimitive) throws InterruptedException {
|
||||
ScopeStack localScopeStack = new ScopeStack();
|
||||
AVM2Graph g = new AVM2Graph(swfVersion, abcIndex, code, abc, body, isStatic, scriptIndex, classIndex, localRegs, scopeStack, localScopeStack, localRegNames, fullyQualifiedNames, localRegAssignmentIps);
|
||||
|
||||
@@ -788,6 +789,7 @@ public class AVM2Graph extends Graph {
|
||||
localData.ip = 0;
|
||||
localData.code = code;
|
||||
localData.swfVersion = swfVersion;
|
||||
localData.usedDeobfuscations = usedDeobfuscations;
|
||||
g.init(localData);
|
||||
Set<GraphPart> allParts = new HashSet<>();
|
||||
for (GraphPart head : g.heads) {
|
||||
@@ -2190,7 +2192,7 @@ public class AVM2Graph extends Graph {
|
||||
}
|
||||
if (construct.object instanceof GetLexAVM2Item) {
|
||||
GetLexAVM2Item glt = (GetLexAVM2Item) construct.object;
|
||||
isXMLList = glt.propertyName.getName(aLocalData.abc, aLocalData.getConstants(), aLocalData.fullyQualifiedNames, true, true).equals("XMLList");
|
||||
isXMLList = glt.propertyName.getName(new LinkedHashSet<>(), aLocalData.abc, aLocalData.getConstants(), aLocalData.fullyQualifiedNames, true, true).equals("XMLList");
|
||||
}
|
||||
|
||||
if (isXMLList) {
|
||||
@@ -2733,7 +2735,7 @@ public class AVM2Graph extends Graph {
|
||||
if (sp.value instanceof LocalRegAVM2Item) {
|
||||
LocalRegAVM2Item lr = (LocalRegAVM2Item) sp.value;
|
||||
AVM2FinalProcessLocalData aLocalData = (AVM2FinalProcessLocalData) localData;
|
||||
if (Objects.equals(propName.resolvedMultinameName, AVM2Item.localRegName(abc.getSwf(), aLocalData.localRegNames, lr.regIndex))) {
|
||||
if (Objects.equals(propName.resolvedMultinameName, AVM2Item.localRegName(abc.getSwf(), aLocalData.localRegNames, lr.regIndex, new LinkedHashSet<>()))) {
|
||||
list.remove(i);
|
||||
i--;
|
||||
continue loopi;
|
||||
@@ -2746,7 +2748,7 @@ public class AVM2Graph extends Graph {
|
||||
if (list.get(i) instanceof SetSlotAVM2Item) {
|
||||
SetSlotAVM2Item sslot = (SetSlotAVM2Item) list.get(i);
|
||||
if (sslot.slotObject instanceof NewActivationAVM2Item) {
|
||||
String slotName = sslot.slotName.getName(abc, abc.constants, new ArrayList<>(), true, true);
|
||||
String slotName = sslot.slotName.getName(new LinkedHashSet<>()/*???*/, abc, abc.constants, new ArrayList<>(), true, true);
|
||||
if (sslot.value.getNotCoercedNoDup() instanceof LocalRegAVM2Item) {
|
||||
LocalRegAVM2Item locReg = (LocalRegAVM2Item) sslot.value.getNotCoercedNoDup();
|
||||
if (localRegNames.containsValue(slotName)) {
|
||||
|
||||
@@ -202,7 +202,7 @@ public class AVM2GraphSource extends GraphSource {
|
||||
@Override
|
||||
public void translatePart(List<GraphTargetItem> output, Graph graph, GraphPart part, BaseLocalData localData, TranslateStack stack, int start, int end, int staticOperation, String path) throws InterruptedException {
|
||||
Reference<GraphSourceItem> lineStartItem = new Reference<>(localData.lineStartInstruction);
|
||||
code.toSourceOutput(output, localData.swfVersion, localData.allSwitchParts, ((AVM2LocalData) localData).callStack, ((AVM2LocalData) localData).abcIndex, ((AVM2LocalData) localData).setLocalPosToGetLocalPos, ((AVM2LocalData) localData).thisHasDefaultToPrimitive, lineStartItem, path, part, false, isStatic, scriptIndex, classIndex, localRegs, stack, ((AVM2LocalData) localData).scopeStack, ((AVM2LocalData) localData).localScopeStack, abc, body, start, end, localRegNames, ((AVM2LocalData) localData).localRegTypes, fullyQualifiedNames, new boolean[size()], localRegAssignmentIps, ((AVM2LocalData) localData).bottomSetLocals);
|
||||
code.toSourceOutput(output, localData.swfVersion, localData.allSwitchParts, ((AVM2LocalData) localData).callStack, ((AVM2LocalData) localData).abcIndex, ((AVM2LocalData) localData).setLocalPosToGetLocalPos, ((AVM2LocalData) localData).thisHasDefaultToPrimitive, lineStartItem, path, part, false, isStatic, scriptIndex, classIndex, localRegs, stack, ((AVM2LocalData) localData).scopeStack, ((AVM2LocalData) localData).localScopeStack, abc, body, start, end, localRegNames, ((AVM2LocalData) localData).localRegTypes, fullyQualifiedNames, new boolean[size()], localRegAssignmentIps, ((AVM2LocalData) localData).bottomSetLocals, localData.usedDeobfuscations);
|
||||
localData.lineStartInstruction = lineStartItem.getVal();
|
||||
}
|
||||
|
||||
|
||||
+4
-2
@@ -267,6 +267,7 @@ public abstract class InstructionDefinition implements Serializable {
|
||||
/**
|
||||
* Translates instruction to high level code.
|
||||
*
|
||||
* @param usedDeobfuscations Used deobfuscations
|
||||
* @param swfVersion SWF version
|
||||
* @param switchParts Switch parts
|
||||
* @param callStack Call stack
|
||||
@@ -295,7 +296,7 @@ public abstract class InstructionDefinition implements Serializable {
|
||||
* @param bottomSetLocals Bottom set locals
|
||||
* @throws InterruptedException On interrupt
|
||||
*/
|
||||
public void translate(int swfVersion, Set<GraphPart> switchParts, List<MethodBody> callStack, AbcIndexing abcIndex, Map<Integer, Set<Integer>> setLocalPosToGetLocalPos, Reference<GraphSourceItem> lineStartItem, boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, TranslateStack stack, ScopeStack scopeStack, ScopeStack localScopeStack, AVM2Instruction ins, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, HashMap<Integer, GraphTargetItem> localRegTypes, List<DottedChain> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, AVM2Code code, boolean thisHasDefaultToPrimitive, LinkedIdentityHashSet<SetLocalAVM2Item> bottomSetLocals) throws InterruptedException {
|
||||
public void translate(Set<String> usedDeobfuscations, int swfVersion, Set<GraphPart> switchParts, List<MethodBody> callStack, AbcIndexing abcIndex, Map<Integer, Set<Integer>> setLocalPosToGetLocalPos, Reference<GraphSourceItem> lineStartItem, boolean isStatic, int scriptIndex, int classIndex, HashMap<Integer, GraphTargetItem> localRegs, TranslateStack stack, ScopeStack scopeStack, ScopeStack localScopeStack, AVM2Instruction ins, List<GraphTargetItem> output, MethodBody body, ABC abc, HashMap<Integer, String> localRegNames, HashMap<Integer, GraphTargetItem> localRegTypes, List<DottedChain> fullyQualifiedNames, String path, HashMap<Integer, Integer> localRegsAssignmentIps, int ip, AVM2Code code, boolean thisHasDefaultToPrimitive, LinkedIdentityHashSet<SetLocalAVM2Item> bottomSetLocals) throws InterruptedException {
|
||||
AVM2LocalData localData = new AVM2LocalData();
|
||||
localData.allSwitchParts = switchParts;
|
||||
localData.isStatic = isStatic;
|
||||
@@ -319,6 +320,7 @@ public abstract class InstructionDefinition implements Serializable {
|
||||
localData.setLocalPosToGetLocalPos = setLocalPosToGetLocalPos;
|
||||
localData.bottomSetLocals = bottomSetLocals;
|
||||
localData.swfVersion = swfVersion;
|
||||
localData.usedDeobfuscations = usedDeobfuscations;
|
||||
translate(localData, stack, ins, output, path);
|
||||
lineStartItem.setVal(localData.lineStartInstruction);
|
||||
}
|
||||
@@ -388,7 +390,7 @@ public abstract class InstructionDefinition implements Serializable {
|
||||
}
|
||||
}
|
||||
|
||||
return new FullMultinameAVM2Item(property, ins, localData.lineStartInstruction, multinameIndex, localData.abc.constants.getMultiname(multinameIndex).getName(localData.abc, localData.getConstants(), new ArrayList<>(), true, true), name, ns);
|
||||
return new FullMultinameAVM2Item(property, ins, localData.lineStartInstruction, multinameIndex, localData.abc.constants.getMultiname(multinameIndex).getName(localData.usedDeobfuscations, localData.abc, localData.getConstants(), new ArrayList<>(), true, true), name, ns);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+2
-2
@@ -129,7 +129,7 @@ public class ConstructIns extends InstructionDefinition {
|
||||
}
|
||||
if (obj instanceof GetLexAVM2Item) {
|
||||
GetLexAVM2Item glt = (GetLexAVM2Item) obj;
|
||||
isXML = glt.propertyName.getName(localData.abc, localData.getConstants(), localData.fullyQualifiedNames, true, true).equals("XML");
|
||||
isXML = glt.propertyName.getName(localData.usedDeobfuscations, localData.abc, localData.getConstants(), localData.fullyQualifiedNames, true, true).equals("XML");
|
||||
}
|
||||
|
||||
if (isXML) {
|
||||
@@ -157,7 +157,7 @@ public class ConstructIns extends InstructionDefinition {
|
||||
}
|
||||
if (obj instanceof GetLexAVM2Item) {
|
||||
GetLexAVM2Item glt = (GetLexAVM2Item) obj;
|
||||
isRegExp = glt.propertyName.getName(localData.abc, localData.getConstants(), localData.fullyQualifiedNames, true, true).equals("RegExp");
|
||||
isRegExp = glt.propertyName.getName(localData.usedDeobfuscations, localData.abc, localData.getConstants(), localData.fullyQualifiedNames, true, true).equals("RegExp");
|
||||
}
|
||||
|
||||
if (isRegExp && (args.size() >= 1) && (args.get(0) instanceof StringAVM2Item) && (args.size() == 1 || (args.size() == 2 && args.get(1) instanceof StringAVM2Item))) {
|
||||
|
||||
+2
-2
@@ -49,11 +49,11 @@ public class NewClassIns extends InstructionDefinition {
|
||||
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) throws InterruptedException {
|
||||
int clsIndex = ins.operands[0];
|
||||
HighlightedTextWriter writer = new HighlightedTextWriter(Configuration.getCodeFormatting(), false);
|
||||
stack.pop().toString(writer, LocalData.create(localData.callStack /*??*/, localData.abcIndex, localData.abc, localData.localRegNames, localData.fullyQualifiedNames, new HashSet<>(), ScriptExportMode.AS, localData.swfVersion));
|
||||
stack.pop().toString(writer, LocalData.create(localData.callStack /*??*/, localData.abcIndex, localData.abc, localData.localRegNames, localData.fullyQualifiedNames, new HashSet<>(), ScriptExportMode.AS, localData.swfVersion, localData.usedDeobfuscations));
|
||||
writer.finishHilights();
|
||||
String baseType = writer.toString();
|
||||
ABC abc = localData.abc;
|
||||
stack.push(new UnparsedAVM2Item(ins, localData.lineStartInstruction, "§§newclass(" + abc.constants.getMultiname(abc.instance_info.get(clsIndex).name_index).getName(localData.abc, localData.getConstants(), localData.fullyQualifiedNames, false, true) + "," + baseType + ")"));
|
||||
stack.push(new UnparsedAVM2Item(ins, localData.lineStartInstruction, "§§newclass(" + abc.constants.getMultiname(abc.instance_info.get(clsIndex).name_index).getName(localData.usedDeobfuscations, localData.abc, localData.getConstants(), localData.fullyQualifiedNames, false, true) + "," + baseType + ")"));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+1
-1
@@ -93,7 +93,7 @@ public abstract class GetLocalTypeIns extends InstructionDefinition {
|
||||
List<Trait> ts = localData.getInstanceInfo().get(localData.classIndex).instance_traits.traits;
|
||||
boolean isBasicObject = localData.thisHasDefaultToPrimitive;
|
||||
Multiname m = localData.getInstanceInfo().get(localData.classIndex).getName(localData.getConstants());
|
||||
stack.push(new ThisAVM2Item(ins, localData.lineStartInstruction, m.getNameWithNamespace(localData.abc, localData.getConstants(), true), isBasicObject, false));
|
||||
stack.push(new ThisAVM2Item(ins, localData.lineStartInstruction, m.getNameWithNamespace(localData.usedDeobfuscations, localData.abc, localData.getConstants(), true), isBasicObject, false));
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
+1
-1
@@ -60,7 +60,7 @@ public class GetGlobalSlotIns extends InstructionDefinition {
|
||||
if (t instanceof TraitSlotConst) {
|
||||
TraitSlotConst tsc = (TraitSlotConst) t;
|
||||
if (tsc.slot_id == slotIndex) {
|
||||
slotType = AbcIndexing.multinameToType(tsc.type_index, localData.abc, localData.abc.constants);
|
||||
slotType = AbcIndexing.multinameToType(localData.usedDeobfuscations, tsc.type_index, localData.abc, localData.abc.constants);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
+6
-6
@@ -58,17 +58,17 @@ public class GetLexIns extends InstructionDefinition {
|
||||
Reference<Boolean> isStatic, Reference<GraphTargetItem> type, Reference<GraphTargetItem> callType) {
|
||||
type.setVal(TypeItem.UNKNOWN);
|
||||
callType.setVal(TypeItem.UNKNOWN);
|
||||
String multinameStr = localData.abc.constants.getMultiname(multinameIndex).getName(localData.abc, localData.abc.constants, new ArrayList<>(), true, true);
|
||||
String multinameStr = localData.abc.constants.getMultiname(multinameIndex).getName(localData.usedDeobfuscations, localData.abc, localData.abc.constants, new ArrayList<>(), true, true);
|
||||
for (int b = localData.callStack.size() - 1; b >= 0; b--) {
|
||||
MethodBody body = localData.callStack.get(b);
|
||||
for (Trait t : body.traits.traits) {
|
||||
if (t instanceof TraitSlotConst) {
|
||||
TraitSlotConst tsc = (TraitSlotConst) t;
|
||||
if (Objects.equals(
|
||||
tsc.getName(localData.abc).getName(localData.abc, localData.abc.constants, new ArrayList<>(), true, true),
|
||||
tsc.getName(localData.abc).getName(localData.usedDeobfuscations, localData.abc, localData.abc.constants, new ArrayList<>(), true, true),
|
||||
multinameStr
|
||||
)) {
|
||||
GraphTargetItem ty = AbcIndexing.multinameToType(tsc.type_index, localData.abc, localData.abc.constants);
|
||||
GraphTargetItem ty = AbcIndexing.multinameToType(localData.usedDeobfuscations, tsc.type_index, localData.abc, localData.abc.constants);
|
||||
type.setVal(ty);
|
||||
callType.setVal(ty);
|
||||
return;
|
||||
@@ -78,7 +78,7 @@ public class GetLexIns extends InstructionDefinition {
|
||||
}
|
||||
|
||||
if (localData.abcIndex != null) {
|
||||
String currentClassName = localData.classIndex == -1 ? null : localData.abc.instance_info.get(localData.classIndex).getName(localData.abc.constants).getNameWithNamespace(localData.abc, localData.abc.constants, true).toRawString();
|
||||
String currentClassName = localData.classIndex == -1 ? null : localData.abc.instance_info.get(localData.classIndex).getName(localData.abc.constants).getNameWithNamespace(localData.usedDeobfuscations, localData.abc, localData.abc.constants, true).toRawString();
|
||||
if (currentClassName != null) {
|
||||
Reference<Boolean> foundStatic = new Reference<>(null);
|
||||
localData.abcIndex.findPropertyTypeOrCallType(localData.abc, new TypeItem(currentClassName), multinameStr, localData.abc.constants.getMultiname(multinameIndex).namespace_index, true, true, true, type, callType, foundStatic);
|
||||
@@ -86,7 +86,7 @@ public class GetLexIns extends InstructionDefinition {
|
||||
|
||||
if (type.getVal().equals(TypeItem.UNKNOWN)) {
|
||||
//TypeItem ti = new TypeItem(localData.abc.constants.getMultiname(multinameIndex).getNameWithNamespace(localData.abc.constants, true));
|
||||
GraphTargetItem ti = AbcIndexing.multinameToType(multinameIndex, localData.abc, localData.abc.constants);
|
||||
GraphTargetItem ti = AbcIndexing.multinameToType(localData.usedDeobfuscations, multinameIndex, localData.abc, localData.abc.constants);
|
||||
if (localData.abcIndex.findClass(ti, localData.abc, localData.scriptIndex) != null) {
|
||||
type.setVal(ti);
|
||||
callType.setVal(TypeItem.UNBOUNDED);
|
||||
@@ -116,7 +116,7 @@ public class GetLexIns extends InstructionDefinition {
|
||||
Reference<GraphTargetItem> type = new Reference<>(null);
|
||||
Reference<GraphTargetItem> callType = new Reference<>(null);
|
||||
GetLexIns.resolveLexType(localData, null, multinameIndex, isStatic, type, callType);
|
||||
stack.push(new GetLexAVM2Item(ins, localData.lineStartInstruction, multiname, localData.abc, localData.getConstants(), type.getVal(), callType.getVal(), isStatic.getVal()));
|
||||
stack.push(new GetLexAVM2Item(ins, localData.lineStartInstruction, multiname, localData.abc, localData.getConstants(), type.getVal(), callType.getVal(), isStatic.getVal(), localData.usedDeobfuscations));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+5
-5
@@ -152,7 +152,7 @@ public class GetPropertyIns extends InstructionDefinition {
|
||||
Reference<Boolean> isStatic, Reference<GraphTargetItem> type, Reference<GraphTargetItem> callType) {
|
||||
type.setVal(TypeItem.UNKNOWN);
|
||||
callType.setVal(TypeItem.UNKNOWN);
|
||||
String multinameStr = localData.abc.constants.getMultiname(multiname.multinameIndex).getName(localData.abc, localData.abc.constants, new ArrayList<>(), true, true);
|
||||
String multinameStr = localData.abc.constants.getMultiname(multiname.multinameIndex).getName(localData.usedDeobfuscations, localData.abc, localData.abc.constants, new ArrayList<>(), true, true);
|
||||
if (obj instanceof FindPropertyAVM2Item) {
|
||||
FindPropertyAVM2Item fprop = (FindPropertyAVM2Item) obj;
|
||||
if (fprop.propertyName.equals(multiname)) {
|
||||
@@ -162,10 +162,10 @@ public class GetPropertyIns extends InstructionDefinition {
|
||||
if (t instanceof TraitSlotConst) {
|
||||
TraitSlotConst tsc = (TraitSlotConst) t;
|
||||
if (Objects.equals(
|
||||
tsc.getName(localData.abc).getName(localData.abc, localData.abc.constants, new ArrayList<>(), true, true),
|
||||
tsc.getName(localData.abc).getName(localData.usedDeobfuscations, localData.abc, localData.abc.constants, new ArrayList<>(), true, true),
|
||||
multinameStr
|
||||
)) {
|
||||
GraphTargetItem ty = AbcIndexing.multinameToType(tsc.type_index, localData.abc, localData.abc.constants);
|
||||
GraphTargetItem ty = AbcIndexing.multinameToType(localData.usedDeobfuscations, tsc.type_index, localData.abc, localData.abc.constants);
|
||||
type.setVal(ty);
|
||||
callType.setVal(ty);
|
||||
return;
|
||||
@@ -176,13 +176,13 @@ public class GetPropertyIns extends InstructionDefinition {
|
||||
|
||||
if (type.getVal().equals(TypeItem.UNKNOWN)) {
|
||||
if (localData.abcIndex != null) {
|
||||
String currentClassName = localData.classIndex == -1 ? null : localData.abc.instance_info.get(localData.classIndex).getName(localData.abc.constants).getNameWithNamespace(localData.abc, localData.abc.constants, true).toRawString();
|
||||
String currentClassName = localData.classIndex == -1 ? null : localData.abc.instance_info.get(localData.classIndex).getName(localData.abc.constants).getNameWithNamespace(localData.usedDeobfuscations, localData.abc, localData.abc.constants, true).toRawString();
|
||||
if (currentClassName != null) {
|
||||
Reference<Boolean> foundStatic = new Reference<>(null);
|
||||
localData.abcIndex.findPropertyTypeOrCallType(localData.abc, new TypeItem(currentClassName), multinameStr, localData.abc.constants.getMultiname(multiname.multinameIndex).namespace_index, true, true, true, type, callType, foundStatic);
|
||||
}
|
||||
if (type.getVal().equals(TypeItem.UNKNOWN)) {
|
||||
GraphTargetItem ti = AbcIndexing.multinameToType(multiname.multinameIndex, localData.abc, localData.abc.constants);
|
||||
GraphTargetItem ti = AbcIndexing.multinameToType(localData.usedDeobfuscations, multiname.multinameIndex, localData.abc, localData.abc.constants);
|
||||
if (localData.abcIndex.findClass(ti, localData.abc, localData.scriptIndex) != null) {
|
||||
type.setVal(ti);
|
||||
callType.setVal(ti); //coercion i = int(xx);
|
||||
|
||||
+1
-1
@@ -63,7 +63,7 @@ public class GetSlotIns extends InstructionDefinition {
|
||||
if (t instanceof TraitSlotConst) {
|
||||
TraitSlotConst tsc = (TraitSlotConst) t;
|
||||
if (tsc.slot_id == slotIndex) {
|
||||
slotType = AbcIndexing.multinameToType(tsc.type_index, localData.abc, localData.abc.constants);
|
||||
slotType = AbcIndexing.multinameToType(localData.usedDeobfuscations, tsc.type_index, localData.abc, localData.abc.constants);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
+2
-2
@@ -85,7 +85,7 @@ public class SetSlotIns extends InstructionDefinition implements SetTypeIns {
|
||||
if (slotname != null) {
|
||||
if (value instanceof LocalRegAVM2Item) {
|
||||
LocalRegAVM2Item lr = (LocalRegAVM2Item) value;
|
||||
String slotNameStr = slotname.getName(localData.abc, localData.getConstants(), localData.fullyQualifiedNames, true, true);
|
||||
String slotNameStr = slotname.getName(localData.usedDeobfuscations, localData.abc, localData.getConstants(), localData.fullyQualifiedNames, true, true);
|
||||
if (localData.localRegNames.containsKey(lr.regIndex)) {
|
||||
if (localData.localRegNames.get(lr.regIndex).equals(slotNameStr)) {
|
||||
return; //Register with same name to slot
|
||||
@@ -150,7 +150,7 @@ public class SetSlotIns extends InstructionDefinition implements SetTypeIns {
|
||||
if (t instanceof TraitSlotConst) {
|
||||
TraitSlotConst tsc = (TraitSlotConst) t;
|
||||
if (tsc.slot_id == slotIndex) {
|
||||
slotType = AbcIndexing.multinameToType(tsc.type_index, localData.abc, localData.abc.constants);
|
||||
slotType = AbcIndexing.multinameToType(localData.usedDeobfuscations, tsc.type_index, localData.abc, localData.abc.constants);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
+3
-2
@@ -32,6 +32,7 @@ import com.jpexs.decompiler.graph.GraphTargetItem;
|
||||
import com.jpexs.decompiler.graph.TranslateStack;
|
||||
import com.jpexs.decompiler.graph.TypeItem;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* convert_m instruction - convert to decimal.
|
||||
@@ -68,11 +69,11 @@ public class ConvertMIns extends InstructionDefinition implements CoerceOrConver
|
||||
|
||||
@Override
|
||||
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
|
||||
stack.push(new ConvertAVM2Item(ins, localData.lineStartInstruction, stack.pop(), getTargetType(localData.abc, localData.getConstants(), ins)));
|
||||
stack.push(new ConvertAVM2Item(ins, localData.lineStartInstruction, stack.pop(), getTargetType(localData.usedDeobfuscations, localData.abc, localData.getConstants(), ins)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public GraphTargetItem getTargetType(ABC abc, AVM2ConstantPool constants, AVM2Instruction ins) {
|
||||
public GraphTargetItem getTargetType(Set<String> usedDeobfuscations, ABC abc, AVM2ConstantPool constants, AVM2Instruction ins) {
|
||||
return new TypeItem(DottedChain.DECIMAL);
|
||||
}
|
||||
}
|
||||
|
||||
+3
-2
@@ -33,6 +33,7 @@ import com.jpexs.decompiler.graph.GraphTargetItem;
|
||||
import com.jpexs.decompiler.graph.TranslateStack;
|
||||
import com.jpexs.decompiler.graph.TypeItem;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* convert_m_p instruction - convert to decimal with number context.
|
||||
@@ -69,11 +70,11 @@ public class ConvertMPIns extends InstructionDefinition implements CoerceOrConve
|
||||
|
||||
@Override
|
||||
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
|
||||
stack.push(new ConvertAVM2Item(ins, localData.lineStartInstruction, stack.pop(), getTargetType(localData.abc, localData.getConstants(), ins)));
|
||||
stack.push(new ConvertAVM2Item(ins, localData.lineStartInstruction, stack.pop(), getTargetType(localData.usedDeobfuscations, localData.abc, localData.getConstants(), ins)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public GraphTargetItem getTargetType(ABC abc, AVM2ConstantPool constants, AVM2Instruction ins) {
|
||||
public GraphTargetItem getTargetType(Set<String> usedDeobfuscations, ABC abc, AVM2ConstantPool constants, AVM2Instruction ins) {
|
||||
return new TypeItem(DottedChain.DECIMAL);
|
||||
}
|
||||
}
|
||||
|
||||
+2
-1
@@ -27,6 +27,7 @@ import com.jpexs.decompiler.flash.ecma.EcmaScript;
|
||||
import com.jpexs.decompiler.graph.DottedChain;
|
||||
import com.jpexs.decompiler.graph.GraphTargetItem;
|
||||
import com.jpexs.decompiler.graph.TypeItem;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* coerce_b instruction - coerce to boolean.
|
||||
@@ -60,7 +61,7 @@ public class CoerceBIns extends InstructionDefinition implements CoerceOrConvert
|
||||
}
|
||||
|
||||
@Override
|
||||
public GraphTargetItem getTargetType(ABC abc, AVM2ConstantPool constants, AVM2Instruction ins) {
|
||||
public GraphTargetItem getTargetType(Set<String> usedDeobfuscations, ABC abc, AVM2ConstantPool constants, AVM2Instruction ins) {
|
||||
return new TypeItem(DottedChain.BOOLEAN);
|
||||
}
|
||||
}
|
||||
|
||||
+2
-1
@@ -27,6 +27,7 @@ import com.jpexs.decompiler.flash.ecma.EcmaScript;
|
||||
import com.jpexs.decompiler.graph.DottedChain;
|
||||
import com.jpexs.decompiler.graph.GraphTargetItem;
|
||||
import com.jpexs.decompiler.graph.TypeItem;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* coerce_d instruction - coerce to double.
|
||||
@@ -60,7 +61,7 @@ public class CoerceDIns extends InstructionDefinition implements CoerceOrConvert
|
||||
}
|
||||
|
||||
@Override
|
||||
public GraphTargetItem getTargetType(ABC abc, AVM2ConstantPool constants, AVM2Instruction ins) {
|
||||
public GraphTargetItem getTargetType(Set<String> usedDeobfuscations, ABC abc, AVM2ConstantPool constants, AVM2Instruction ins) {
|
||||
return new TypeItem(DottedChain.NUMBER);
|
||||
}
|
||||
}
|
||||
|
||||
+2
-1
@@ -27,6 +27,7 @@ import com.jpexs.decompiler.flash.ecma.EcmaScript;
|
||||
import com.jpexs.decompiler.graph.DottedChain;
|
||||
import com.jpexs.decompiler.graph.GraphTargetItem;
|
||||
import com.jpexs.decompiler.graph.TypeItem;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* coerce_i instruction - coerce to int.
|
||||
@@ -60,7 +61,7 @@ public class CoerceIIns extends InstructionDefinition implements CoerceOrConvert
|
||||
}
|
||||
|
||||
@Override
|
||||
public GraphTargetItem getTargetType(ABC abc, AVM2ConstantPool constants, AVM2Instruction ins) {
|
||||
public GraphTargetItem getTargetType(Set<String> usedDeobfuscations, ABC abc, AVM2ConstantPool constants, AVM2Instruction ins) {
|
||||
return new TypeItem(DottedChain.INT);
|
||||
}
|
||||
}
|
||||
|
||||
+2
-1
@@ -27,6 +27,7 @@ import com.jpexs.decompiler.flash.ecma.EcmaScript;
|
||||
import com.jpexs.decompiler.graph.DottedChain;
|
||||
import com.jpexs.decompiler.graph.GraphTargetItem;
|
||||
import com.jpexs.decompiler.graph.TypeItem;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* coerce_u instruction - coerce to uint.
|
||||
@@ -60,7 +61,7 @@ public class CoerceUIns extends InstructionDefinition implements CoerceOrConvert
|
||||
}
|
||||
|
||||
@Override
|
||||
public GraphTargetItem getTargetType(ABC abc, AVM2ConstantPool constants, AVM2Instruction ins) {
|
||||
public GraphTargetItem getTargetType(Set<String> usedDeobfuscations, ABC abc, AVM2ConstantPool constants, AVM2Instruction ins) {
|
||||
return new TypeItem(DottedChain.UINT);
|
||||
}
|
||||
}
|
||||
|
||||
+3
-2
@@ -33,6 +33,7 @@ import com.jpexs.decompiler.graph.GraphTargetItem;
|
||||
import com.jpexs.decompiler.graph.TranslateStack;
|
||||
import com.jpexs.decompiler.graph.TypeItem;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* convert_f4 - Convert a value to a float4.
|
||||
@@ -78,11 +79,11 @@ public class ConvertF4Ins extends InstructionDefinition implements CoerceOrConve
|
||||
|
||||
@Override
|
||||
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
|
||||
stack.push(new ConvertAVM2Item(ins, localData.lineStartInstruction, stack.pop(), getTargetType(localData.abc, localData.getConstants(), ins)));
|
||||
stack.push(new ConvertAVM2Item(ins, localData.lineStartInstruction, stack.pop(), getTargetType(localData.usedDeobfuscations, localData.abc, localData.getConstants(), ins)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public GraphTargetItem getTargetType(ABC abc, AVM2ConstantPool constants, AVM2Instruction ins) {
|
||||
public GraphTargetItem getTargetType(Set<String> usedDeobfuscations, ABC abc, AVM2ConstantPool constants, AVM2Instruction ins) {
|
||||
return new TypeItem("float4");
|
||||
}
|
||||
}
|
||||
|
||||
+3
-2
@@ -32,6 +32,7 @@ import com.jpexs.decompiler.graph.GraphTargetItem;
|
||||
import com.jpexs.decompiler.graph.TranslateStack;
|
||||
import com.jpexs.decompiler.graph.TypeItem;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* convert_f - Convert a value to a float.
|
||||
@@ -77,11 +78,11 @@ public class ConvertFIns extends InstructionDefinition implements CoerceOrConver
|
||||
|
||||
@Override
|
||||
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
|
||||
stack.push(new ConvertAVM2Item(ins, localData.lineStartInstruction, stack.pop(), getTargetType(localData.abc, localData.getConstants(), ins)));
|
||||
stack.push(new ConvertAVM2Item(ins, localData.lineStartInstruction, stack.pop(), getTargetType(localData.usedDeobfuscations, localData.abc, localData.getConstants(), ins)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public GraphTargetItem getTargetType(ABC abc, AVM2ConstantPool constants, AVM2Instruction ins) {
|
||||
public GraphTargetItem getTargetType(Set<String> usedDeobfuscations, ABC abc, AVM2ConstantPool constants, AVM2Instruction ins) {
|
||||
return new TypeItem("float");
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -65,7 +65,7 @@ public class AsTypeIns extends InstructionDefinition {
|
||||
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
|
||||
GraphTargetItem val = stack.pop();
|
||||
|
||||
stack.push(new AsTypeAVM2Item(ins, localData.lineStartInstruction, val, new FullMultinameAVM2Item(false, ins, localData.lineStartInstruction, ins.operands[0], localData.abc.constants.getMultiname(ins.operands[0]).getName(localData.abc, localData.getConstants(), new ArrayList<>(), true, true))));
|
||||
stack.push(new AsTypeAVM2Item(ins, localData.lineStartInstruction, val, new FullMultinameAVM2Item(false, ins, localData.lineStartInstruction, ins.operands[0], localData.abc.constants.getMultiname(ins.operands[0]).getName(localData.usedDeobfuscations, localData.abc, localData.getConstants(), new ArrayList<>(), true, true))));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+3
-2
@@ -27,6 +27,7 @@ import com.jpexs.decompiler.graph.GraphTargetItem;
|
||||
import com.jpexs.decompiler.graph.TranslateStack;
|
||||
import com.jpexs.decompiler.graph.TypeItem;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* coerce_a instruction - Coerce any type.
|
||||
@@ -50,7 +51,7 @@ public class CoerceAIns extends InstructionDefinition implements CoerceOrConvert
|
||||
|
||||
@Override
|
||||
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
|
||||
stack.push(new CoerceAVM2Item(ins, localData.lineStartInstruction, stack.pop(), getTargetType(localData.abc, localData.getConstants(), ins)));
|
||||
stack.push(new CoerceAVM2Item(ins, localData.lineStartInstruction, stack.pop(), getTargetType(localData.usedDeobfuscations, localData.abc, localData.getConstants(), ins)));
|
||||
|
||||
}
|
||||
|
||||
@@ -73,7 +74,7 @@ public class CoerceAIns extends InstructionDefinition implements CoerceOrConvert
|
||||
}
|
||||
|
||||
@Override
|
||||
public GraphTargetItem getTargetType(ABC abc, AVM2ConstantPool constants, AVM2Instruction ins) {
|
||||
public GraphTargetItem getTargetType(Set<String> usedDeobfuscations, ABC abc, AVM2ConstantPool constants, AVM2Instruction ins) {
|
||||
return TypeItem.UNBOUNDED;
|
||||
}
|
||||
}
|
||||
|
||||
+4
-3
@@ -35,6 +35,7 @@ import com.jpexs.decompiler.flash.ecma.Undefined;
|
||||
import com.jpexs.decompiler.graph.GraphTargetItem;
|
||||
import com.jpexs.decompiler.graph.TranslateStack;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* coerce instruction - Coerce value to specified type.
|
||||
@@ -84,7 +85,7 @@ public class CoerceIns extends InstructionDefinition implements CoerceOrConvertT
|
||||
@Override
|
||||
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
|
||||
int multinameIndex = ins.operands[0];
|
||||
stack.push(new CoerceAVM2Item(ins, localData.lineStartInstruction, stack.pop(), AbcIndexing.multinameToType(multinameIndex, localData.abc, localData.getConstants())));
|
||||
stack.push(new CoerceAVM2Item(ins, localData.lineStartInstruction, stack.pop(), AbcIndexing.multinameToType(localData.usedDeobfuscations, multinameIndex, localData.abc, localData.getConstants())));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -98,8 +99,8 @@ public class CoerceIns extends InstructionDefinition implements CoerceOrConvertT
|
||||
}
|
||||
|
||||
@Override
|
||||
public GraphTargetItem getTargetType(ABC abc, AVM2ConstantPool constants, AVM2Instruction ins) {
|
||||
public GraphTargetItem getTargetType(Set<String> usedDeobfuscations, ABC abc, AVM2ConstantPool constants, AVM2Instruction ins) {
|
||||
int multinameIndex = ins.operands[0];
|
||||
return AbcIndexing.multinameToType(multinameIndex, abc, constants);
|
||||
return AbcIndexing.multinameToType(usedDeobfuscations, multinameIndex, abc, constants);
|
||||
}
|
||||
}
|
||||
|
||||
+2
-1
@@ -26,6 +26,7 @@ import com.jpexs.decompiler.flash.ecma.Undefined;
|
||||
import com.jpexs.decompiler.graph.DottedChain;
|
||||
import com.jpexs.decompiler.graph.GraphTargetItem;
|
||||
import com.jpexs.decompiler.graph.TypeItem;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* coerce_o instruction - Coerce to object type.
|
||||
@@ -64,7 +65,7 @@ public class CoerceOIns extends InstructionDefinition implements CoerceOrConvert
|
||||
}
|
||||
|
||||
@Override
|
||||
public GraphTargetItem getTargetType(ABC abc, AVM2ConstantPool constants, AVM2Instruction ins) {
|
||||
public GraphTargetItem getTargetType(Set<String> usedDeobfuscations, ABC abc, AVM2ConstantPool constants, AVM2Instruction ins) {
|
||||
return new TypeItem(DottedChain.OBJECT);
|
||||
}
|
||||
}
|
||||
|
||||
+3
-1
@@ -20,6 +20,7 @@ import com.jpexs.decompiler.flash.abc.ABC;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.instructions.AVM2Instruction;
|
||||
import com.jpexs.decompiler.graph.GraphTargetItem;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Coerce or convert type instruction interface.
|
||||
@@ -31,10 +32,11 @@ public interface CoerceOrConvertTypeIns {
|
||||
/**
|
||||
* Get target type of coercing or converting.
|
||||
*
|
||||
* @param usedDeobfuscations Used deobfuscations
|
||||
* @param abc ABC
|
||||
* @param constants Constants
|
||||
* @param ins Instruction
|
||||
* @return Target type
|
||||
*/
|
||||
public GraphTargetItem getTargetType(ABC abc, AVM2ConstantPool constants, AVM2Instruction ins);
|
||||
public GraphTargetItem getTargetType(Set<String> usedDeobfuscations, ABC abc, AVM2ConstantPool constants, AVM2Instruction ins);
|
||||
}
|
||||
|
||||
+3
-2
@@ -31,6 +31,7 @@ import com.jpexs.decompiler.graph.GraphTargetItem;
|
||||
import com.jpexs.decompiler.graph.TranslateStack;
|
||||
import com.jpexs.decompiler.graph.TypeItem;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* coerce_s instruction - Coerce value to string.
|
||||
@@ -64,7 +65,7 @@ public class CoerceSIns extends InstructionDefinition implements CoerceOrConvert
|
||||
|
||||
@Override
|
||||
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
|
||||
stack.push(new CoerceAVM2Item(ins, localData.lineStartInstruction, stack.pop(), getTargetType(localData.abc, localData.getConstants(), ins)));
|
||||
stack.push(new CoerceAVM2Item(ins, localData.lineStartInstruction, stack.pop(), getTargetType(localData.usedDeobfuscations, localData.abc, localData.getConstants(), ins)));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -78,7 +79,7 @@ public class CoerceSIns extends InstructionDefinition implements CoerceOrConvert
|
||||
}
|
||||
|
||||
@Override
|
||||
public GraphTargetItem getTargetType(ABC abc, AVM2ConstantPool constants, AVM2Instruction ins) {
|
||||
public GraphTargetItem getTargetType(Set<String> usedDeobfuscations, ABC abc, AVM2ConstantPool constants, AVM2Instruction ins) {
|
||||
return new TypeItem(DottedChain.STRING);
|
||||
}
|
||||
}
|
||||
|
||||
+3
-2
@@ -29,6 +29,7 @@ import com.jpexs.decompiler.graph.GraphTargetItem;
|
||||
import com.jpexs.decompiler.graph.TranslateStack;
|
||||
import com.jpexs.decompiler.graph.TypeItem;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* convert_b instruction - Convert to boolean.
|
||||
@@ -53,7 +54,7 @@ public class ConvertBIns extends InstructionDefinition implements CoerceOrConver
|
||||
|
||||
@Override
|
||||
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
|
||||
stack.push(new ConvertAVM2Item(ins, localData.lineStartInstruction, stack.pop(), getTargetType(localData.abc, localData.getConstants(), ins)));
|
||||
stack.push(new ConvertAVM2Item(ins, localData.lineStartInstruction, stack.pop(), getTargetType(localData.usedDeobfuscations, localData.abc, localData.getConstants(), ins)));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -67,7 +68,7 @@ public class ConvertBIns extends InstructionDefinition implements CoerceOrConver
|
||||
}
|
||||
|
||||
@Override
|
||||
public GraphTargetItem getTargetType(ABC abc, AVM2ConstantPool constants, AVM2Instruction ins) {
|
||||
public GraphTargetItem getTargetType(Set<String> usedDeobfuscations, ABC abc, AVM2ConstantPool constants, AVM2Instruction ins) {
|
||||
return new TypeItem(DottedChain.BOOLEAN);
|
||||
}
|
||||
}
|
||||
|
||||
+3
-2
@@ -29,6 +29,7 @@ import com.jpexs.decompiler.graph.GraphTargetItem;
|
||||
import com.jpexs.decompiler.graph.TranslateStack;
|
||||
import com.jpexs.decompiler.graph.TypeItem;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* convert_d instruction - Convert to number.
|
||||
@@ -53,7 +54,7 @@ public class ConvertDIns extends InstructionDefinition implements CoerceOrConver
|
||||
|
||||
@Override
|
||||
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
|
||||
stack.push(new ConvertAVM2Item(ins, localData.lineStartInstruction, stack.pop(), getTargetType(localData.abc, localData.getConstants(), ins)));
|
||||
stack.push(new ConvertAVM2Item(ins, localData.lineStartInstruction, stack.pop(), getTargetType(localData.usedDeobfuscations, localData.abc, localData.getConstants(), ins)));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -67,7 +68,7 @@ public class ConvertDIns extends InstructionDefinition implements CoerceOrConver
|
||||
}
|
||||
|
||||
@Override
|
||||
public GraphTargetItem getTargetType(ABC abc, AVM2ConstantPool constants, AVM2Instruction ins) {
|
||||
public GraphTargetItem getTargetType(Set<String> usedDeobfuscations, ABC abc, AVM2ConstantPool constants, AVM2Instruction ins) {
|
||||
return new TypeItem(DottedChain.NUMBER);
|
||||
}
|
||||
}
|
||||
|
||||
+3
-2
@@ -29,6 +29,7 @@ import com.jpexs.decompiler.graph.GraphTargetItem;
|
||||
import com.jpexs.decompiler.graph.TranslateStack;
|
||||
import com.jpexs.decompiler.graph.TypeItem;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* convert_i instruction - Convert to integer.
|
||||
@@ -53,7 +54,7 @@ public class ConvertIIns extends InstructionDefinition implements CoerceOrConver
|
||||
|
||||
@Override
|
||||
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
|
||||
stack.push(new ConvertAVM2Item(ins, localData.lineStartInstruction, stack.pop(), getTargetType(localData.abc, localData.getConstants(), ins)));
|
||||
stack.push(new ConvertAVM2Item(ins, localData.lineStartInstruction, stack.pop(), getTargetType(localData.usedDeobfuscations, localData.abc, localData.getConstants(), ins)));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -67,7 +68,7 @@ public class ConvertIIns extends InstructionDefinition implements CoerceOrConver
|
||||
}
|
||||
|
||||
@Override
|
||||
public GraphTargetItem getTargetType(ABC abc, AVM2ConstantPool constants, AVM2Instruction ins) {
|
||||
public GraphTargetItem getTargetType(Set<String> usedDeobfuscations, ABC abc, AVM2ConstantPool constants, AVM2Instruction ins) {
|
||||
return new TypeItem(DottedChain.INT);
|
||||
}
|
||||
}
|
||||
|
||||
+3
-2
@@ -31,6 +31,7 @@ import com.jpexs.decompiler.graph.GraphTargetItem;
|
||||
import com.jpexs.decompiler.graph.TranslateStack;
|
||||
import com.jpexs.decompiler.graph.TypeItem;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* convert_o instruction - Convert to object.
|
||||
@@ -63,7 +64,7 @@ public class ConvertOIns extends InstructionDefinition implements CoerceOrConver
|
||||
|
||||
@Override
|
||||
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
|
||||
stack.push(new ConvertAVM2Item(ins, localData.lineStartInstruction, stack.pop(), getTargetType(localData.abc, localData.getConstants(), ins)));
|
||||
stack.push(new ConvertAVM2Item(ins, localData.lineStartInstruction, stack.pop(), getTargetType(localData.usedDeobfuscations, localData.abc, localData.getConstants(), ins)));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -77,7 +78,7 @@ public class ConvertOIns extends InstructionDefinition implements CoerceOrConver
|
||||
}
|
||||
|
||||
@Override
|
||||
public GraphTargetItem getTargetType(ABC abc, AVM2ConstantPool constants, AVM2Instruction ins) {
|
||||
public GraphTargetItem getTargetType(Set<String> usedDeobfuscations, ABC abc, AVM2ConstantPool constants, AVM2Instruction ins) {
|
||||
return new TypeItem(DottedChain.OBJECT);
|
||||
}
|
||||
}
|
||||
|
||||
+3
-2
@@ -29,6 +29,7 @@ import com.jpexs.decompiler.graph.GraphTargetItem;
|
||||
import com.jpexs.decompiler.graph.TranslateStack;
|
||||
import com.jpexs.decompiler.graph.TypeItem;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* convert_s instruction - Convert to string.
|
||||
@@ -53,7 +54,7 @@ public class ConvertSIns extends InstructionDefinition implements CoerceOrConver
|
||||
|
||||
@Override
|
||||
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
|
||||
stack.push(new ConvertAVM2Item(ins, localData.lineStartInstruction, stack.pop(), getTargetType(localData.abc, localData.getConstants(), ins)));
|
||||
stack.push(new ConvertAVM2Item(ins, localData.lineStartInstruction, stack.pop(), getTargetType(localData.usedDeobfuscations, localData.abc, localData.getConstants(), ins)));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -67,7 +68,7 @@ public class ConvertSIns extends InstructionDefinition implements CoerceOrConver
|
||||
}
|
||||
|
||||
@Override
|
||||
public GraphTargetItem getTargetType(ABC abc, AVM2ConstantPool constants, AVM2Instruction ins) {
|
||||
public GraphTargetItem getTargetType(Set<String> usedDeobfuscations, ABC abc, AVM2ConstantPool constants, AVM2Instruction ins) {
|
||||
return new TypeItem(DottedChain.STRING);
|
||||
}
|
||||
}
|
||||
|
||||
+3
-2
@@ -29,6 +29,7 @@ import com.jpexs.decompiler.graph.GraphTargetItem;
|
||||
import com.jpexs.decompiler.graph.TranslateStack;
|
||||
import com.jpexs.decompiler.graph.TypeItem;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* convert_u instruction - Convert to unsigned integer.
|
||||
@@ -53,7 +54,7 @@ public class ConvertUIns extends InstructionDefinition implements CoerceOrConver
|
||||
|
||||
@Override
|
||||
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
|
||||
stack.push(new ConvertAVM2Item(ins, localData.lineStartInstruction, stack.pop(), getTargetType(localData.abc, localData.getConstants(), ins)));
|
||||
stack.push(new ConvertAVM2Item(ins, localData.lineStartInstruction, stack.pop(), getTargetType(localData.usedDeobfuscations, localData.abc, localData.getConstants(), ins)));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -67,7 +68,7 @@ public class ConvertUIns extends InstructionDefinition implements CoerceOrConver
|
||||
}
|
||||
|
||||
@Override
|
||||
public GraphTargetItem getTargetType(ABC abc, AVM2ConstantPool constants, AVM2Instruction ins) {
|
||||
public GraphTargetItem getTargetType(Set<String> usedDeobfuscations, ABC abc, AVM2ConstantPool constants, AVM2Instruction ins) {
|
||||
return new TypeItem(DottedChain.UINT);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -46,7 +46,7 @@ public class IsTypeIns extends InstructionDefinition {
|
||||
public void translate(AVM2LocalData localData, TranslateStack stack, AVM2Instruction ins, List<GraphTargetItem> output, String path) {
|
||||
int multinameIndex = ins.operands[0];
|
||||
GraphTargetItem value = stack.pop();
|
||||
stack.push(new IsTypeAVM2Item(ins, localData.lineStartInstruction, value, new FullMultinameAVM2Item(false, ins, localData.lineStartInstruction, multinameIndex, localData.abc.constants.getMultiname(multinameIndex).getName(localData.abc, localData.getConstants(), new ArrayList<>(), true, true))));
|
||||
stack.push(new IsTypeAVM2Item(ins, localData.lineStartInstruction, value, new FullMultinameAVM2Item(false, ins, localData.lineStartInstruction, multinameIndex, localData.abc.constants.getMultiname(multinameIndex).getName(localData.usedDeobfuscations, localData.abc, localData.getConstants(), new ArrayList<>(), true, true))));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -37,7 +37,9 @@ import com.jpexs.decompiler.graph.SourceGenerator;
|
||||
import com.jpexs.decompiler.graph.model.LocalData;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* AVM2 item base class.
|
||||
@@ -197,11 +199,12 @@ public abstract class AVM2Item extends GraphTargetItem {
|
||||
* @param swf SWF
|
||||
* @param localRegNames Local register names
|
||||
* @param reg Register
|
||||
* @param usedDeobfuscations Used deobfuscations
|
||||
* @return Local register name
|
||||
*/
|
||||
public static String localRegName(SWF swf, HashMap<Integer, String> localRegNames, int reg) {
|
||||
public static String localRegName(SWF swf, HashMap<Integer, String> localRegNames, int reg, Set<String> usedDeobfuscations) {
|
||||
if (localRegNames.containsKey(reg)) {
|
||||
return IdentifiersDeobfuscation.printIdentifier(swf, true, localRegNames.get(reg));
|
||||
return IdentifiersDeobfuscation.printIdentifier(swf, usedDeobfuscations, true, localRegNames.get(reg));
|
||||
} else {
|
||||
if (reg == 0) {
|
||||
return "this";
|
||||
|
||||
@@ -65,11 +65,11 @@ public class ClassAVM2Item extends AVM2Item {
|
||||
public GraphTextWriter appendTo(GraphTextWriter writer, LocalData localData) {
|
||||
if (classNameAsStr != null) {
|
||||
if (localData.fullyQualifiedNames != null && localData.fullyQualifiedNames.contains(classNameAsStr)) {
|
||||
return writer.append(classNameAsStr.toPrintableString(localData.swf, true));
|
||||
return writer.append(classNameAsStr.toPrintableString(localData.usedDeobfuscations, localData.swf, true));
|
||||
}
|
||||
return writer.append(IdentifiersDeobfuscation.printIdentifier(localData.abc.getSwf(), true, classNameAsStr.getLast()));
|
||||
return writer.append(IdentifiersDeobfuscation.printIdentifier(localData.abc.getSwf(), localData.usedDeobfuscations, true, classNameAsStr.getLast()));
|
||||
}
|
||||
return writer.append(className.getName(localData.abc, localData.constantsAvm2, localData.fullyQualifiedNames, false, true));
|
||||
return writer.append(className.getName(localData.usedDeobfuscations, localData.abc, localData.constantsAvm2, localData.fullyQualifiedNames, false, true));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+1
-1
@@ -47,7 +47,7 @@ public class DecLocalAVM2Item extends AVM2Item {
|
||||
|
||||
@Override
|
||||
public GraphTextWriter appendTo(GraphTextWriter writer, LocalData localData) {
|
||||
writer.append(localRegName(localData.abc.getSwf(), localData.localRegNames, regIndex));
|
||||
writer.append(localRegName(localData.abc.getSwf(), localData.localRegNames, regIndex, localData.usedDeobfuscations));
|
||||
return writer.append("--");
|
||||
}
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ public class FindDefAVM2Item extends AVM2Item {
|
||||
|
||||
@Override
|
||||
public GraphTextWriter appendTo(GraphTextWriter writer, LocalData localData) {
|
||||
return writer.append(propertyName.getNamespace(localData.constantsAvm2).getName(localData.constantsAvm2).toPrintableString(localData.swf, true)); //assume not null name
|
||||
return writer.append(propertyName.getNamespace(localData.constantsAvm2).getName(localData.constantsAvm2).toPrintableString(localData.usedDeobfuscations, localData.swf, true)); //assume not null name
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+8
-7
@@ -32,6 +32,7 @@ import com.jpexs.decompiler.graph.model.LocalData;
|
||||
import com.jpexs.helpers.Reference;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
@@ -154,17 +155,17 @@ public class FullMultinameAVM2Item extends AVM2Item {
|
||||
public boolean isTopLevel(String tname, ABC abc, HashMap<Integer, String> localRegNames, List<DottedChain> fullyQualifiedNames, Set<Integer> seenMethods) throws InterruptedException {
|
||||
String cname;
|
||||
if (name != null) {
|
||||
cname = name.toString(LocalData.create(new ArrayList<>(), null, abc, localRegNames, fullyQualifiedNames, seenMethods, ScriptExportMode.AS, -1));
|
||||
cname = name.toString(LocalData.create(new ArrayList<>(), null, abc, localRegNames, fullyQualifiedNames, seenMethods, ScriptExportMode.AS, -1, new LinkedHashSet<>()));
|
||||
} else {
|
||||
cname = (abc.constants.getMultiname(multinameIndex).getName(abc, abc.constants, fullyQualifiedNames, true, true));
|
||||
cname = (abc.constants.getMultiname(multinameIndex).getName(new LinkedHashSet<>(), abc, abc.constants, fullyQualifiedNames, true, true));
|
||||
}
|
||||
String cns = "";
|
||||
if (namespace != null) {
|
||||
cns = namespace.toString(LocalData.create(new ArrayList<>(), null, abc, localRegNames, fullyQualifiedNames, seenMethods, ScriptExportMode.AS, -1));
|
||||
cns = namespace.toString(LocalData.create(new ArrayList<>(), null, abc, localRegNames, fullyQualifiedNames, seenMethods, ScriptExportMode.AS, -1, new LinkedHashSet<>()));
|
||||
} else {
|
||||
Namespace ns = abc.constants.getMultiname(multinameIndex).getNamespace(abc.constants);
|
||||
if ((ns != null) && (ns.name_index != 0)) {
|
||||
cns = ns.getName(abc.constants).toPrintableString(abc.getSwf(), true);
|
||||
cns = ns.getName(abc.constants).toPrintableString(new LinkedHashSet<>(), abc.getSwf(), true);
|
||||
}
|
||||
}
|
||||
return cname.equals(tname) && cns.isEmpty();
|
||||
@@ -206,16 +207,16 @@ public class FullMultinameAVM2Item extends AVM2Item {
|
||||
AVM2ConstantPool constants = localData.constantsAvm2;
|
||||
List<DottedChain> fullyQualifiedNames = property ? new ArrayList<>() : localData.fullyQualifiedNames;
|
||||
if (multinameIndex > 0 && multinameIndex < constants.getMultinameCount()) {
|
||||
String simpleName = constants.getMultiname(multinameIndex).getName(localData.abc, constants, fullyQualifiedNames, true, false);
|
||||
String simpleName = constants.getMultiname(multinameIndex).getName(localData.usedDeobfuscations, localData.abc, constants, fullyQualifiedNames, true, false);
|
||||
if ("*".equals(simpleName)) {
|
||||
writer.append("*");
|
||||
} else {
|
||||
Reference<DottedChain> customNsRef = new Reference<>(null);
|
||||
String localName = constants.getMultiname(multinameIndex).getNameAndCustomNamespace(localData.abc, localData.fullyQualifiedNames, false, true, customNsRef);
|
||||
String localName = constants.getMultiname(multinameIndex).getNameAndCustomNamespace(localData.usedDeobfuscations, localData.abc, localData.fullyQualifiedNames, false, true, customNsRef);
|
||||
DottedChain customNs = customNsRef.getVal();
|
||||
if (customNs != null) {
|
||||
String nsname = customNs.getLast();
|
||||
String identifier = IdentifiersDeobfuscation.printIdentifier(localData.abc.getSwf(), true, nsname);
|
||||
String identifier = IdentifiersDeobfuscation.printIdentifier(localData.abc.getSwf(), localData.usedDeobfuscations, true, nsname);
|
||||
writer.hilightSpecial(identifier, HighlightSpecialType.TYPE_NAME, customNs.toRawString());
|
||||
writer.appendNoHilight("::");
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ import com.jpexs.decompiler.graph.GraphTargetItem;
|
||||
import com.jpexs.decompiler.graph.model.LocalData;
|
||||
import com.jpexs.helpers.Reference;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Find and get property.
|
||||
@@ -72,12 +73,12 @@ public class GetLexAVM2Item extends AVM2Item {
|
||||
* @param callType Call type
|
||||
* @param isStatic Is static
|
||||
*/
|
||||
public GetLexAVM2Item(GraphSourceItem instruction, GraphSourceItem lineStartIns, Multiname propertyName, ABC abc, AVM2ConstantPool constants, GraphTargetItem type, GraphTargetItem callType, boolean isStatic) {
|
||||
public GetLexAVM2Item(GraphSourceItem instruction, GraphSourceItem lineStartIns, Multiname propertyName, ABC abc, AVM2ConstantPool constants, GraphTargetItem type, GraphTargetItem callType, boolean isStatic, Set<String> usedDeobfuscations) {
|
||||
super(instruction, lineStartIns, PRECEDENCE_PRIMARY);
|
||||
this.propertyName = propertyName;
|
||||
this.type = type;
|
||||
this.callType = callType;
|
||||
this.fullPropertyName = propertyName.getNameWithNamespace(abc, constants, true);
|
||||
this.fullPropertyName = propertyName.getNameWithNamespace(usedDeobfuscations, abc, constants, true);
|
||||
this.isStatic = isStatic;
|
||||
}
|
||||
|
||||
@@ -92,11 +93,11 @@ public class GetLexAVM2Item extends AVM2Item {
|
||||
@Override
|
||||
public GraphTextWriter appendTo(GraphTextWriter writer, LocalData localData) {
|
||||
Reference<DottedChain> customNsRef = new Reference<>(null);
|
||||
String localName = propertyName.getNameAndCustomNamespace(localData.abc, localData.fullyQualifiedNames, false, true, customNsRef);
|
||||
String localName = propertyName.getNameAndCustomNamespace(localData.usedDeobfuscations, localData.abc, localData.fullyQualifiedNames, false, true, customNsRef);
|
||||
DottedChain customNs = customNsRef.getVal();
|
||||
if (customNs != null) {
|
||||
String nsname = customNs.getLast();
|
||||
String identifier = IdentifiersDeobfuscation.printIdentifier(localData.abc.getSwf(), true, nsname);
|
||||
String identifier = IdentifiersDeobfuscation.printIdentifier(localData.abc.getSwf(), localData.usedDeobfuscations, true, nsname);
|
||||
writer.hilightSpecial(identifier, HighlightSpecialType.TYPE_NAME, customNs.toRawString());
|
||||
writer.appendNoHilight("::");
|
||||
getSrcData().localName = nsname + "::" + localName;
|
||||
|
||||
@@ -93,7 +93,7 @@ public class GetSlotAVM2Item extends AVM2Item {
|
||||
if (slotName == null) {
|
||||
return slotObject.toString(localData) + ".§§slot[" + slotIndex + "]";
|
||||
}
|
||||
return slotName.getName(localData.abc, localData.constantsAvm2, localData.fullyQualifiedNames, false, true);
|
||||
return slotName.getName(localData.usedDeobfuscations, localData.abc, localData.constantsAvm2, localData.fullyQualifiedNames, false, true);
|
||||
}
|
||||
|
||||
public GraphTextWriter getName(GraphTextWriter writer, LocalData localData) throws InterruptedException {
|
||||
|
||||
+1
-1
@@ -47,7 +47,7 @@ public class IncLocalAVM2Item extends AVM2Item {
|
||||
|
||||
@Override
|
||||
public GraphTextWriter appendTo(GraphTextWriter writer, LocalData localData) {
|
||||
writer.append(localRegName(localData.abc.getSwf(), localData.localRegNames, regIndex));
|
||||
writer.append(localRegName(localData.abc.getSwf(), localData.localRegNames, regIndex, localData.usedDeobfuscations));
|
||||
return writer.append("++");
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -91,7 +91,7 @@ public class LocalRegAVM2Item extends AVM2Item {
|
||||
return computedValue.toString(writer, localData);
|
||||
}
|
||||
|
||||
String localName = localRegName(localData.abc.getSwf(), localData.localRegNames, regIndex);
|
||||
String localName = localRegName(localData.abc.getSwf(), localData.localRegNames, regIndex, localData.usedDeobfuscations);
|
||||
getSrcData().localName = localName;
|
||||
return writer.append(localName);
|
||||
}
|
||||
|
||||
+1
-1
@@ -60,7 +60,7 @@ public class NameSpaceAVM2Item extends AVM2Item {
|
||||
String nsname = dc != null ? dc.getLast() : null;
|
||||
|
||||
if (nsname != null) {
|
||||
String identifier = IdentifiersDeobfuscation.printIdentifier(localData.abc.getSwf(), true, nsname);
|
||||
String identifier = IdentifiersDeobfuscation.printIdentifier(localData.abc.getSwf(), localData.usedDeobfuscations, true, nsname);
|
||||
if (identifier != null && !identifier.isEmpty()) {
|
||||
writer.append(identifier);
|
||||
return writer;
|
||||
|
||||
+4
-4
@@ -116,7 +116,7 @@ public class NewFunctionAVM2Item extends AVM2Item {
|
||||
writer.startMethod(methodIndex, null);
|
||||
writer.append((!functionName.isEmpty() ? " " + functionName : ""));
|
||||
writer.appendNoHilight("(");
|
||||
abc.method_info.get(methodIndex).getParamStr(writer, abc.constants, body, abc, localData.fullyQualifiedNames);
|
||||
abc.method_info.get(methodIndex).getParamStr(writer, abc.constants, body, abc, localData.fullyQualifiedNames, localData.usedDeobfuscations);
|
||||
writer.appendNoHilight("):");
|
||||
if (Configuration.showMethodBodyId.get()) {
|
||||
writer.appendNoHilight("// method body index: ");
|
||||
@@ -125,13 +125,13 @@ public class NewFunctionAVM2Item extends AVM2Item {
|
||||
writer.appendNoHilight(methodIndex);
|
||||
writer.newLine();
|
||||
}
|
||||
abc.method_info.get(methodIndex).getReturnTypeStr(writer, abc, abc.constants, localData.fullyQualifiedNames);
|
||||
abc.method_info.get(methodIndex).getReturnTypeStr(writer, abc, abc.constants, localData.fullyQualifiedNames, localData.usedDeobfuscations);
|
||||
writer.startBlock();
|
||||
if (body != null) {
|
||||
List<MethodBody> callStack = new ArrayList<>(localData.callStack);
|
||||
callStack.add(body);
|
||||
body.convert(localData.swfVersion, callStack, localData.abcIndex, new ConvertData(), path + "/inner", ScriptExportMode.AS, isStatic, methodIndex, scriptIndex, classIndex, abc, null, scopeStack, 0, new NulWriter(), localData.fullyQualifiedNames, null, false, new HashSet<>(localData.seenMethods), new ArrayList<>());
|
||||
body.toString(localData.swfVersion, callStack, localData.abcIndex, path + "/inner", ScriptExportMode.AS, abc, null, writer, localData.fullyQualifiedNames, new HashSet<>(localData.seenMethods));
|
||||
body.convert(localData.swfVersion, callStack, localData.abcIndex, new ConvertData(), path + "/inner", ScriptExportMode.AS, isStatic, methodIndex, scriptIndex, classIndex, abc, null, scopeStack, 0, new NulWriter(), localData.fullyQualifiedNames, null, false, new HashSet<>(localData.seenMethods), new ArrayList<>(), localData.usedDeobfuscations);
|
||||
body.toString(localData.usedDeobfuscations, localData.swfVersion, callStack, localData.abcIndex, path + "/inner", ScriptExportMode.AS, abc, null, writer, localData.fullyQualifiedNames, new HashSet<>(localData.seenMethods));
|
||||
}
|
||||
writer.endBlock();
|
||||
writer.endMethod();
|
||||
|
||||
@@ -51,7 +51,7 @@ public class PackageAVM2Item extends AVM2Item {
|
||||
public GraphTextWriter appendTo(GraphTextWriter writer, LocalData localData) throws InterruptedException {
|
||||
writer.appendNoHilight("package");
|
||||
if (!packageName.isEmpty()) {
|
||||
writer.appendNoHilight(" " + DottedChain.parseWithSuffix(packageName).toPrintableString(localData.swf, true));
|
||||
writer.appendNoHilight(" " + DottedChain.parseWithSuffix(packageName).toPrintableString(localData.usedDeobfuscations, localData.swf, true));
|
||||
}
|
||||
writer.startBlock();
|
||||
Graph.graphToString(items, writer, localData);
|
||||
|
||||
+1
-1
@@ -104,7 +104,7 @@ public class SetLocalAVM2Item extends AVM2Item implements SetTypeAVM2Item, Assig
|
||||
|
||||
@Override
|
||||
public GraphTextWriter appendTo(GraphTextWriter writer, LocalData localData) throws InterruptedException {
|
||||
String localName = localRegName(localData.abc.getSwf(), localData.localRegNames, regIndex);
|
||||
String localName = localRegName(localData.abc.getSwf(), localData.localRegNames, regIndex, localData.usedDeobfuscations);
|
||||
getSrcData().localName = localName;
|
||||
writer.append(localName);
|
||||
if (hideValue) {
|
||||
|
||||
@@ -152,7 +152,7 @@ public class SetSlotAVM2Item extends AVM2Item implements SetTypeAVM2Item, Assign
|
||||
if (slotName == null) {
|
||||
return slotObject.toString(localData) + ".§§slot[" + slotIndex + "]";
|
||||
}
|
||||
return slotName.getName(localData.abc, localData.constantsAvm2, localData.fullyQualifiedNames, false, true);
|
||||
return slotName.getName(localData.usedDeobfuscations, localData.abc, localData.constantsAvm2, localData.fullyQualifiedNames, false, true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -114,9 +114,9 @@ public class ThisAVM2Item extends AVM2Item {
|
||||
if (showClassName) {
|
||||
if (className != null) {
|
||||
if (localData.fullyQualifiedNames != null && localData.fullyQualifiedNames.contains(className)) {
|
||||
return writer.append(className.toPrintableString(localData.swf, true)).append(".this");
|
||||
return writer.append(className.toPrintableString(localData.usedDeobfuscations, localData.swf, true)).append(".this");
|
||||
}
|
||||
return writer.append(IdentifiersDeobfuscation.printIdentifier(localData.abc.getSwf(), true, className.getLast())).append(".this");
|
||||
return writer.append(IdentifiersDeobfuscation.printIdentifier(localData.abc.getSwf(), localData.usedDeobfuscations, true, className.getLast())).append(".this");
|
||||
}
|
||||
}
|
||||
return writer.append("this");
|
||||
|
||||
+1
@@ -92,6 +92,7 @@ public class TraitSlotConstAVM2Item extends AVM2Item {
|
||||
cd.assignedValues.put(trait, new AssignedValue(null, assignedValue, initializer, methodIndex));
|
||||
boolean insideInterface = classIndex > -1 ? localData.abc.instance_info.get(classIndex).isInterface() : false;
|
||||
trait.toString(
|
||||
localData.usedDeobfuscations,
|
||||
localData.swfVersion,
|
||||
localData.abcIndex,
|
||||
DottedChain.EMPTY /*??*/,
|
||||
|
||||
+3
-3
@@ -92,7 +92,7 @@ public class DeclarationAVM2Item extends AVM2Item {
|
||||
|
||||
if (assignment instanceof LocalRegAVM2Item) { //for..in
|
||||
LocalRegAVM2Item lti = (LocalRegAVM2Item) assignment;
|
||||
String localName = localRegName(localData.abc.getSwf(), localData.localRegNames, lti.regIndex);
|
||||
String localName = localRegName(localData.abc.getSwf(), localData.localRegNames, lti.regIndex, localData.usedDeobfuscations);
|
||||
HighlightData srcData = getSrcData();
|
||||
srcData.localName = localName;
|
||||
srcData.declaration = true;
|
||||
@@ -116,7 +116,7 @@ public class DeclarationAVM2Item extends AVM2Item {
|
||||
|
||||
if (assignment instanceof SetLocalAVM2Item) {
|
||||
SetLocalAVM2Item lti = (SetLocalAVM2Item) assignment;
|
||||
String localName = localRegName(localData.abc.getSwf(), localData.localRegNames, lti.regIndex);
|
||||
String localName = localRegName(localData.abc.getSwf(), localData.localRegNames, lti.regIndex, localData.usedDeobfuscations);
|
||||
HighlightData srcData = getSrcData();
|
||||
srcData.localName = localName;
|
||||
srcData.declaration = true;
|
||||
@@ -163,7 +163,7 @@ public class DeclarationAVM2Item extends AVM2Item {
|
||||
GraphTargetItem val = spti.value;
|
||||
srcData.declaredType = (type instanceof TypeItem) ? ((TypeItem) type).fullTypeName : DottedChain.ALL;
|
||||
writer.append("var ");
|
||||
writer.append(IdentifiersDeobfuscation.printIdentifier(localData.abc.getSwf(), true, ((FullMultinameAVM2Item) spti.propertyName).resolvedMultinameName));
|
||||
writer.append(IdentifiersDeobfuscation.printIdentifier(localData.abc.getSwf(), localData.usedDeobfuscations, true, ((FullMultinameAVM2Item) spti.propertyName).resolvedMultinameName));
|
||||
writer.append(":");
|
||||
|
||||
type.appendTry(writer, localData);
|
||||
|
||||
+1
-1
@@ -47,7 +47,7 @@ public class ExceptionAVM2Item extends AVM2Item {
|
||||
|
||||
@Override
|
||||
public GraphTextWriter appendTo(GraphTextWriter writer, LocalData localData) {
|
||||
return writer.append(exception.getVarName(localData.abc, localData.constantsAvm2, localData.fullyQualifiedNames));
|
||||
return writer.append(exception.getVarName(localData.usedDeobfuscations, localData.abc, localData.constantsAvm2, localData.fullyQualifiedNames));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+3
-3
@@ -142,7 +142,7 @@ public class TryAVM2Item extends AVM2Item implements Block {
|
||||
for (int e = 0; e < catchExceptions.size(); e++) {
|
||||
writer.newLine();
|
||||
writer.append("catch(");
|
||||
String localName = catchExceptions.get(e).getVarName(localData.abc, localData.constantsAvm2, localData.fullyQualifiedNames);
|
||||
String localName = catchExceptions.get(e).getVarName(localData.usedDeobfuscations, localData.abc, localData.constantsAvm2, localData.fullyQualifiedNames);
|
||||
if (localName.isEmpty()) {
|
||||
localName = finCatchName;
|
||||
}
|
||||
@@ -153,10 +153,10 @@ public class TryAVM2Item extends AVM2Item implements Block {
|
||||
|
||||
int eti = catchExceptions.get(e).type_index;
|
||||
|
||||
data.declaredType = eti <= 0 ? DottedChain.ALL : localData.constantsAvm2.getMultiname(eti).getNameWithNamespace(localData.abc, localData.constantsAvm2, true);
|
||||
data.declaredType = eti <= 0 ? DottedChain.ALL : localData.constantsAvm2.getMultiname(eti).getNameWithNamespace(localData.usedDeobfuscations, localData.abc, localData.constantsAvm2, true);
|
||||
writer.hilightSpecial(localName, HighlightSpecialType.TRY_NAME, e, data);
|
||||
writer.append(":");
|
||||
writer.hilightSpecial(catchExceptions.get(e).getTypeName(localData.abc, localData.constantsAvm2, localData.fullyQualifiedNames), HighlightSpecialType.TRY_TYPE, e);
|
||||
writer.hilightSpecial(catchExceptions.get(e).getTypeName(localData.usedDeobfuscations, localData.abc, localData.constantsAvm2, localData.fullyQualifiedNames), HighlightSpecialType.TRY_TYPE, e);
|
||||
writer.append(")");
|
||||
List<GraphTargetItem> commands = catchCommands.get(e);
|
||||
appendBlock(null, writer, localData, commands);
|
||||
|
||||
+16
-15
@@ -116,6 +116,7 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
@@ -231,7 +232,7 @@ public class AVM2SourceGenerator implements SourceGenerator {
|
||||
Multiname m = ci.abc.instance_info.get(ci.index).getName(ci.abc.constants);
|
||||
if (m != null) {
|
||||
Namespace ns = ci.abc.instance_info.get(ci.index).getName(ci.abc.constants).getNamespace(ci.abc.constants);
|
||||
String n = m.getName(ci.abc, ci.abc.constants, new ArrayList<>(), true, true /*FIXME!!*/);
|
||||
String n = m.getName(new LinkedHashSet<>(), ci.abc, ci.abc.constants, new ArrayList<>(), true, true /*FIXME!!*/);
|
||||
String nsn = ns == null ? null : ns.getRawName(ci.abc.constants);
|
||||
name_index = constants.getQnameId(
|
||||
n,
|
||||
@@ -253,7 +254,7 @@ public class AVM2SourceGenerator implements SourceGenerator {
|
||||
if (name_index == 0) {
|
||||
if (pkg.isEmpty() && localData.currentScript != null /*FIXME!*/) {
|
||||
for (Trait t : localData.currentScript.traits.traits) {
|
||||
if (t.getName(abc).getName(abc, constants, null, true, true /*FIXME!!*/).equals(name)) {
|
||||
if (t.getName(abc).getName(new LinkedHashSet<>(), abc, constants, null, true, true /*FIXME!!*/).equals(name)) {
|
||||
name_index = t.name_index;
|
||||
break;
|
||||
}
|
||||
@@ -718,7 +719,7 @@ public class AVM2SourceGenerator implements SourceGenerator {
|
||||
List<MethodBody> callStack = new ArrayList<>();
|
||||
callStack.add(pcinit);
|
||||
try {
|
||||
pcinit.convert(-1 /*FIXME??*/, callStack, null, d, "-", ScriptExportMode.AS, true, mi, -1, ci.index, ci.abc, null, new ScopeStack(), GraphTextWriter.TRAIT_CLASS_INITIALIZER, new NulWriter(), new ArrayList<>(), ci.abc.class_info.get(ci.index).static_traits, false, new HashSet<>(), new ArrayList<>());
|
||||
pcinit.convert(-1 /*FIXME??*/, callStack, null, d, "-", ScriptExportMode.AS, true, mi, -1, ci.index, ci.abc, null, new ScopeStack(), GraphTextWriter.TRAIT_CLASS_INITIALIZER, new NulWriter(), new ArrayList<>(), ci.abc.class_info.get(ci.index).static_traits, false, new HashSet<>(), new ArrayList<>(), new LinkedHashSet<>());
|
||||
//FIXME! Add skinparts from _skinParts attribute of parent class!!!
|
||||
} catch (InterruptedException ex) {
|
||||
Logger.getLogger(AVM2SourceGenerator.class.getName()).log(Level.SEVERE, "Getting parent skinparts interrupted", ex);
|
||||
@@ -727,7 +728,7 @@ public class AVM2SourceGenerator implements SourceGenerator {
|
||||
if (t instanceof TraitSlotConst) {
|
||||
TraitSlotConst tsc = (TraitSlotConst) t;
|
||||
if (tsc.kindType == Trait.TRAIT_SLOT) {
|
||||
if ("_skinParts".equals(tsc.getName(ci.abc).getName(ci.abc, ci.abc.constants, new ArrayList<>(), true, true))) {
|
||||
if ("_skinParts".equals(tsc.getName(ci.abc).getName(new LinkedHashSet<>(), ci.abc, ci.abc.constants, new ArrayList<>(), true, true))) {
|
||||
if (d.assignedValues.containsKey(tsc)) {
|
||||
if (d.assignedValues.get(tsc).value instanceof NewObjectAVM2Item) {
|
||||
NewObjectAVM2Item no = (NewObjectAVM2Item) d.assignedValues.get(tsc).value;
|
||||
@@ -1812,7 +1813,7 @@ public class AVM2SourceGenerator implements SourceGenerator {
|
||||
instanceInfo.super_index = abcIndex.getSelectedAbc().constants.getMultinameId(Multiname.createQName(false, str("Object"), namespace(Namespace.KIND_PACKAGE, "")), true);
|
||||
}
|
||||
if (instanceInfo.super_index != 0) {
|
||||
int foundClass = abc.findClassByName(abc.constants.getMultiname(instanceInfo.super_index).getNameWithNamespace(abc, abc.constants, true));
|
||||
int foundClass = abc.findClassByName(abc.constants.getMultiname(instanceInfo.super_index).getNameWithNamespace(new LinkedHashSet<>(), abc, abc.constants, true));
|
||||
if (foundClass > -1) {
|
||||
if (foundClass > minClassIndex) {
|
||||
minClassIndex = foundClass;
|
||||
@@ -1822,7 +1823,7 @@ public class AVM2SourceGenerator implements SourceGenerator {
|
||||
instanceInfo.interfaces = new int[((ClassAVM2Item) item).implementsOp.size()];
|
||||
for (int i = 0; i < ((ClassAVM2Item) item).implementsOp.size(); i++) {
|
||||
instanceInfo.interfaces[i] = superIntName(localData, ((ClassAVM2Item) item).implementsOp.get(i));
|
||||
int foundIface = abc.findClassByName(abc.constants.getMultiname(instanceInfo.interfaces[i]).getNameWithNamespace(abc, abc.constants, true));
|
||||
int foundIface = abc.findClassByName(abc.constants.getMultiname(instanceInfo.interfaces[i]).getNameWithNamespace(new LinkedHashSet<>(), abc, abc.constants, true));
|
||||
if (foundIface > -1) {
|
||||
if (foundIface > minClassIndex) {
|
||||
minClassIndex = foundIface;
|
||||
@@ -1845,7 +1846,7 @@ public class AVM2SourceGenerator implements SourceGenerator {
|
||||
GraphTargetItem un = ((InterfaceAVM2Item) item).superInterfaces.get(i);
|
||||
instanceInfo.interfaces[i] = superIntName(localData, un);
|
||||
|
||||
int foundIface = abc.findClassByName(abc.constants.getMultiname(instanceInfo.interfaces[i]).getNameWithNamespace(abc, abc.constants, true));
|
||||
int foundIface = abc.findClassByName(abc.constants.getMultiname(instanceInfo.interfaces[i]).getNameWithNamespace(new LinkedHashSet<>(), abc, abc.constants, true));
|
||||
if (foundIface > -1) {
|
||||
if (foundIface > minClassIndex) {
|
||||
minClassIndex = foundIface;
|
||||
@@ -2342,7 +2343,7 @@ public class AVM2SourceGenerator implements SourceGenerator {
|
||||
for (Trait t : scriptInfo.traits.traits) {
|
||||
if (t instanceof TraitClass) {
|
||||
TraitClass tc = (TraitClass) t;
|
||||
DottedChain className = tc.getName(abc).getNameWithNamespace(abc, abc.constants, true);
|
||||
DottedChain className = tc.getName(abc).getNameWithNamespace(new LinkedHashSet<>(), abc, abc.constants, true);
|
||||
|
||||
List<Integer> parents = new ArrayList<>();
|
||||
if (documentClass != null && documentClass.equals(className)) {
|
||||
@@ -2356,7 +2357,7 @@ public class AVM2SourceGenerator implements SourceGenerator {
|
||||
sinitcode.add(ins(AVM2Instructions.PushNull));
|
||||
} else {
|
||||
|
||||
AbcIndexing.ClassIndex ci = abcIndex.findClass(AbcIndexing.multinameToType(abc.instance_info.get(tc.class_info).name_index, abc, constants), abc, scriptIndex);
|
||||
AbcIndexing.ClassIndex ci = abcIndex.findClass(AbcIndexing.multinameToType(new LinkedHashSet<>(), abc.instance_info.get(tc.class_info).name_index, abc, constants), abc, scriptIndex);
|
||||
while (ci != null && ci.parent != null) {
|
||||
ci = ci.parent;
|
||||
Multiname origM = ci.abc.constants.getMultiname(ci.abc.instance_info.get(ci.index).name_index);
|
||||
@@ -2430,7 +2431,7 @@ public class AVM2SourceGenerator implements SourceGenerator {
|
||||
indices.add(
|
||||
abc.getSelectedAbc().constants.getMultinameId(
|
||||
Multiname.createQName(false,
|
||||
abc.getSelectedAbc().constants.getStringId(superName.getName(a, a.constants, null, true, true /*FIXME!!! ???*/), true),
|
||||
abc.getSelectedAbc().constants.getStringId(superName.getName(new LinkedHashSet<>(), a, a.constants, null, true, true /*FIXME!!! ???*/), true),
|
||||
abc.getSelectedAbc().constants.getNamespaceId(superName.getNamespace(a.constants).kind, superName.getNamespace(a.constants).getName(a.constants), 0, true)), true)
|
||||
);
|
||||
}
|
||||
@@ -2449,16 +2450,16 @@ public class AVM2SourceGenerator implements SourceGenerator {
|
||||
if (tsc.type_index == 0) {
|
||||
return TypeItem.UNBOUNDED;
|
||||
}
|
||||
return AbcIndexing.multinameToType(tsc.type_index, abc.getSelectedAbc(), abc.getSelectedAbc().constants);
|
||||
return AbcIndexing.multinameToType(new LinkedHashSet<>(), tsc.type_index, abc.getSelectedAbc(), abc.getSelectedAbc().constants);
|
||||
}
|
||||
if (t instanceof TraitMethodGetterSetter) {
|
||||
TraitMethodGetterSetter tmgs = (TraitMethodGetterSetter) t;
|
||||
if (tmgs.kindType == Trait.TRAIT_GETTER) {
|
||||
return AbcIndexing.multinameToType(abc.getSelectedAbc().method_info.get(tmgs.method_info).ret_type, abc.getSelectedAbc(), abc.getSelectedAbc().constants);
|
||||
return AbcIndexing.multinameToType(new LinkedHashSet<>(), abc.getSelectedAbc().method_info.get(tmgs.method_info).ret_type, abc.getSelectedAbc(), abc.getSelectedAbc().constants);
|
||||
}
|
||||
if (tmgs.kindType == Trait.TRAIT_SETTER) {
|
||||
if (abc.getSelectedAbc().method_info.get(tmgs.method_info).param_types.length > 0) {
|
||||
return AbcIndexing.multinameToType(abc.getSelectedAbc().method_info.get(tmgs.method_info).param_types[0], abc.getSelectedAbc(), abc.getSelectedAbc().constants);
|
||||
return AbcIndexing.multinameToType(new LinkedHashSet<>(), abc.getSelectedAbc().method_info.get(tmgs.method_info).param_types[0], abc.getSelectedAbc(), abc.getSelectedAbc().constants);
|
||||
} else {
|
||||
return TypeItem.UNBOUNDED;
|
||||
}
|
||||
@@ -2557,12 +2558,12 @@ public class AVM2SourceGenerator implements SourceGenerator {
|
||||
* @param outABCs Out ABCs
|
||||
*/
|
||||
public static void parentNames(AbcIndexing abc, int scriptIndex, int name_index, List<Integer> indices, List<String> names, List<String> namespaces, List<ABC> outABCs) {
|
||||
AbcIndexing.ClassIndex ci = abc.findClass(new TypeItem(abc.getSelectedAbc().constants.getMultiname(name_index).getNameWithNamespace(abc.getSelectedAbc(), abc.getSelectedAbc().constants, true /*FIXME!!*/)), abc.getSelectedAbc(), scriptIndex);
|
||||
AbcIndexing.ClassIndex ci = abc.findClass(new TypeItem(abc.getSelectedAbc().constants.getMultiname(name_index).getNameWithNamespace(new LinkedHashSet<>(), abc.getSelectedAbc(), abc.getSelectedAbc().constants, true /*FIXME!!*/)), abc.getSelectedAbc(), scriptIndex);
|
||||
while (ci != null) {
|
||||
int ni = ci.abc.instance_info.get(ci.index).name_index;
|
||||
indices.add(ni);
|
||||
outABCs.add(ci.abc);
|
||||
names.add(ci.abc.constants.getMultiname(ni).getName(ci.abc, ci.abc.constants, null, true, true/*FIXME!!*/));
|
||||
names.add(ci.abc.constants.getMultiname(ni).getName(new LinkedHashSet<>(), ci.abc, ci.abc.constants, null, true, true/*FIXME!!*/));
|
||||
namespaces.add(ci.abc.constants.getMultiname(ni).getNamespace(ci.abc.constants).getName(ci.abc.constants).toRawString());
|
||||
ci = ci.parent;
|
||||
}
|
||||
|
||||
+29
-28
@@ -512,7 +512,7 @@ public final class AbcIndexing {
|
||||
*/
|
||||
@Override
|
||||
public String toString() {
|
||||
return abc.constants.getMultiname(abc.instance_info.get(index).name_index).getNameWithNamespace(abc, abc.constants, true).toPrintableString(abc.getSwf(), true);
|
||||
return abc.constants.getMultiname(abc.instance_info.get(index).name_index).getNameWithNamespace(new LinkedHashSet<>() /*???*/, abc, abc.constants, true).toPrintableString(new LinkedHashSet<>(), abc.getSwf(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -616,18 +616,18 @@ public final class AbcIndexing {
|
||||
return classNames;
|
||||
}
|
||||
|
||||
public void getClassTraits(GraphTargetItem cls, ABC abc, Integer scriptIndex, boolean getStatic, boolean getInstance, boolean getInheritance, List<PropertyDef> ret, List<Boolean> staticRet) {
|
||||
public void getClassTraits(Set<String> usedDeobfuscations, GraphTargetItem cls, ABC abc, Integer scriptIndex, boolean getStatic, boolean getInstance, boolean getInheritance, List<PropertyDef> ret, List<Boolean> staticRet) {
|
||||
ClassIndex ci = findClass(cls, abc, scriptIndex);
|
||||
if (ci == null) {
|
||||
return;
|
||||
}
|
||||
ret.clear();
|
||||
staticRet.clear();
|
||||
getClassIndexTraitNames(ret, staticRet, ci, getStatic, getInstance, getInheritance, new HashSet<>());
|
||||
getClassIndexTraitNames(usedDeobfuscations, ret, staticRet, ci, getStatic, getInstance, getInheritance, new HashSet<>());
|
||||
}
|
||||
|
||||
private void getClassIndexTraitNames(List<PropertyDef> ret, List<Boolean> staticRet, ClassIndex ci, boolean getStatic, boolean getInstance, boolean getInheritance, Set<String> used) {
|
||||
GraphTargetItem ciName = multinameToType(ci.abc.instance_info.get(ci.index).name_index, ci.abc, ci.abc.constants);
|
||||
private void getClassIndexTraitNames(Set<String> usedDeobfuscations, List<PropertyDef> ret, List<Boolean> staticRet, ClassIndex ci, boolean getStatic, boolean getInstance, boolean getInheritance, Set<String> used) {
|
||||
GraphTargetItem ciName = multinameToType(usedDeobfuscations, ci.abc.instance_info.get(ci.index).name_index, ci.abc, ci.abc.constants);
|
||||
|
||||
boolean isObject = ciName.equals(new TypeItem("Object"));
|
||||
List<String> ignoredObjectTraits = Arrays.asList("_init", "_dontEnumPrototype", "_setPropertyIsEnumerable");
|
||||
@@ -680,11 +680,11 @@ public final class AbcIndexing {
|
||||
}
|
||||
|
||||
if (parent != null) {
|
||||
parent.getClassIndexTraitNames(ret, staticRet, ci, getStatic, getInstance, getInheritance, used);
|
||||
parent.getClassIndexTraitNames(usedDeobfuscations, ret, staticRet, ci, getStatic, getInstance, getInheritance, used);
|
||||
}
|
||||
|
||||
if (getInheritance && ci.parent != null) {
|
||||
getClassIndexTraitNames(ret, staticRet, ci.parent, getStatic, getInstance, getInheritance, used);
|
||||
getClassIndexTraitNames(usedDeobfuscations, ret, staticRet, ci.parent, getStatic, getInstance, getInheritance, used);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -890,7 +890,7 @@ public final class AbcIndexing {
|
||||
AbcIndexing.ClassIndex ci = findClass(prop.parent, prop.abc, null);
|
||||
if (ci != null && ci.parent != null && (prop.abc == null || prop.propNsIndex == 0)) {
|
||||
AbcIndexing.ClassIndex ciParent = ci.parent;
|
||||
DottedChain parentClass = ciParent.abc.instance_info.get(ciParent.index).getName(ciParent.abc.constants).getNameWithNamespace(ciParent.abc, ciParent.abc.constants, true);
|
||||
DottedChain parentClass = ciParent.abc.instance_info.get(ciParent.index).getName(ciParent.abc.constants).getNameWithNamespace(new LinkedHashSet<>(), ciParent.abc, ciParent.abc.constants, true);
|
||||
TraitIndex pti = findProperty(new PropertyDef(prop.propName, new TypeItem(parentClass), prop.getPropNsString()), findStatic, findInstance, findProtected, foundStatic);
|
||||
if (pti != null) {
|
||||
return pti;
|
||||
@@ -919,12 +919,13 @@ public final class AbcIndexing {
|
||||
|
||||
/**
|
||||
* Converts multiname to type
|
||||
* @param usedDeobfuscations Used deobfuscations
|
||||
* @param m_index Multiname index
|
||||
* @param abc ABC
|
||||
* @param constants AVM2 constant pool
|
||||
* @return Type
|
||||
*/
|
||||
public static GraphTargetItem multinameToType(int m_index, ABC abc, AVM2ConstantPool constants) {
|
||||
public static GraphTargetItem multinameToType(Set<String> usedDeobfuscations, int m_index, ABC abc, AVM2ConstantPool constants) {
|
||||
if (m_index == 0) {
|
||||
return TypeItem.UNBOUNDED;
|
||||
}
|
||||
@@ -933,13 +934,13 @@ public final class AbcIndexing {
|
||||
return null;
|
||||
}
|
||||
if (m.kind == Multiname.TYPENAME) {
|
||||
GraphTargetItem obj = multinameToType(m.qname_index, abc, constants);
|
||||
GraphTargetItem obj = multinameToType(usedDeobfuscations, m.qname_index, abc, constants);
|
||||
if (obj == null) {
|
||||
return null;
|
||||
}
|
||||
List<GraphTargetItem> params = new ArrayList<>();
|
||||
for (int pm : m.params) {
|
||||
GraphTargetItem r = multinameToType(pm, abc, constants);
|
||||
GraphTargetItem r = multinameToType(usedDeobfuscations, pm, abc, constants);
|
||||
if (r == null) {
|
||||
return null;
|
||||
}
|
||||
@@ -951,13 +952,13 @@ public final class AbcIndexing {
|
||||
return new ApplyTypeAVM2Item(null, null, obj, params);
|
||||
} else {
|
||||
if (m.namespace_index != 0 && m.getNamespace(constants).kind == Namespace.KIND_PRIVATE) {
|
||||
return new TypeItem(m.getName(abc, constants, new ArrayList<>(), true, true), "ns:" + m.namespace_index);
|
||||
return new TypeItem(m.getName(usedDeobfuscations, abc, constants, new ArrayList<>(), true, true), "ns:" + m.namespace_index);
|
||||
}
|
||||
return new TypeItem(m.getNameWithNamespace(abc, constants, true));
|
||||
return new TypeItem(m.getNameWithNamespace(usedDeobfuscations, abc, constants, true));
|
||||
}
|
||||
}
|
||||
|
||||
private static GraphTargetItem getTraitCallReturnType(ABC abc, Trait t) {
|
||||
private static GraphTargetItem getTraitCallReturnType(Set<String> usedDeobfuscations, ABC abc, Trait t) {
|
||||
if (t instanceof TraitSlotConst) {
|
||||
return TypeItem.UNBOUNDED;
|
||||
}
|
||||
@@ -969,33 +970,33 @@ public final class AbcIndexing {
|
||||
if (tmgs.kindType == Trait.TRAIT_SETTER) {
|
||||
return TypeItem.UNBOUNDED;
|
||||
}
|
||||
return multinameToType(abc.method_info.get(tmgs.method_info).ret_type, abc, abc.constants);
|
||||
return multinameToType(usedDeobfuscations, abc.method_info.get(tmgs.method_info).ret_type, abc, abc.constants);
|
||||
}
|
||||
|
||||
if (t instanceof TraitFunction) {
|
||||
TraitFunction tf = (TraitFunction) t;
|
||||
return multinameToType(abc.method_info.get(tf.method_info).ret_type, abc, abc.constants);
|
||||
return multinameToType(usedDeobfuscations, abc.method_info.get(tf.method_info).ret_type, abc, abc.constants);
|
||||
|
||||
}
|
||||
return TypeItem.UNBOUNDED;
|
||||
}
|
||||
|
||||
private static GraphTargetItem getTraitReturnType(ABC abc, Trait t) {
|
||||
private static GraphTargetItem getTraitReturnType(Set<String> usedDeobfuscations, ABC abc, Trait t) {
|
||||
if (t instanceof TraitSlotConst) {
|
||||
TraitSlotConst tsc = (TraitSlotConst) t;
|
||||
if (tsc.type_index == 0) {
|
||||
return TypeItem.UNBOUNDED;
|
||||
}
|
||||
return multinameToType(tsc.type_index, abc, abc.constants);
|
||||
return multinameToType(usedDeobfuscations, tsc.type_index, abc, abc.constants);
|
||||
}
|
||||
if (t instanceof TraitMethodGetterSetter) {
|
||||
TraitMethodGetterSetter tmgs = (TraitMethodGetterSetter) t;
|
||||
if (tmgs.kindType == Trait.TRAIT_GETTER) {
|
||||
return multinameToType(abc.method_info.get(tmgs.method_info).ret_type, abc, abc.constants);
|
||||
return multinameToType(usedDeobfuscations, abc.method_info.get(tmgs.method_info).ret_type, abc, abc.constants);
|
||||
}
|
||||
if (tmgs.kindType == Trait.TRAIT_SETTER) {
|
||||
if (abc.method_info.get(tmgs.method_info).param_types.length > 0) {
|
||||
return multinameToType(abc.method_info.get(tmgs.method_info).param_types[0], abc, abc.constants);
|
||||
return multinameToType(usedDeobfuscations, abc.method_info.get(tmgs.method_info).param_types[0], abc, abc.constants);
|
||||
} else {
|
||||
return TypeItem.UNBOUNDED;
|
||||
}
|
||||
@@ -1026,13 +1027,13 @@ public final class AbcIndexing {
|
||||
propValue = new ValueKind(tsc.value_index, tsc.value_kind);
|
||||
}
|
||||
if (map != null) {
|
||||
PropertyDef dp = new PropertyDef(t.getName(abc).getName(abc, abc.constants, new ArrayList<>() /*?*/, true, false), multinameToType(name_index, abc, abc.constants), abc, abc.constants.getMultiname(t.name_index).namespace_index);
|
||||
map.put(dp, new TraitIndex(t, abc, getTraitReturnType(abc, t), getTraitCallReturnType(abc, t), propValue, multinameToType(name_index, abc, abc.constants), scriptIndex));
|
||||
PropertyDef dp = new PropertyDef(t.getName(abc).getName(new LinkedHashSet<>(), abc, abc.constants, new ArrayList<>() /*?*/, true, false), multinameToType(new LinkedHashSet<>(), name_index, abc, abc.constants), abc, abc.constants.getMultiname(t.name_index).namespace_index);
|
||||
map.put(dp, new TraitIndex(t, abc, getTraitReturnType(new LinkedHashSet<>(), abc, t), getTraitCallReturnType(new LinkedHashSet<>(), abc, t), propValue, multinameToType(new LinkedHashSet<>(), name_index, abc, abc.constants), scriptIndex));
|
||||
}
|
||||
if (mapNs != null) {
|
||||
Multiname m = abc.constants.getMultiname(t.name_index);
|
||||
PropertyNsDef ndp = new PropertyNsDef(t.getName(abc).getName(abc, abc.constants, new ArrayList<>() /*?*/, true, true/*FIXME ???*/), m == null || m.namespace_index == 0 ? DottedChain.EMPTY : m.getNamespace(abc.constants).getName(abc.constants), abc, m == null ? 0 : m.namespace_index);
|
||||
TraitIndex ti = new TraitIndex(t, abc, getTraitReturnType(abc, t), getTraitCallReturnType(abc, t), propValue, multinameToType(name_index, abc, abc.constants), scriptIndex);
|
||||
PropertyNsDef ndp = new PropertyNsDef(t.getName(abc).getName(new LinkedHashSet<>(), abc, abc.constants, new ArrayList<>() /*?*/, true, true/*FIXME ???*/), m == null || m.namespace_index == 0 ? DottedChain.EMPTY : m.getNamespace(abc.constants).getName(abc.constants), abc, m == null ? 0 : m.namespace_index);
|
||||
TraitIndex ti = new TraitIndex(t, abc, getTraitReturnType(new LinkedHashSet<>(), abc, t), getTraitCallReturnType(new LinkedHashSet<>(), abc, t), propValue, multinameToType(new LinkedHashSet<>(), name_index, abc, abc.constants), scriptIndex);
|
||||
if (!mapNs.containsKey(ndp)) {
|
||||
mapNs.put(ndp, ti);
|
||||
}
|
||||
@@ -1137,7 +1138,7 @@ public final class AbcIndexing {
|
||||
Integer classScriptIndex = nsKind == Namespace.KIND_PACKAGE ? null : i;
|
||||
ClassIndex cindex = new ClassIndex(tc.class_info, abc, null, classScriptIndex);
|
||||
addedClasses.add(cindex);
|
||||
GraphTargetItem cname = multinameToType(ii.name_index, abc, abc.constants);
|
||||
GraphTargetItem cname = multinameToType(new LinkedHashSet<>(), ii.name_index, abc, abc.constants);
|
||||
classes.put(new ClassDef(cname, abc, classScriptIndex), cindex);
|
||||
|
||||
indexTraits(abc, ii.name_index, ii.instance_traits, instanceProperties, instanceNsProperties, i);
|
||||
@@ -1149,7 +1150,7 @@ public final class AbcIndexing {
|
||||
for (ClassIndex cindex : addedClasses) {
|
||||
int parentClassName = abc.instance_info.get(cindex.index).super_index;
|
||||
if (parentClassName > 0) {
|
||||
TypeItem parentClass = new TypeItem(abc.constants.getMultiname(parentClassName).getNameWithNamespace(abc, abc.constants, true));
|
||||
TypeItem parentClass = new TypeItem(abc.constants.getMultiname(parentClassName).getNameWithNamespace(new LinkedHashSet<>(), abc, abc.constants, true));
|
||||
ClassIndex parentClassIndex = findClass(parentClass, abc, null);
|
||||
if (parentClassIndex == null) {
|
||||
//Parent class can be deleted, do not check. TODO: handle this better
|
||||
@@ -1211,14 +1212,14 @@ public final class AbcIndexing {
|
||||
* @return True if class is instance of another class
|
||||
*/
|
||||
public boolean isInstanceOf(ABC abc, int classIndex, DottedChain searchClassName) {
|
||||
DottedChain clsName = abc.instance_info.get(classIndex).getName(abc.constants).getNameWithNamespace(abc, abc.constants, false);
|
||||
DottedChain clsName = abc.instance_info.get(classIndex).getName(abc.constants).getNameWithNamespace(new LinkedHashSet<>(), abc, abc.constants, false);
|
||||
if (searchClassName.equals(clsName)) {
|
||||
return true;
|
||||
}
|
||||
if (abc.instance_info.get(classIndex).super_index == 0) {
|
||||
return false;
|
||||
}
|
||||
DottedChain parentClassName = abc.constants.getMultiname(abc.instance_info.get(classIndex).super_index).getNameWithNamespace(abc, abc.constants, false);
|
||||
DottedChain parentClassName = abc.constants.getMultiname(abc.instance_info.get(classIndex).super_index).getNameWithNamespace(new LinkedHashSet<>(), abc, abc.constants, false);
|
||||
|
||||
AbcIndexing.ClassIndex ci = findClass(new TypeItem(parentClassName), abc, null);
|
||||
if (ci == null) {
|
||||
|
||||
+2
-1
@@ -36,6 +36,7 @@ import com.jpexs.decompiler.graph.TypeItem;
|
||||
import com.jpexs.decompiler.graph.model.LocalData;
|
||||
import com.jpexs.helpers.Reference;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -178,7 +179,7 @@ public class CallAVM2Item extends AVM2Item {
|
||||
if (mi.param_types[i] == 0) {
|
||||
type = TypeItem.UNBOUNDED;
|
||||
} else {
|
||||
type = new TypeItem(abc.constants.getMultiname(mi.param_types[i]).getNameWithNamespace(abc, abc.constants, true /*??*/));
|
||||
type = new TypeItem(abc.constants.getMultiname(mi.param_types[i]).getNameWithNamespace(new LinkedHashSet<>() /*???*/, abc, abc.constants, true /*??*/));
|
||||
}
|
||||
arguments.set(i, AVM2SourceGenerator.handleAndOrCoerce(arguments.get(i), type));
|
||||
}
|
||||
|
||||
+2
-1
@@ -39,6 +39,7 @@ import com.jpexs.decompiler.graph.model.LocalData;
|
||||
import com.jpexs.helpers.Reference;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@@ -434,7 +435,7 @@ public class NameAVM2Item extends AssignableAVM2Item {
|
||||
for (MethodBody b : callStack) {
|
||||
for (int i = 0; i < b.traits.traits.size(); i++) {
|
||||
Trait t = b.traits.traits.get(i);
|
||||
if (t.getName(abcV).getName(abcV, constants, null, true, true).equals(variableName)) {
|
||||
if (t.getName(abcV).getName(new LinkedHashSet<>(), abcV, constants, null, true, true).equals(variableName)) {
|
||||
if (t instanceof TraitSlotConst) {
|
||||
if (!localData.traitUsages.containsKey(b)) {
|
||||
localData.traitUsages.put(b, new ArrayList<>());
|
||||
|
||||
+3
-2
@@ -48,6 +48,7 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
@@ -217,11 +218,11 @@ public class PropertyAVM2Item extends AssignableAVM2Item {
|
||||
for (MethodBody b : callStack) {
|
||||
for (int i = 0; i < b.traits.traits.size(); i++) {
|
||||
Trait t = b.traits.traits.get(i);
|
||||
if (t.getName(abc).getName(abc, constants, null, true, true).equals(propertyName)) {
|
||||
if (t.getName(abc).getName(new LinkedHashSet<>(), abc, constants, null, true, true).equals(propertyName)) {
|
||||
if (t instanceof TraitSlotConst) {
|
||||
TraitSlotConst tsc = (TraitSlotConst) t;
|
||||
objType = new TypeItem(DottedChain.FUNCTION);
|
||||
propType = AbcIndexing.multinameToType(tsc.type_index, abc, constants);
|
||||
propType = AbcIndexing.multinameToType(new LinkedHashSet<>(), tsc.type_index, abc, constants);
|
||||
propIndex = tsc.name_index;
|
||||
if (!localData.traitUsages.containsKey(b)) {
|
||||
localData.traitUsages.put(b, new ArrayList<>());
|
||||
|
||||
+3
-2
@@ -41,6 +41,7 @@ import com.jpexs.decompiler.graph.TypeItem;
|
||||
import com.jpexs.decompiler.graph.model.LocalData;
|
||||
import com.jpexs.helpers.Reference;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
@@ -625,7 +626,7 @@ public class UnresolvedAVM2Item extends AssignableAVM2Item {
|
||||
if (ci == null) {
|
||||
ntype = new TypeItem("Object");
|
||||
} else {
|
||||
ntype = new TypeItem(ci.abc.instance_info.get(ci.index).getName(ci.abc.constants).getNameWithNamespace(ci.abc, ci.abc.constants, true));
|
||||
ntype = new TypeItem(ci.abc.instance_info.get(ci.index).getName(ci.abc.constants).getNameWithNamespace(new LinkedHashSet<>(), ci.abc, ci.abc.constants, true));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -650,7 +651,7 @@ public class UnresolvedAVM2Item extends AssignableAVM2Item {
|
||||
}
|
||||
|
||||
if (mustBeType) {
|
||||
throw new CompilationException(name.toPrintableString(abcIndex.getSelectedAbc().getSwf(), true) + " is not an existing type", line);
|
||||
throw new CompilationException(name.toPrintableString(new LinkedHashSet<>(), abcIndex.getSelectedAbc().getSwf(), true) + " is not an existing type", line);
|
||||
}
|
||||
resolved = null;
|
||||
GraphTargetItem ret = null;
|
||||
|
||||
@@ -24,6 +24,7 @@ import com.jpexs.decompiler.graph.DottedChain;
|
||||
import com.jpexs.helpers.Helper;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Exception.
|
||||
@@ -79,26 +80,28 @@ public class ABCException implements Serializable, Cloneable {
|
||||
|
||||
/**
|
||||
* To string.
|
||||
* @param usedDeobfuscations Used deobfuscations
|
||||
* @param ABC abc
|
||||
* @param constants AVM2 constant pool
|
||||
* @param fullyQualifiedNames Fully qualified names
|
||||
* @return String
|
||||
*/
|
||||
public String toString(ABC abc, AVM2ConstantPool constants, List<DottedChain> fullyQualifiedNames) {
|
||||
return "Exception: startServer=" + Helper.formatAddress(start) + " end=" + Helper.formatAddress(end) + " target=" + target + " type=\"" + getTypeName(abc, constants, fullyQualifiedNames) + "\" name=\"" + getVarName(abc, constants, fullyQualifiedNames) + "\"";
|
||||
public String toString(Set<String> usedDeobfuscations, ABC abc, AVM2ConstantPool constants, List<DottedChain> fullyQualifiedNames) {
|
||||
return "Exception: startServer=" + Helper.formatAddress(start) + " end=" + Helper.formatAddress(end) + " target=" + target + " type=\"" + getTypeName(usedDeobfuscations, abc, constants, fullyQualifiedNames) + "\" name=\"" + getVarName(usedDeobfuscations, abc, constants, fullyQualifiedNames) + "\"";
|
||||
}
|
||||
|
||||
/**
|
||||
* To string.
|
||||
* @param ABC abc
|
||||
* @param usedDeobfuscations Used deobfuscations
|
||||
* @param abc ABC
|
||||
* @param constants AVM2 constant pool
|
||||
* @param code AVM2 code
|
||||
* @param fullyQualifiedNames Fully qualified names
|
||||
* @return String
|
||||
*/
|
||||
public String toString(ABC abc, AVM2ConstantPool constants, AVM2Code code, List<DottedChain> fullyQualifiedNames) {
|
||||
public String toString(Set<String> usedDeobfuscations, ABC abc, AVM2ConstantPool constants, AVM2Code code, List<DottedChain> fullyQualifiedNames) {
|
||||
try {
|
||||
return "Exception: startServer=" + code.adr2pos(start) + ":" + code.code.get(code.adr2pos(start)).toStringNoAddress(constants, fullyQualifiedNames) + " end=" + code.adr2pos(end) + ":" + code.code.get(code.adr2pos(end)).toStringNoAddress(constants, fullyQualifiedNames) + " target=" + code.adr2pos(target) + ":" + code.code.get(code.adr2pos(target)).toStringNoAddress(constants, fullyQualifiedNames) + " type=\"" + getTypeName(abc, constants, fullyQualifiedNames) + "\" name=\"" + getVarName(abc, constants, fullyQualifiedNames) + "\"";
|
||||
return "Exception: startServer=" + code.adr2pos(start) + ":" + code.code.get(code.adr2pos(start)).toStringNoAddress(constants, fullyQualifiedNames) + " end=" + code.adr2pos(end) + ":" + code.code.get(code.adr2pos(end)).toStringNoAddress(constants, fullyQualifiedNames) + " target=" + code.adr2pos(target) + ":" + code.code.get(code.adr2pos(target)).toStringNoAddress(constants, fullyQualifiedNames) + " type=\"" + getTypeName(usedDeobfuscations, abc, constants, fullyQualifiedNames) + "\" name=\"" + getVarName(usedDeobfuscations, abc, constants, fullyQualifiedNames) + "\"";
|
||||
} catch (ConvertException ex) {
|
||||
return "";
|
||||
}
|
||||
@@ -114,30 +117,32 @@ public class ABCException implements Serializable, Cloneable {
|
||||
|
||||
/**
|
||||
* Gets variable name.
|
||||
* @param usedDeobfuscations Used deobfuscations
|
||||
* @param abc ABC
|
||||
* @param constants AVM2 constant pool
|
||||
* @param fullyQualifiedNames Fully qualified names
|
||||
* @return Variable name
|
||||
*/
|
||||
public String getVarName(ABC abc, AVM2ConstantPool constants, List<DottedChain> fullyQualifiedNames) {
|
||||
public String getVarName(Set<String> usedDeobfuscations, ABC abc, AVM2ConstantPool constants, List<DottedChain> fullyQualifiedNames) {
|
||||
if (name_index == 0) {
|
||||
return DEFAULT_EXCEPTION_NAME;
|
||||
}
|
||||
return constants.getMultiname(name_index).getName(abc, constants, fullyQualifiedNames, false, true);
|
||||
return constants.getMultiname(name_index).getName(usedDeobfuscations, abc, constants, fullyQualifiedNames, false, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets type name.
|
||||
* @param usedDeobfuscations Used deobfuscations
|
||||
* @param abc ABC
|
||||
* @param constants AVM2 constant pool
|
||||
* @param fullyQualifiedNames Fully qualified names
|
||||
* @return Type name
|
||||
*/
|
||||
public String getTypeName(ABC abc, AVM2ConstantPool constants, List<DottedChain> fullyQualifiedNames) {
|
||||
public String getTypeName(Set<String> usedDeobfuscations, ABC abc, AVM2ConstantPool constants, List<DottedChain> fullyQualifiedNames) {
|
||||
if (type_index == 0) {
|
||||
return "*";
|
||||
}
|
||||
return constants.getMultiname(type_index).getName(abc, constants, fullyQualifiedNames, false, true);
|
||||
return constants.getMultiname(type_index).getName(usedDeobfuscations, abc, constants, fullyQualifiedNames, false, true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -36,6 +36,7 @@ import com.jpexs.decompiler.flash.types.sound.SoundFormat;
|
||||
import com.jpexs.decompiler.graph.DottedChain;
|
||||
import com.jpexs.helpers.Helper;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Instance info.
|
||||
@@ -156,6 +157,7 @@ public class InstanceInfo {
|
||||
/**
|
||||
* Gets class header string.
|
||||
*
|
||||
* @param usedDeobfuscations Used deobfuscations
|
||||
* @param assetsDir Assets directory
|
||||
* @param writer Writer
|
||||
* @param abc ABC
|
||||
@@ -164,17 +166,17 @@ public class InstanceInfo {
|
||||
* @param allowEmbed Allow embed
|
||||
* @return Writer
|
||||
*/
|
||||
public GraphTextWriter getClassHeaderStr(String assetsDir, GraphTextWriter writer, ABC abc, List<DottedChain> fullyQualifiedNames, boolean allowPrivate, boolean allowEmbed) {
|
||||
public GraphTextWriter getClassHeaderStr(Set<String> usedDeobfuscations, String assetsDir, GraphTextWriter writer, ABC abc, List<DottedChain> fullyQualifiedNames, boolean allowPrivate, boolean allowEmbed) {
|
||||
|
||||
final String ASSETS_DIR = assetsDir; // "/_assets/";
|
||||
if (allowEmbed) {
|
||||
if (abc.getSwf() != null) {
|
||||
String className = getName(abc.constants).getNameWithNamespace(abc, abc.constants, false).toRawString();
|
||||
String className = getName(abc.constants).getNameWithNamespace(usedDeobfuscations, abc, abc.constants, false).toRawString();
|
||||
CharacterTag ct = abc.getSwf().getCharacterByClass(className);
|
||||
if (ct != null) {
|
||||
String fileName = ct.getCharacterExportFileName();
|
||||
if (Configuration.as3ExportNamesUseClassNamesOnly.get()) {
|
||||
fileName = getName(abc.constants).getNameWithNamespace(abc, abc.constants, false).toRawString();
|
||||
fileName = getName(abc.constants).getNameWithNamespace(usedDeobfuscations, abc, abc.constants, false).toRawString();
|
||||
}
|
||||
|
||||
String ext = "";
|
||||
@@ -313,17 +315,17 @@ public class InstanceInfo {
|
||||
}
|
||||
|
||||
writer.appendNoHilight(modifiers + objType);
|
||||
String classTypeName = abc.constants.getMultiname(name_index).getNameWithNamespace(abc, abc.constants, true).toRawString();
|
||||
String classTypeName = abc.constants.getMultiname(name_index).getNameWithNamespace(usedDeobfuscations, abc, abc.constants, true).toRawString();
|
||||
|
||||
writer.hilightSpecial(abc.constants.getMultiname(name_index).getName(abc, abc.constants, null/* No full names here*/, false, true), HighlightSpecialType.CLASS_NAME, classTypeName);
|
||||
writer.hilightSpecial(abc.constants.getMultiname(name_index).getName(usedDeobfuscations, abc, abc.constants, null/* No full names here*/, false, true), HighlightSpecialType.CLASS_NAME, classTypeName);
|
||||
|
||||
if (!isNullable()) {
|
||||
writer.appendNoHilight("!");
|
||||
}
|
||||
|
||||
if (super_index > 0) {
|
||||
String typeName = abc.constants.getMultiname(super_index).getNameWithNamespace(abc, abc.constants, true).toRawString();
|
||||
String parentName = abc.constants.getMultiname(super_index).getName(abc, abc.constants, fullyQualifiedNames, false, true);
|
||||
String typeName = abc.constants.getMultiname(super_index).getNameWithNamespace(usedDeobfuscations, abc, abc.constants, true).toRawString();
|
||||
String parentName = abc.constants.getMultiname(super_index).getName(usedDeobfuscations, abc, abc.constants, fullyQualifiedNames, false, true);
|
||||
if (!parentName.equals("Object")) {
|
||||
writer.appendNoHilight(" extends ");
|
||||
writer.hilightSpecial(parentName, HighlightSpecialType.TYPE_NAME, typeName);
|
||||
@@ -339,8 +341,8 @@ public class InstanceInfo {
|
||||
if (i > 0) {
|
||||
writer.append(", ");
|
||||
}
|
||||
String typeName = abc.constants.getMultiname(interfaces[i]).getNameWithNamespace(abc, abc.constants, true).toRawString();
|
||||
writer.hilightSpecial(abc.constants.getMultiname(interfaces[i]).getName(abc, abc.constants, fullyQualifiedNames, false, true), HighlightSpecialType.TYPE_NAME, typeName);
|
||||
String typeName = abc.constants.getMultiname(interfaces[i]).getNameWithNamespace(usedDeobfuscations, abc, abc.constants, true).toRawString();
|
||||
writer.hilightSpecial(abc.constants.getMultiname(interfaces[i]).getName(usedDeobfuscations, abc, abc.constants, fullyQualifiedNames, false, true), HighlightSpecialType.TYPE_NAME, typeName);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -449,9 +449,10 @@ public final class MethodBody implements Cloneable {
|
||||
* @param firstLevel First level
|
||||
* @param seenMethods Seen methods
|
||||
* @param initTraitClasses Class ids which traits to init
|
||||
* @param usedDeobfuscations Used deobfuscations
|
||||
* @throws InterruptedException On interrupt
|
||||
*/
|
||||
public void convert(int swfVersion, List<MethodBody> callStack, AbcIndexing abcIndex, final ConvertData convertData, final String path, ScriptExportMode exportMode, final boolean isStatic, final int methodIndex, final int scriptIndex, final int classIndex, final ABC abc, final Trait trait, final ScopeStack scopeStack, final int initializerType, final NulWriter writer, final List<DottedChain> fullyQualifiedNames, Traits initTraits, boolean firstLevel, Set<Integer> seenMethods, List<Integer> initTraitClasses) throws InterruptedException {
|
||||
public void convert(int swfVersion, List<MethodBody> callStack, AbcIndexing abcIndex, final ConvertData convertData, final String path, ScriptExportMode exportMode, final boolean isStatic, final int methodIndex, final int scriptIndex, final int classIndex, final ABC abc, final Trait trait, final ScopeStack scopeStack, final int initializerType, final NulWriter writer, final List<DottedChain> fullyQualifiedNames, Traits initTraits, boolean firstLevel, Set<Integer> seenMethods, List<Integer> initTraitClasses, Set<String> usedDeobfuscations) throws InterruptedException {
|
||||
seenMethods.add(this.method_info);
|
||||
if (debugMode) {
|
||||
System.err.println("Decompiling " + path);
|
||||
@@ -474,10 +475,10 @@ public final class MethodBody implements Cloneable {
|
||||
HashMap<Integer, String> localRegNames = getLocalRegNames(abc);
|
||||
List<GraphTargetItem> convertedItems1;
|
||||
try (Statistics s = new Statistics("AVM2Code.toGraphTargetItems")) {
|
||||
convertedItems1 = converted.getCode().toGraphTargetItems(swfVersion, callStack, abcIndex, convertData.thisHasDefaultToPrimitive, convertData, path, methodIndex, isStatic, scriptIndex, classIndex, abc, converted, localRegNames, scopeStack, initializerType, fullyQualifiedNames, initTraits, 0, new HashMap<>(), initTraitClasses); //converted.getCode().visitCode(converted)
|
||||
convertedItems1 = converted.getCode().toGraphTargetItems(usedDeobfuscations, swfVersion, callStack, abcIndex, convertData.thisHasDefaultToPrimitive, convertData, path, methodIndex, isStatic, scriptIndex, classIndex, abc, converted, localRegNames, scopeStack, initializerType, fullyQualifiedNames, initTraits, 0, new HashMap<>(), initTraitClasses); //converted.getCode().visitCode(converted)
|
||||
}
|
||||
try (Statistics s = new Statistics("Graph.graphToString")) {
|
||||
Graph.graphToString(convertedItems1, writer, LocalData.create(callStack, abcIndex, abc, localRegNames, fullyQualifiedNames, seenMethods, exportMode, swfVersion));
|
||||
Graph.graphToString(convertedItems1, writer, LocalData.create(callStack, abcIndex, abc, localRegNames, fullyQualifiedNames, seenMethods, exportMode, swfVersion, usedDeobfuscations));
|
||||
}
|
||||
convertedItems = convertedItems1;
|
||||
}
|
||||
@@ -525,6 +526,7 @@ public final class MethodBody implements Cloneable {
|
||||
/**
|
||||
* Returns a string representation of this MethodBody.
|
||||
*
|
||||
* @param usedDeobfuscations Used deobfuscations
|
||||
* @param swfVersion SWF version
|
||||
* @param callStack Call stack
|
||||
* @param abcIndex ABC indexing
|
||||
@@ -534,11 +536,11 @@ public final class MethodBody implements Cloneable {
|
||||
* @param trait Trait
|
||||
* @param writer Writer
|
||||
* @param fullyQualifiedNames Fully qualified names
|
||||
* @param seenMethods Seen methods
|
||||
* @param seenMethods Seen methods
|
||||
* @return Writer
|
||||
* @throws InterruptedException On interrupt
|
||||
*/
|
||||
public GraphTextWriter toString(int swfVersion, List<MethodBody> callStack, AbcIndexing abcIndex, final String path, ScriptExportMode exportMode, final ABC abc, final Trait trait, final GraphTextWriter writer, final List<DottedChain> fullyQualifiedNames, Set<Integer> seenMethods) throws InterruptedException {
|
||||
public GraphTextWriter toString(Set<String> usedDeobfuscations, int swfVersion, List<MethodBody> callStack, AbcIndexing abcIndex, final String path, ScriptExportMode exportMode, final ABC abc, final Trait trait, final GraphTextWriter writer, final List<DottedChain> fullyQualifiedNames, Set<Integer> seenMethods) throws InterruptedException {
|
||||
seenMethods.add(method_info);
|
||||
|
||||
if (exportMode != ScriptExportMode.AS) {
|
||||
@@ -565,11 +567,11 @@ public final class MethodBody implements Cloneable {
|
||||
}
|
||||
List<DottedChain> fullyQualifiedNames2 = new ArrayList<>(fullyQualifiedNames);
|
||||
for (Trait t : traits.traits) {
|
||||
DottedChain tname = DottedChain.parseWithSuffix(t.getName(abc).getName(abc, abc.constants, new ArrayList<>(), false, true));
|
||||
DottedChain tname = DottedChain.parseWithSuffix(t.getName(abc).getName(usedDeobfuscations, abc, abc.constants, new ArrayList<>(), false, true));
|
||||
fullyQualifiedNames2.remove(tname);
|
||||
}
|
||||
|
||||
Graph.graphToString(convertedItems, writer, LocalData.create(callStack, abcIndex, abc, localRegNames, fullyQualifiedNames2, seenMethods, exportMode, swfVersion));
|
||||
|
||||
Graph.graphToString(convertedItems, writer, LocalData.create(callStack, abcIndex, abc, localRegNames, fullyQualifiedNames2, seenMethods, exportMode, swfVersion, usedDeobfuscations));
|
||||
//writer.endMethod();
|
||||
} else if (convertException instanceof TimeoutException) {
|
||||
// exception was logged in convert method
|
||||
@@ -657,6 +659,7 @@ public final class MethodBody implements Cloneable {
|
||||
/**
|
||||
* Converts the method body to high-level source code.
|
||||
*
|
||||
* @param usedDeobfuscations Used deobfuscations
|
||||
* @param swfVersion SWF version
|
||||
* @param callStack Call stack
|
||||
* @param abcIndex ABC indexing
|
||||
@@ -664,14 +667,14 @@ public final class MethodBody implements Cloneable {
|
||||
* @param seenMethods Seen methods
|
||||
* @return High-level source code
|
||||
*/
|
||||
public String toSource(int swfVersion, List<MethodBody> callStack, AbcIndexing abcIndex, int scriptIndex, Set<Integer> seenMethods) {
|
||||
public String toSource(Set<String> usedDeobfuscations, int swfVersion, List<MethodBody> callStack, AbcIndexing abcIndex, int scriptIndex, Set<Integer> seenMethods) {
|
||||
ConvertData convertData = new ConvertData();
|
||||
convertData.deobfuscationMode = 0;
|
||||
try {
|
||||
convert(swfVersion, callStack, abcIndex, convertData, "", ScriptExportMode.AS, false, method_info, 0, 0, abc, null, new ScopeStack(), 0, new NulWriter(), new ArrayList<>(), new Traits(), true, seenMethods, new ArrayList<>());
|
||||
convert(swfVersion, callStack, abcIndex, convertData, "", ScriptExportMode.AS, false, method_info, 0, 0, abc, null, new ScopeStack(), 0, new NulWriter(), new ArrayList<>(), new Traits(), true, seenMethods, new ArrayList<>(), usedDeobfuscations);
|
||||
HighlightedTextWriter writer = new HighlightedTextWriter(Configuration.getCodeFormatting(), false);
|
||||
writer.indent().indent().indent();
|
||||
toString(swfVersion, callStack, abcIndex, "", ScriptExportMode.AS, abc, null, writer, new ArrayList<>(), seenMethods);
|
||||
toString(usedDeobfuscations, swfVersion, callStack, abcIndex, "", ScriptExportMode.AS, abc, null, writer, new ArrayList<>(), seenMethods);
|
||||
writer.unindent().unindent().unindent();
|
||||
writer.finishHilights();
|
||||
return writer.toString();
|
||||
|
||||
@@ -27,8 +27,10 @@ import com.jpexs.decompiler.flash.types.annotations.Internal;
|
||||
import com.jpexs.decompiler.graph.DottedChain;
|
||||
import com.jpexs.helpers.Helper;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Method info in ABC file.
|
||||
@@ -332,7 +334,7 @@ public class MethodInfo {
|
||||
return param_types.length + (flagNeed_rest() ? 1 : 0) + (flagNeed_arguments() ? 1 : 0);
|
||||
}
|
||||
|
||||
public GraphTextWriter getParamStr(GraphTextWriter writer, AVM2ConstantPool constants, MethodBody body, ABC abc, List<DottedChain> fullyQualifiedNames) {
|
||||
public GraphTextWriter getParamStr(GraphTextWriter writer, AVM2ConstantPool constants, MethodBody body, ABC abc, List<DottedChain> fullyQualifiedNames, Set<String> usedDeobfuscations) {
|
||||
Map<Integer, String> localRegNames = new HashMap<>();
|
||||
if (body != null && Configuration.getLocalNamesFromDebugInfo.get()) {
|
||||
localRegNames = body.getCode().getLocalRegNamesFromDebug(abc, body.max_regs);
|
||||
@@ -344,7 +346,7 @@ public class MethodInfo {
|
||||
}
|
||||
DottedChain ptype = DottedChain.ALL;
|
||||
if (param_types[i] > 0) {
|
||||
ptype = constants.getMultiname(param_types[i]).getNameWithNamespace(abc, constants, true);
|
||||
ptype = constants.getMultiname(param_types[i]).getNameWithNamespace(usedDeobfuscations, abc, constants, true);
|
||||
}
|
||||
|
||||
HighlightData pdata = new HighlightData();
|
||||
@@ -353,10 +355,10 @@ public class MethodInfo {
|
||||
pdata.regIndex = i + 1;
|
||||
if (!localRegNames.isEmpty()) {
|
||||
pdata.localName = localRegNames.get(i + 1); //assuming it is a slot
|
||||
writer.hilightSpecial(IdentifiersDeobfuscation.printIdentifier(abc.getSwf(), true, localRegNames.get(i + 1)), HighlightSpecialType.PARAM_NAME, i, pdata);
|
||||
writer.hilightSpecial(IdentifiersDeobfuscation.printIdentifier(abc.getSwf(), usedDeobfuscations, true, localRegNames.get(i + 1)), HighlightSpecialType.PARAM_NAME, i, pdata);
|
||||
} else if ((paramNames.length > i) && (paramNames[i] != 0) && Configuration.paramNamesEnable.get()) {
|
||||
pdata.localName = constants.getString(paramNames[i]);
|
||||
writer.hilightSpecial(IdentifiersDeobfuscation.printIdentifier(abc.getSwf(), true, constants.getString(paramNames[i])), HighlightSpecialType.PARAM_NAME, i, pdata);
|
||||
writer.hilightSpecial(IdentifiersDeobfuscation.printIdentifier(abc.getSwf(), usedDeobfuscations, true, constants.getString(paramNames[i])), HighlightSpecialType.PARAM_NAME, i, pdata);
|
||||
} else {
|
||||
pdata.localName = "param" + (i + 1);
|
||||
writer.hilightSpecial(pdata.localName, HighlightSpecialType.PARAM_NAME, i, pdata);
|
||||
@@ -365,7 +367,7 @@ public class MethodInfo {
|
||||
if (param_types[i] == 0) {
|
||||
writer.hilightSpecial("*", HighlightSpecialType.PARAM, i);
|
||||
} else {
|
||||
writer.hilightSpecial(constants.getMultiname(param_types[i]).getName(abc, constants, fullyQualifiedNames, false, true), HighlightSpecialType.PARAM, i);
|
||||
writer.hilightSpecial(constants.getMultiname(param_types[i]).getName(usedDeobfuscations, abc, constants, fullyQualifiedNames, false, true), HighlightSpecialType.PARAM, i);
|
||||
}
|
||||
if (optional != null && flagHas_optional()) {
|
||||
if (i >= param_types.length - optional.length) {
|
||||
@@ -399,14 +401,14 @@ public class MethodInfo {
|
||||
return writer;
|
||||
}
|
||||
|
||||
public GraphTextWriter getReturnTypeStr(GraphTextWriter writer, ABC abc, AVM2ConstantPool constants, List<DottedChain> fullyQualifiedNames) {
|
||||
public GraphTextWriter getReturnTypeStr(GraphTextWriter writer, ABC abc, AVM2ConstantPool constants, List<DottedChain> fullyQualifiedNames, Set<String> usedDeobfuscations) {
|
||||
String rname = "*";
|
||||
if (ret_type > 0) {
|
||||
Multiname multiname = constants.getMultiname(ret_type);
|
||||
if (multiname.kind != Multiname.TYPENAME && multiname.name_index > 0 && constants.getString(multiname.name_index).equals("void")) {
|
||||
rname = "void";
|
||||
} else {
|
||||
rname = multiname.getName(abc, constants, fullyQualifiedNames, false, true);
|
||||
rname = multiname.getName(usedDeobfuscations, abc, constants, fullyQualifiedNames, false, true);
|
||||
}
|
||||
}
|
||||
return writer.hilightSpecial(rname, HighlightSpecialType.RETURNS);
|
||||
@@ -419,7 +421,7 @@ public class MethodInfo {
|
||||
if (multiname.kind != Multiname.TYPENAME && multiname.name_index > 0 && constants.getString(multiname.name_index).equals("void")) {
|
||||
rname = "void";
|
||||
} else {
|
||||
rname = multiname.getName(abc, constants, fullyQualifiedNames, false, true);
|
||||
rname = multiname.getName(new LinkedHashSet<>(), abc, constants, fullyQualifiedNames, false, true);
|
||||
}
|
||||
}
|
||||
return rname;
|
||||
|
||||
@@ -27,6 +27,7 @@ import com.jpexs.helpers.Reference;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
@@ -624,6 +625,7 @@ public class Multiname {
|
||||
/**
|
||||
* Converts the typename to string.
|
||||
*
|
||||
* @param usedDeobfuscations Used deobfuscations
|
||||
* @param abc ABC
|
||||
* @param constants Constant pool
|
||||
* @param fullyQualifiedNames Fully qualified names
|
||||
@@ -631,12 +633,12 @@ public class Multiname {
|
||||
* @param withSuffix With suffix flag
|
||||
* @return Typename as string
|
||||
*/
|
||||
private String typeNameToStr(ABC abc, AVM2ConstantPool constants, List<DottedChain> fullyQualifiedNames, boolean dontDeobfuscate, boolean withSuffix) {
|
||||
private String typeNameToStr(Set<String> usedDeobfuscations, ABC abc, AVM2ConstantPool constants, List<DottedChain> fullyQualifiedNames, boolean dontDeobfuscate, boolean withSuffix) {
|
||||
if (cyclic) {
|
||||
return "§§cyclic_typename()";
|
||||
}
|
||||
StringBuilder typeNameStr = new StringBuilder();
|
||||
typeNameStr.append(constants.getMultiname(qname_index).getName(abc, constants, fullyQualifiedNames, dontDeobfuscate, withSuffix));
|
||||
typeNameStr.append(constants.getMultiname(qname_index).getName(usedDeobfuscations, abc, constants, fullyQualifiedNames, dontDeobfuscate, withSuffix));
|
||||
if (params != null && params.length > 0) {
|
||||
typeNameStr.append(".<");
|
||||
for (int i = 0; i < params.length; i++) {
|
||||
@@ -647,7 +649,7 @@ public class Multiname {
|
||||
if (param == 0) {
|
||||
typeNameStr.append("*");
|
||||
} else {
|
||||
typeNameStr.append(constants.getMultiname(param).getName(abc, constants, fullyQualifiedNames, dontDeobfuscate, withSuffix));
|
||||
typeNameStr.append(constants.getMultiname(param).getName(usedDeobfuscations, abc, constants, fullyQualifiedNames, dontDeobfuscate, withSuffix));
|
||||
}
|
||||
}
|
||||
typeNameStr.append(">");
|
||||
@@ -662,11 +664,12 @@ public class Multiname {
|
||||
* @param fullyQualifiedNames Fully qualified names
|
||||
* @param dontDeobfuscate Don't deobfuscate flag
|
||||
* @param withSuffix With suffix flag
|
||||
* @param usedDeobfuscations Used deobfuscations
|
||||
* @return Name with custom namespace
|
||||
*/
|
||||
public String getNameWithCustomNamespace(ABC abc, List<DottedChain> fullyQualifiedNames, boolean dontDeobfuscate, boolean withSuffix) {
|
||||
public String getNameWithCustomNamespace(Set<String> usedDeobfuscations, ABC abc, List<DottedChain> fullyQualifiedNames, boolean dontDeobfuscate, boolean withSuffix) {
|
||||
if (kind == TYPENAME) {
|
||||
return typeNameToStr(abc, abc.constants, fullyQualifiedNames, dontDeobfuscate, withSuffix);
|
||||
return typeNameToStr(usedDeobfuscations, abc, abc.constants, fullyQualifiedNames, dontDeobfuscate, withSuffix);
|
||||
}
|
||||
if (name_index == -1) {
|
||||
return "";
|
||||
@@ -682,7 +685,7 @@ public class Multiname {
|
||||
String nsname = dc != null ? dc.getLast() : null;
|
||||
|
||||
if (nsname != null && !"AS3".equals(nsname)) {
|
||||
String identifier = dontDeobfuscate ? nsname : IdentifiersDeobfuscation.printIdentifier(abc.getSwf(), true, nsname);
|
||||
String identifier = dontDeobfuscate ? nsname : IdentifiersDeobfuscation.printIdentifier(abc.getSwf(), usedDeobfuscations, true, nsname);
|
||||
if (identifier != null && !identifier.isEmpty()) {
|
||||
return identifier + "::" + name;
|
||||
}
|
||||
@@ -690,16 +693,17 @@ public class Multiname {
|
||||
}
|
||||
|
||||
if (nskind == Namespace.KIND_PACKAGE && fullyQualifiedNames != null && !fullyQualifiedNames.isEmpty() && fullyQualifiedNames.contains(DottedChain.parseWithSuffix(name))) {
|
||||
DottedChain dc = getNameWithNamespace(abc, abc.constants, withSuffix);
|
||||
return dontDeobfuscate ? dc.toRawString() : dc.toPrintableString(abc.getSwf(), true);
|
||||
DottedChain dc = getNameWithNamespace(usedDeobfuscations, abc, abc.constants, withSuffix);
|
||||
return dontDeobfuscate ? dc.toRawString() : dc.toPrintableString(usedDeobfuscations, abc.getSwf(), true);
|
||||
}
|
||||
return (isAttribute() ? "@" : "") + (dontDeobfuscate ? name : IdentifiersDeobfuscation.printIdentifier(abc.getSwf(), true, name)) + (withSuffix ? getNamespaceSuffix() : "");
|
||||
return (isAttribute() ? "@" : "") + (dontDeobfuscate ? name : IdentifiersDeobfuscation.printIdentifier(abc.getSwf(), usedDeobfuscations, true, name)) + (withSuffix ? getNamespaceSuffix() : "");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the name with custom namespace.
|
||||
*
|
||||
* @param usedDeobfuscations Used deobfuscations
|
||||
* @param abc ABC
|
||||
* @param fullyQualifiedNames Fully qualified names
|
||||
* @param dontDeobfuscate Don't deobfuscate flag
|
||||
@@ -707,9 +711,9 @@ public class Multiname {
|
||||
* @param customNamespaceRef Custom namespace
|
||||
* @return Name with custom namespace
|
||||
*/
|
||||
public String getNameAndCustomNamespace(ABC abc, List<DottedChain> fullyQualifiedNames, boolean dontDeobfuscate, boolean withSuffix, Reference<DottedChain> customNamespaceRef) {
|
||||
public String getNameAndCustomNamespace(Set<String> usedDeobfuscations, ABC abc, List<DottedChain> fullyQualifiedNames, boolean dontDeobfuscate, boolean withSuffix, Reference<DottedChain> customNamespaceRef) {
|
||||
if (kind == TYPENAME) {
|
||||
return typeNameToStr(abc, abc.constants, fullyQualifiedNames, dontDeobfuscate, withSuffix);
|
||||
return typeNameToStr(usedDeobfuscations, abc, abc.constants, fullyQualifiedNames, dontDeobfuscate, withSuffix);
|
||||
}
|
||||
if (name_index == -1) {
|
||||
return "";
|
||||
@@ -725,7 +729,7 @@ public class Multiname {
|
||||
String nsname = dc != null ? dc.getLast() : null;
|
||||
|
||||
if (nsname != null && !"AS3".equals(nsname)) {
|
||||
String identifier = dontDeobfuscate ? nsname : IdentifiersDeobfuscation.printIdentifier(abc.getSwf(), true, nsname);
|
||||
String identifier = dontDeobfuscate ? nsname : IdentifiersDeobfuscation.printIdentifier(abc.getSwf(), usedDeobfuscations, true, nsname);
|
||||
if (identifier != null && !identifier.isEmpty()) {
|
||||
customNamespaceRef.setVal(dc);
|
||||
return name;
|
||||
@@ -734,16 +738,17 @@ public class Multiname {
|
||||
}
|
||||
|
||||
if (nskind == Namespace.KIND_PACKAGE && fullyQualifiedNames != null && !fullyQualifiedNames.isEmpty() && fullyQualifiedNames.contains(DottedChain.parseWithSuffix(name))) {
|
||||
DottedChain dc = getNameWithNamespace(abc, abc.constants, withSuffix);
|
||||
return dontDeobfuscate ? dc.toRawString() : dc.toPrintableString(abc.getSwf(), true);
|
||||
DottedChain dc = getNameWithNamespace(usedDeobfuscations, abc, abc.constants, withSuffix);
|
||||
return dontDeobfuscate ? dc.toRawString() : dc.toPrintableString(usedDeobfuscations, abc.getSwf(), true);
|
||||
}
|
||||
return (isAttribute() ? "@" : "") + (dontDeobfuscate ? name : IdentifiersDeobfuscation.printIdentifier(abc.getSwf(), true, name)) + (withSuffix ? getNamespaceSuffix() : "");
|
||||
return (isAttribute() ? "@" : "") + (dontDeobfuscate ? name : IdentifiersDeobfuscation.printIdentifier(abc.getSwf(), usedDeobfuscations,true, name)) + (withSuffix ? getNamespaceSuffix() : "");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the name.
|
||||
*
|
||||
* @param usedDeobfuscations Used deobfuscations
|
||||
* @param abc ABC
|
||||
* @param constants Constant pool
|
||||
* @param fullyQualifiedNames Fully qualified names
|
||||
@@ -751,9 +756,9 @@ public class Multiname {
|
||||
* @param withSuffix With suffix flag
|
||||
* @return Name
|
||||
*/
|
||||
public String getName(ABC abc, AVM2ConstantPool constants, List<DottedChain> fullyQualifiedNames, boolean dontDeobfuscate, boolean withSuffix) {
|
||||
public String getName(Set<String> usedDeobfuscations, ABC abc, AVM2ConstantPool constants, List<DottedChain> fullyQualifiedNames, boolean dontDeobfuscate, boolean withSuffix) {
|
||||
if (kind == TYPENAME) {
|
||||
return typeNameToStr(abc, constants, fullyQualifiedNames, dontDeobfuscate, withSuffix);
|
||||
return typeNameToStr(usedDeobfuscations, abc, constants, fullyQualifiedNames, dontDeobfuscate, withSuffix);
|
||||
}
|
||||
if (name_index == -1) {
|
||||
return "";
|
||||
@@ -776,22 +781,23 @@ public class Multiname {
|
||||
isPublic = true;
|
||||
}
|
||||
if (isPublic && fullyQualifiedNames != null && !fullyQualifiedNames.isEmpty() && fullyQualifiedNames.contains(DottedChain.parseWithSuffix(name))) {
|
||||
DottedChain dc = getNameWithNamespace(abc, constants, withSuffix);
|
||||
return dontDeobfuscate ? dc.toRawString() : dc.toPrintableString(abc.getSwf(), true);
|
||||
DottedChain dc = getNameWithNamespace(usedDeobfuscations, abc, constants, withSuffix);
|
||||
return dontDeobfuscate ? dc.toRawString() : dc.toPrintableString(usedDeobfuscations, abc.getSwf(), true);
|
||||
}
|
||||
return (isAttribute() ? "@" : "") + (dontDeobfuscate ? name : IdentifiersDeobfuscation.printIdentifier(abc.getSwf(), true, name)) + (withSuffix ? getNamespaceSuffix() : "");
|
||||
return (isAttribute() ? "@" : "") + (dontDeobfuscate ? name : IdentifiersDeobfuscation.printIdentifier(abc.getSwf(), usedDeobfuscations, true, name)) + (withSuffix ? getNamespaceSuffix() : "");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the name with namespace.
|
||||
*
|
||||
* @param usedDeobfuscations Used deobfuscations
|
||||
* @param abc ABC
|
||||
* @param constants Constant pool
|
||||
* @param withSuffix With suffix flag
|
||||
* @return Name with namespace
|
||||
*/
|
||||
public DottedChain getNameWithNamespace(ABC abc, AVM2ConstantPool constants, boolean withSuffix) {
|
||||
public DottedChain getNameWithNamespace(Set<String> usedDeobfuscations, ABC abc, AVM2ConstantPool constants, boolean withSuffix) {
|
||||
DottedChain cached = constants.getCachedMultinameWithNamespace(this);
|
||||
if (cached != null) {
|
||||
return cached;
|
||||
@@ -812,7 +818,7 @@ public class Multiname {
|
||||
nsName = ns.getName(constants);
|
||||
}
|
||||
}
|
||||
String name = getName(abc, constants, null, true, false);
|
||||
String name = getName(usedDeobfuscations, abc, constants, null, true, false);
|
||||
DottedChain ret;
|
||||
if (nsName != null) {
|
||||
ret = nsName.add(name, withSuffix ? getNamespaceSuffix() : "");
|
||||
@@ -1066,7 +1072,7 @@ public class Multiname {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!Objects.equals(other.getName(otherAbc, otherCpool, new ArrayList<>(), true, true), getName(thisAbc, thisCpool, new ArrayList<>(), true, true))) {
|
||||
if (!Objects.equals(other.getName(new LinkedHashSet<>(), otherAbc, otherCpool, new ArrayList<>(), true, true), getName(new LinkedHashSet<>(), thisAbc, thisCpool, new ArrayList<>(), true, true))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ import com.jpexs.decompiler.flash.abc.ABC;
|
||||
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
|
||||
import com.jpexs.decompiler.flash.types.annotations.Internal;
|
||||
import com.jpexs.decompiler.graph.DottedChain;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Namespace in ABC file.
|
||||
@@ -180,12 +181,14 @@ public class Namespace {
|
||||
|
||||
/**
|
||||
* To string.
|
||||
*
|
||||
* @param usedDeobfuscations Used deobuscations
|
||||
* @param ABC abc
|
||||
* @param constants Constant pool
|
||||
* @return String representation
|
||||
*/
|
||||
public String toString(ABC abc, AVM2ConstantPool constants) {
|
||||
return getName(constants).toPrintableString(abc.getSwf(), true);
|
||||
public String toString(Set<String> usedDeobfuscations, ABC abc, AVM2ConstantPool constants) {
|
||||
return getName(constants).toPrintableString(usedDeobfuscations, abc.getSwf(), true);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -25,7 +25,9 @@ import com.jpexs.decompiler.flash.abc.types.traits.Traits;
|
||||
import com.jpexs.decompiler.flash.types.annotations.Internal;
|
||||
import com.jpexs.decompiler.graph.DottedChain;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Script info in ABC file.
|
||||
@@ -108,9 +110,10 @@ public class ScriptInfo {
|
||||
* returns null.
|
||||
*
|
||||
* @param abc ABC file
|
||||
* @param usedDeobfuscations Used deobfuscations
|
||||
* @return Simple pack name - Can be null!
|
||||
*/
|
||||
public DottedChain getSimplePackName(ABC abc) {
|
||||
public DottedChain getSimplePackName(ABC abc, Set<String> usedDeobfuscations) {
|
||||
List<Integer> packageTraits = new ArrayList<>();
|
||||
|
||||
for (int j = 0; j < traits.traits.size(); j++) {
|
||||
@@ -128,7 +131,7 @@ public class ScriptInfo {
|
||||
if (packageTraits.isEmpty() || packageTraits.size() > 1) {
|
||||
return null;
|
||||
}
|
||||
return traits.traits.get(packageTraits.get(0)).getName(abc).getNameWithNamespace(abc, abc.constants, true);
|
||||
return traits.traits.get(packageTraits.get(0)).getName(abc).getNameWithNamespace(usedDeobfuscations, abc, abc.constants, true);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -180,7 +183,7 @@ public class ScriptInfo {
|
||||
if ((nskind == Namespace.KIND_PACKAGE_INTERNAL)
|
||||
|| (nskind == Namespace.KIND_PACKAGE)) {
|
||||
DottedChain packageName = name.getSimpleNamespaceName(abc.constants); // assume not null package
|
||||
String objectName = name.getName(abc, abc.constants, null, true, false);
|
||||
String objectName = name.getName(new LinkedHashSet<>() /*???*/, abc, abc.constants, null, true, false);
|
||||
String namespaceSuffix = name.getNamespaceSuffix();
|
||||
List<Integer> traitIndices = new ArrayList<>();
|
||||
|
||||
@@ -190,7 +193,7 @@ public class ScriptInfo {
|
||||
otherTraits.clear();
|
||||
}
|
||||
|
||||
if (packagePrefix == null || packageName.toPrintableString(abc.getSwf(), true).startsWith(packagePrefix)) {
|
||||
if (packagePrefix == null || packageName.toPrintableString(new LinkedHashSet<>(), abc.getSwf(), true).startsWith(packagePrefix)) {
|
||||
|
||||
ClassPath cp = new ClassPath(packageName, objectName, namespaceSuffix, abc.getSwf());
|
||||
ScriptPack pack = new ScriptPack(cp, abc, allAbcs, scriptIndex, traitIndices);
|
||||
@@ -206,7 +209,7 @@ public class ScriptInfo {
|
||||
Multiname name = t.getName(abc);
|
||||
|
||||
DottedChain packageName = name.getSimpleNamespaceName(abc.constants);
|
||||
String objectName = name.getName(abc, abc.constants, null, true, false);
|
||||
String objectName = name.getName(new LinkedHashSet<>()/*???*/, abc, abc.constants, null, true, false);
|
||||
String namespaceSuffix = name.getNamespaceSuffix();
|
||||
|
||||
List<Integer> traitIndices = new ArrayList<>();
|
||||
|
||||
@@ -183,12 +183,13 @@ public abstract class Trait implements Cloneable, Serializable {
|
||||
/**
|
||||
* Gets metadata table.
|
||||
*
|
||||
* @param usedDeobfuscations Used deobfuscations
|
||||
* @param parent Parent trait
|
||||
* @param convertData Convert data
|
||||
* @param abc ABC
|
||||
* @return Metadata table
|
||||
*/
|
||||
public final List<Entry<String, Map<String, String>>> getMetaDataTable(Trait parent, ConvertData convertData, ABC abc) {
|
||||
public final List<Entry<String, Map<String, String>>> getMetaDataTable(Set<String> usedDeobfuscations, Trait parent, ConvertData convertData, ABC abc) {
|
||||
List<Entry<String, Map<String, String>>> ret = new ArrayList<>();
|
||||
for (int m : metadata) {
|
||||
if (m >= 0 && m < abc.metadata_info.size()) {
|
||||
@@ -211,11 +212,11 @@ public abstract class Trait implements Cloneable, Serializable {
|
||||
public var attr2;
|
||||
*/
|
||||
if (parent instanceof TraitClass) {
|
||||
String thisName = getName(abc).getName(abc, abc.constants, new ArrayList<>(), true, true);
|
||||
String thisName = getName(abc).getName(usedDeobfuscations, abc, abc.constants, new ArrayList<>(), true, true);
|
||||
List<Trait> classTraits = abc.class_info.get(((TraitClass) parent).class_info).static_traits.traits;
|
||||
for (Trait t : classTraits) {
|
||||
if (t.kindType == Trait.TRAIT_SLOT) {
|
||||
if ("_skinParts".equals(t.getName(abc).getName(abc, abc.constants, new ArrayList<>(), true, true))) {
|
||||
if ("_skinParts".equals(t.getName(abc).getName(usedDeobfuscations, abc, abc.constants, new ArrayList<>(), true, true))) {
|
||||
if (t.getName(abc).getNamespace(abc.constants).kind == Namespace.KIND_PRIVATE) {
|
||||
if (convertData.assignedValues.containsKey(t)) {
|
||||
if (convertData.assignedValues.get(t).value instanceof NewObjectAVM2Item) {
|
||||
@@ -269,6 +270,7 @@ public abstract class Trait implements Cloneable, Serializable {
|
||||
/**
|
||||
* Gets dependencies.
|
||||
*
|
||||
* @param usedDeobfuscations Used deobfuscations
|
||||
* @param abcIndex ABC indexing
|
||||
* @param scriptIndex Script index
|
||||
* @param classIndex Class index
|
||||
@@ -281,7 +283,7 @@ public abstract class Trait implements Cloneable, Serializable {
|
||||
* @param uses Uses
|
||||
* @throws InterruptedException On interrupt
|
||||
*/
|
||||
public void getDependencies(AbcIndexing abcIndex, int scriptIndex, int classIndex, boolean isStatic, String customNamespace, ABC abc, List<Dependency> dependencies, DottedChain ignorePackage, List<DottedChain> fullyQualifiedNames, List<String> uses, Reference<Integer> numberContextRef) throws InterruptedException {
|
||||
public void getDependencies(Set<String> usedDeobfuscations, AbcIndexing abcIndex, int scriptIndex, int classIndex, boolean isStatic, String customNamespace, ABC abc, List<Dependency> dependencies, DottedChain ignorePackage, List<DottedChain> fullyQualifiedNames, List<String> uses, Reference<Integer> numberContextRef) throws InterruptedException {
|
||||
if (customNamespace == null) {
|
||||
Multiname m = getName(abc);
|
||||
int nskind = m.getSimpleNamespaceKind(abc.constants);
|
||||
@@ -289,7 +291,7 @@ public abstract class Trait implements Cloneable, Serializable {
|
||||
customNamespace = m.getSimpleNamespaceName(abc.constants).toRawString();
|
||||
}
|
||||
}
|
||||
DependencyParser.parseDependenciesFromMultiname(abcIndex, customNamespace, abc, dependencies, getName(abc), ignorePackage, fullyQualifiedNames, DependencyType.NAMESPACE, uses);
|
||||
DependencyParser.parseDependenciesFromMultiname(usedDeobfuscations, abcIndex, customNamespace, abc, dependencies, getName(abc), ignorePackage, fullyQualifiedNames, DependencyType.NAMESPACE, uses);
|
||||
//DependencyParser.parseUsagesFromMultiname(ignoredCustom, abc, dependencies, getName(abc), ignorePackage, fullyQualifiedNames, DependencyType.NAMESPACE);
|
||||
}
|
||||
|
||||
@@ -316,6 +318,7 @@ public abstract class Trait implements Cloneable, Serializable {
|
||||
/**
|
||||
* Gets all class trait names.
|
||||
*
|
||||
* @param usedDeobfuscations Used deobfuscations
|
||||
* @param traitNamesInThisScript Trait names in this script
|
||||
* @param abcIndex ABC indexing
|
||||
* @param abc ABC
|
||||
@@ -323,7 +326,7 @@ public abstract class Trait implements Cloneable, Serializable {
|
||||
* @param scriptIndex Script index
|
||||
* @param isParent Is parent
|
||||
*/
|
||||
private static void getAllClassTraitNames(List<String> traitNamesInThisScript, AbcIndexing abcIndex, ABC abc, int classIndex, Integer scriptIndex, boolean isParent) {
|
||||
private static void getAllClassTraitNames(Set<String> usedDeobfuscations, List<String> traitNamesInThisScript, AbcIndexing abcIndex, ABC abc, int classIndex, Integer scriptIndex, boolean isParent) {
|
||||
boolean publicProtectedOnly = isParent;
|
||||
for (Trait it : abc.instance_info.get(classIndex).instance_traits.traits) {
|
||||
if (publicProtectedOnly) {
|
||||
@@ -332,7 +335,7 @@ public abstract class Trait implements Cloneable, Serializable {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
traitNamesInThisScript.add(it.getName(abc).getName(abc, abc.constants, new ArrayList<>(), true, true));
|
||||
traitNamesInThisScript.add(it.getName(abc).getName(usedDeobfuscations, abc, abc.constants, new ArrayList<>(), true, true));
|
||||
}
|
||||
for (Trait ct : abc.class_info.get(classIndex).static_traits.traits) {
|
||||
if (publicProtectedOnly) {
|
||||
@@ -341,21 +344,22 @@ public abstract class Trait implements Cloneable, Serializable {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
traitNamesInThisScript.add(ct.getName(abc).getName(abc, abc.constants, new ArrayList<>(), true, true));
|
||||
traitNamesInThisScript.add(ct.getName(abc).getName(usedDeobfuscations, abc, abc.constants, new ArrayList<>(), true, true));
|
||||
}
|
||||
if (abc.instance_info.get(classIndex).super_index == 0) {
|
||||
return;
|
||||
}
|
||||
DottedChain fullClassName = abc.constants.getMultiname(abc.instance_info.get(classIndex).super_index).getNameWithNamespace(abc, abc.constants, true);
|
||||
DottedChain fullClassName = abc.constants.getMultiname(abc.instance_info.get(classIndex).super_index).getNameWithNamespace(usedDeobfuscations, abc, abc.constants, true);
|
||||
AbcIndexing.ClassIndex ci = abcIndex.findClass(new TypeItem(fullClassName), abc, scriptIndex);
|
||||
if (ci != null) {
|
||||
getAllClassTraitNames(traitNamesInThisScript, abcIndex, ci.abc, ci.index, ci.scriptIndex, true);
|
||||
getAllClassTraitNames(usedDeobfuscations, traitNamesInThisScript, abcIndex, ci.abc, ci.index, ci.scriptIndex, true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Writes imports.
|
||||
*
|
||||
* @param usedDeobfuscations Used deobfuscations
|
||||
* @param traits Traits
|
||||
* @param methodIndex Method index
|
||||
* @param abcIndex ABC indexing
|
||||
@@ -369,13 +373,13 @@ public abstract class Trait implements Cloneable, Serializable {
|
||||
* @return True if its not empty
|
||||
* @throws InterruptedException On interrupt
|
||||
*/
|
||||
public static boolean writeImports(List<Trait> traits, int methodIndex, AbcIndexing abcIndex, int scriptIndex, int classIndex, boolean isStatic, ABC abc, GraphTextWriter writer, DottedChain ignorePackage, List<DottedChain> fullyQualifiedNames) throws InterruptedException {
|
||||
public static boolean writeImports(Set<String> usedDeobfuscations, List<Trait> traits, int methodIndex, AbcIndexing abcIndex, int scriptIndex, int classIndex, boolean isStatic, ABC abc, GraphTextWriter writer, DottedChain ignorePackage, List<DottedChain> fullyQualifiedNames) throws InterruptedException {
|
||||
|
||||
List<String> namesInThisPackage = new ArrayList<>();
|
||||
for (ABCContainerTag tag : abc.getAbcTags()) {
|
||||
for (ScriptInfo si : tag.getABC().script_info) {
|
||||
for (Trait t : si.traits.traits) {
|
||||
ClassPath classPath = t.getPath(tag.getABC());
|
||||
ClassPath classPath = t.getPath(usedDeobfuscations, tag.getABC());
|
||||
if (classPath.packageStr.equals(ignorePackage)) {
|
||||
namesInThisPackage.add(classPath.className);
|
||||
}
|
||||
@@ -386,9 +390,9 @@ public abstract class Trait implements Cloneable, Serializable {
|
||||
List<String> traitNamesInThisScript = new ArrayList<>();
|
||||
for (Trait st : abc.script_info.get(scriptIndex).traits.traits) {
|
||||
if (st instanceof TraitClass) {
|
||||
getAllClassTraitNames(traitNamesInThisScript, abcIndex, abc, ((TraitClass) st).class_info, scriptIndex, false);
|
||||
getAllClassTraitNames(usedDeobfuscations, traitNamesInThisScript, abcIndex, abc, ((TraitClass) st).class_info, scriptIndex, false);
|
||||
} else {
|
||||
traitNamesInThisScript.add(st.getName(abc).getName(abc, abc.constants, new ArrayList<>(), true, true));
|
||||
traitNamesInThisScript.add(st.getName(abc).getName(usedDeobfuscations, abc, abc.constants, new ArrayList<>(), true, true));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -407,10 +411,10 @@ public abstract class Trait implements Cloneable, Serializable {
|
||||
if (nskind == Namespace.KIND_NAMESPACE) {
|
||||
customNs = multiname.getSimpleNamespaceName(abc.constants).toRawString();
|
||||
}
|
||||
trait.getDependencies(abcIndex, scriptIndex, classIndex, isStatic, customNs, abc, dependencies, ignorePackage, new ArrayList<>(), uses, numberContextRef);
|
||||
trait.getDependencies(usedDeobfuscations, abcIndex, scriptIndex, classIndex, isStatic, customNs, abc, dependencies, ignorePackage, new ArrayList<>(), uses, numberContextRef);
|
||||
}
|
||||
if (methodIndex != -1) {
|
||||
DependencyParser.parseDependenciesFromMethodInfo(abcIndex, null, scriptIndex, classIndex, isStatic, customNs, abc, methodIndex, dependencies, ignorePackage, fullyQualifiedNames, new ArrayList<>(), uses, numberContextRef);
|
||||
DependencyParser.parseDependenciesFromMethodInfo(usedDeobfuscations, abcIndex, null, scriptIndex, classIndex, isStatic, customNs, abc, methodIndex, dependencies, ignorePackage, fullyQualifiedNames, new ArrayList<>(), uses, numberContextRef);
|
||||
}
|
||||
List<DottedChain> imports = new ArrayList<>();
|
||||
for (Dependency d : dependencies) {
|
||||
@@ -481,13 +485,13 @@ public abstract class Trait implements Cloneable, Serializable {
|
||||
writer.appendNoHilight("import ");
|
||||
|
||||
if (imp.size() > 1) {
|
||||
writer.appendNoHilight(imp.getWithoutLast().toPrintableString(abc.getSwf(), true));
|
||||
writer.appendNoHilight(imp.getWithoutLast().toPrintableString(usedDeobfuscations,abc.getSwf(), true));
|
||||
writer.appendNoHilight(".");
|
||||
}
|
||||
if ("*".equals(imp.getLast())) {
|
||||
writer.appendNoHilight("*");
|
||||
} else {
|
||||
writer.hilightSpecial(IdentifiersDeobfuscation.printIdentifier(abc.getSwf(), true, imp.getLast()), HighlightSpecialType.TYPE_NAME, imp.toRawString());
|
||||
writer.hilightSpecial(IdentifiersDeobfuscation.printIdentifier(abc.getSwf(),usedDeobfuscations, true, imp.getLast()), HighlightSpecialType.TYPE_NAME, imp.toRawString());
|
||||
}
|
||||
writer.appendNoHilight(";").newLine();
|
||||
hasImport = true;
|
||||
@@ -532,20 +536,21 @@ public abstract class Trait implements Cloneable, Serializable {
|
||||
/**
|
||||
* Gets metadata.
|
||||
*
|
||||
* @param usedDeobfuscations Used deobfuscations
|
||||
* @param parent Parent trait
|
||||
* @param convertData Convert data
|
||||
* @param abc ABC
|
||||
* @param writer Writer
|
||||
* @return Writer
|
||||
*/
|
||||
public final GraphTextWriter getMetaData(Trait parent, ConvertData convertData, ABC abc, GraphTextWriter writer) {
|
||||
List<Entry<String, Map<String, String>>> md = getMetaDataTable(parent, convertData, abc);
|
||||
public final GraphTextWriter getMetaData(Set<String> usedDeobfuscations, Trait parent, ConvertData convertData, ABC abc, GraphTextWriter writer) {
|
||||
List<Entry<String, Map<String, String>>> md = getMetaDataTable(usedDeobfuscations, parent, convertData, abc);
|
||||
for (Entry<String, Map<String, String>> en : md) {
|
||||
String name = en.getKey();
|
||||
if (METADATA_DEFINITION.equals(name) || METADATA_CTOR_DEFINITION.equals(name)) {
|
||||
continue;
|
||||
}
|
||||
writer.append("[").append(IdentifiersDeobfuscation.printIdentifier(abc.getSwf(), true, name));
|
||||
writer.append("[").append(IdentifiersDeobfuscation.printIdentifier(abc.getSwf(), usedDeobfuscations, true, name));
|
||||
if (!en.getValue().isEmpty()) {
|
||||
writer.append("(");
|
||||
boolean first = true;
|
||||
@@ -555,7 +560,7 @@ public abstract class Trait implements Cloneable, Serializable {
|
||||
}
|
||||
first = false;
|
||||
if (key != null && !key.isEmpty()) {
|
||||
writer.append(IdentifiersDeobfuscation.printIdentifier(abc.getSwf(), true, key)).append("=");
|
||||
writer.append(IdentifiersDeobfuscation.printIdentifier(abc.getSwf(), usedDeobfuscations, true, key)).append("=");
|
||||
}
|
||||
writer.append("\"");
|
||||
String val = en.getValue().get(key);
|
||||
@@ -599,6 +604,7 @@ public abstract class Trait implements Cloneable, Serializable {
|
||||
/**
|
||||
* Gets modifiers.
|
||||
*
|
||||
* @param usedDeobfuscations Used deobfuscations
|
||||
* @param abc ABC
|
||||
* @param isStatic Is static
|
||||
* @param insideInterface Inside interface
|
||||
@@ -606,7 +612,7 @@ public abstract class Trait implements Cloneable, Serializable {
|
||||
* @param classIndex Class index
|
||||
* @return Writer
|
||||
*/
|
||||
public final GraphTextWriter getModifiers(ABC abc, boolean isStatic, boolean insideInterface, GraphTextWriter writer, int classIndex) {
|
||||
public final GraphTextWriter getModifiers(Set<String> usedDeobfuscations, ABC abc, boolean isStatic, boolean insideInterface, GraphTextWriter writer, int classIndex) {
|
||||
if ((kindFlags & ATTR_Final) > 0) {
|
||||
if (!isStatic) {
|
||||
writer.appendNoHilight("final ");
|
||||
@@ -629,7 +635,7 @@ public abstract class Trait implements Cloneable, Serializable {
|
||||
writer.append(Helper.escapeActionScriptString(m.getSimpleNamespaceName(abc.constants).toRawString()));
|
||||
writer.append("\") ");
|
||||
} else if (dc != null && nsname != null) {
|
||||
String identifier = IdentifiersDeobfuscation.printIdentifier(abc.getSwf(), true, nsname);
|
||||
String identifier = IdentifiersDeobfuscation.printIdentifier(abc.getSwf(), usedDeobfuscations, true, nsname);
|
||||
if (identifier != null && !identifier.isEmpty()) {
|
||||
writer.hilightSpecial(identifier, HighlightSpecialType.TYPE_NAME, dc.toRawString()).appendNoHilight(" ");
|
||||
}
|
||||
@@ -712,6 +718,7 @@ public abstract class Trait implements Cloneable, Serializable {
|
||||
/**
|
||||
* To string.
|
||||
*
|
||||
* @param usedDeobfuscations Used deobfuscations
|
||||
* @param swfVersion SWF version
|
||||
* @param abcIndex ABC indexing
|
||||
* @param packageName Package name
|
||||
@@ -730,7 +737,7 @@ public abstract class Trait implements Cloneable, Serializable {
|
||||
* @return Writer
|
||||
* @throws InterruptedException On interrupt
|
||||
*/
|
||||
public GraphTextWriter toString(int swfVersion, AbcIndexing abcIndex, DottedChain packageName, Trait parent, ConvertData convertData, String path, ABC abc, boolean isStatic, ScriptExportMode exportMode, int scriptIndex, int classIndex, GraphTextWriter writer, List<DottedChain> fullyQualifiedNames, boolean parallel, boolean insideInterface) throws InterruptedException {
|
||||
public GraphTextWriter toString(Set<String> usedDeobfuscations, int swfVersion, AbcIndexing abcIndex, DottedChain packageName, Trait parent, ConvertData convertData, String path, ABC abc, boolean isStatic, ScriptExportMode exportMode, int scriptIndex, int classIndex, GraphTextWriter writer, List<DottedChain> fullyQualifiedNames, boolean parallel, boolean insideInterface) throws InterruptedException {
|
||||
writer.appendNoHilight(abc.constants.getMultiname(name_index).toString(abc.constants, fullyQualifiedNames) + " kind=" + kindType + " metadata=" + Helper.intArrToString(metadata));
|
||||
return writer;
|
||||
}
|
||||
@@ -738,6 +745,7 @@ public abstract class Trait implements Cloneable, Serializable {
|
||||
/**
|
||||
* Converts trait.
|
||||
*
|
||||
* @param usedDeobfuscations Used deobfuscations
|
||||
* @param swfVersion SWF version
|
||||
* @param abcIndex ABC indexing
|
||||
* @param parent Parent trait
|
||||
@@ -754,7 +762,7 @@ public abstract class Trait implements Cloneable, Serializable {
|
||||
* @param scopeStack Scope stack
|
||||
* @throws InterruptedException On interrupt
|
||||
*/
|
||||
public void convert(int swfVersion, AbcIndexing abcIndex, Trait parent, ConvertData convertData, String path, ABC abc, boolean isStatic, ScriptExportMode exportMode, int scriptIndex, int classIndex, NulWriter writer, List<DottedChain> fullyQualifiedNames, boolean parallel, ScopeStack scopeStack) throws InterruptedException {
|
||||
public void convert(Set<String> usedDeobfuscations, int swfVersion, AbcIndexing abcIndex, Trait parent, ConvertData convertData, String path, ABC abc, boolean isStatic, ScriptExportMode exportMode, int scriptIndex, int classIndex, NulWriter writer, List<DottedChain> fullyQualifiedNames, boolean parallel, ScopeStack scopeStack) throws InterruptedException {
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -851,6 +859,7 @@ public abstract class Trait implements Cloneable, Serializable {
|
||||
/**
|
||||
* ToString conversion including package.
|
||||
*
|
||||
* @param usedDeobfuscations Used deobfuscations
|
||||
* @param swfVersion SWF version
|
||||
* @param abcIndex ABC indexing
|
||||
* @param parent Parent trait
|
||||
@@ -868,11 +877,11 @@ public abstract class Trait implements Cloneable, Serializable {
|
||||
* @return Writer
|
||||
* @throws InterruptedException On interrupt
|
||||
*/
|
||||
public GraphTextWriter toStringPackaged(int swfVersion, AbcIndexing abcIndex, Trait parent, ConvertData convertData, String path, ABC abc, boolean isStatic, ScriptExportMode exportMode, int scriptIndex, int classIndex, GraphTextWriter writer, List<DottedChain> fullyQualifiedNames, boolean parallel, boolean insideInterface) throws InterruptedException {
|
||||
public GraphTextWriter toStringPackaged(Set<String> usedDeobfuscations, int swfVersion, AbcIndexing abcIndex, Trait parent, ConvertData convertData, String path, ABC abc, boolean isStatic, ScriptExportMode exportMode, int scriptIndex, int classIndex, GraphTextWriter writer, List<DottedChain> fullyQualifiedNames, boolean parallel, boolean insideInterface) throws InterruptedException {
|
||||
Multiname name = abc.constants.getMultiname(name_index);
|
||||
int nskind = name.getSimpleNamespaceKind(abc.constants);
|
||||
if ((nskind == Namespace.KIND_PACKAGE) || (nskind == Namespace.KIND_PACKAGE_INTERNAL)) {
|
||||
String nsname = name.getSimpleNamespaceName(abc.constants).toPrintableString(abc.getSwf(), true);
|
||||
String nsname = name.getSimpleNamespaceName(abc.constants).toPrintableString(usedDeobfuscations, abc.getSwf(), true);
|
||||
writer.appendNoHilight("package");
|
||||
if (!nsname.isEmpty()) {
|
||||
writer.appendNoHilight(" " + nsname); //assume not null name
|
||||
@@ -880,8 +889,8 @@ public abstract class Trait implements Cloneable, Serializable {
|
||||
writer.startBlock();
|
||||
List<Trait> traits = new ArrayList<>();
|
||||
traits.add(this);
|
||||
writeImports(traits, -1, abcIndex, scriptIndex, classIndex, isStatic, abc, writer, getPackage(abc), fullyQualifiedNames);
|
||||
toString(swfVersion, abcIndex, name.getNameWithNamespace(abc, abc.constants, true).getWithoutLast(), parent, convertData, path, abc, isStatic, exportMode, scriptIndex, classIndex, writer, fullyQualifiedNames, parallel, insideInterface);
|
||||
writeImports(usedDeobfuscations, traits, -1, abcIndex, scriptIndex, classIndex, isStatic, abc, writer, getPackage(abc), fullyQualifiedNames);
|
||||
toString(usedDeobfuscations, swfVersion, abcIndex, name.getNameWithNamespace(usedDeobfuscations, abc, abc.constants, true).getWithoutLast(), parent, convertData, path, abc, isStatic, exportMode, scriptIndex, classIndex, writer, fullyQualifiedNames, parallel, insideInterface);
|
||||
writer.endBlock();
|
||||
writer.newLine();
|
||||
}
|
||||
@@ -891,6 +900,7 @@ public abstract class Trait implements Cloneable, Serializable {
|
||||
/**
|
||||
* Converts trait including package.
|
||||
*
|
||||
* @param usedDeobfuscations Used deobfuscations
|
||||
* @param swfVersion
|
||||
* @param abcIndex ABC indexing
|
||||
* @param parent Parent trait
|
||||
@@ -907,18 +917,19 @@ public abstract class Trait implements Cloneable, Serializable {
|
||||
* @param scopeStack Scope stack
|
||||
* @throws InterruptedException On interrupt
|
||||
*/
|
||||
public void convertPackaged(int swfVersion, AbcIndexing abcIndex, Trait parent, ConvertData convertData, String path, ABC abc, boolean isStatic, ScriptExportMode exportMode, int scriptIndex, int classIndex, NulWriter writer, List<DottedChain> fullyQualifiedNames, boolean parallel, ScopeStack scopeStack) throws InterruptedException {
|
||||
public void convertPackaged(Set<String> usedDeobfuscations, int swfVersion, AbcIndexing abcIndex, Trait parent, ConvertData convertData, String path, ABC abc, boolean isStatic, ScriptExportMode exportMode, int scriptIndex, int classIndex, NulWriter writer, List<DottedChain> fullyQualifiedNames, boolean parallel, ScopeStack scopeStack) throws InterruptedException {
|
||||
Multiname name = abc.constants.getMultiname(name_index);
|
||||
int nskind = name.getSimpleNamespaceKind(abc.constants);
|
||||
if ((nskind == Namespace.KIND_PACKAGE) || (nskind == Namespace.KIND_PACKAGE_INTERNAL)) {
|
||||
String nsname = name.getSimpleNamespaceName(abc.constants).toPrintableString(abc.getSwf(), true);
|
||||
convert(swfVersion, abcIndex, parent, convertData, path + nsname, abc, isStatic, exportMode, scriptIndex, classIndex, writer, fullyQualifiedNames, parallel, scopeStack);
|
||||
String nsname = name.getSimpleNamespaceName(abc.constants).toPrintableString(usedDeobfuscations, abc.getSwf(), true);
|
||||
convert(usedDeobfuscations, swfVersion, abcIndex, parent, convertData, path + nsname, abc, isStatic, exportMode, scriptIndex, classIndex, writer, fullyQualifiedNames, parallel, scopeStack);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* ToString of header.
|
||||
*
|
||||
* @param usedDeobfuscations Used deobfuscations
|
||||
* @param swfVersion SWF version
|
||||
* @param parent Parent trait
|
||||
* @param packageName Package name
|
||||
@@ -936,14 +947,15 @@ public abstract class Trait implements Cloneable, Serializable {
|
||||
* @return Writer
|
||||
* @throws InterruptedException On interrupt
|
||||
*/
|
||||
public GraphTextWriter toStringHeader(int swfVersion, Trait parent, DottedChain packageName, ConvertData convertData, String path, ABC abc, boolean isStatic, ScriptExportMode exportMode, int scriptIndex, int classIndex, GraphTextWriter writer, List<DottedChain> fullyQualifiedNames, boolean parallel, boolean insideInterface) throws InterruptedException {
|
||||
toString(swfVersion, null, packageName, parent, convertData, path, abc, isStatic, exportMode, scriptIndex, classIndex, writer, fullyQualifiedNames, parallel, insideInterface);
|
||||
public GraphTextWriter toStringHeader(Set<String> usedDeobfuscations, int swfVersion, Trait parent, DottedChain packageName, ConvertData convertData, String path, ABC abc, boolean isStatic, ScriptExportMode exportMode, int scriptIndex, int classIndex, GraphTextWriter writer, List<DottedChain> fullyQualifiedNames, boolean parallel, boolean insideInterface) throws InterruptedException {
|
||||
toString(usedDeobfuscations, swfVersion, null, packageName, parent, convertData, path, abc, isStatic, exportMode, scriptIndex, classIndex, writer, fullyQualifiedNames, parallel, insideInterface);
|
||||
return writer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts header.
|
||||
*
|
||||
* @param usedDeobfuscations Used deobfuscations
|
||||
* @param swfVersion SWF version
|
||||
* @param parent Parent trait
|
||||
* @param convertData Convert data
|
||||
@@ -958,8 +970,8 @@ public abstract class Trait implements Cloneable, Serializable {
|
||||
* @param parallel Parallel
|
||||
* @throws InterruptedException On interrupt
|
||||
*/
|
||||
public void convertHeader(int swfVersion, Trait parent, ConvertData convertData, String path, ABC abc, boolean isStatic, ScriptExportMode exportMode, int scriptIndex, int classIndex, NulWriter writer, List<DottedChain> fullyQualifiedNames, boolean parallel) throws InterruptedException {
|
||||
convert(swfVersion, null, parent, convertData, path, abc, isStatic, exportMode, scriptIndex, classIndex, writer, fullyQualifiedNames, parallel, new ScopeStack());
|
||||
public void convertHeader(Set<String> usedDeobfuscations, int swfVersion, Trait parent, ConvertData convertData, String path, ABC abc, boolean isStatic, ScriptExportMode exportMode, int scriptIndex, int classIndex, NulWriter writer, List<DottedChain> fullyQualifiedNames, boolean parallel) throws InterruptedException {
|
||||
convert(usedDeobfuscations, swfVersion, null, parent, convertData, path, abc, isStatic, exportMode, scriptIndex, classIndex, writer, fullyQualifiedNames, parallel, new ScopeStack());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -992,14 +1004,15 @@ public abstract class Trait implements Cloneable, Serializable {
|
||||
/**
|
||||
* Gets class path.
|
||||
*
|
||||
* @param usedDeobfuscations Used deobfuscations
|
||||
* @param abc ABC
|
||||
* @return Class path
|
||||
*/
|
||||
public final ClassPath getPath(ABC abc) {
|
||||
public final ClassPath getPath(Set<String> usedDeobfuscations, ABC abc) {
|
||||
Multiname name = getName(abc);
|
||||
Namespace ns = name.getNamespace(abc.constants);
|
||||
DottedChain packageName = ns == null ? DottedChain.EMPTY : ns.getName(abc.constants);
|
||||
String objectName = name.getName(abc, abc.constants, null, true, false);
|
||||
String objectName = name.getName(usedDeobfuscations, abc, abc.constants, null, true, false);
|
||||
String namespaceSuffix = name.getNamespaceSuffix();
|
||||
return new ClassPath(packageName, objectName, namespaceSuffix, abc.getSwf()); //assume not null name
|
||||
}
|
||||
|
||||
@@ -53,7 +53,9 @@ import com.jpexs.helpers.Helper;
|
||||
import com.jpexs.helpers.Reference;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Class trait in ABC file
|
||||
@@ -105,57 +107,42 @@ public class TraitClass extends Trait implements TraitWithSlot {
|
||||
return slot_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets dependencies.
|
||||
*
|
||||
* @param abcIndex ABC indexing
|
||||
* @param scriptIndex Script index
|
||||
* @param classIndex Class index
|
||||
* @param isStatic Is static
|
||||
* @param customNamespace Custom namespace
|
||||
* @param abc ABC
|
||||
* @param dependencies Dependencies
|
||||
* @param ignorePackage Ignore package
|
||||
* @param fullyQualifiedNames Fully qualified names
|
||||
* @param uses Uses
|
||||
* @throws InterruptedException On interrupt
|
||||
*/
|
||||
@Override
|
||||
public void getDependencies(AbcIndexing abcIndex, int scriptIndex, int classIndex, boolean isStatic, String customNamespace, ABC abc, List<Dependency> dependencies, DottedChain ignorePackage, List<DottedChain> fullyQualifiedNames, List<String> uses, Reference<Integer> numberContextRef) throws InterruptedException {
|
||||
super.getDependencies(abcIndex, scriptIndex, -1, false, customNamespace, abc, dependencies, ignorePackage == null ? getPackage(abc) : ignorePackage, fullyQualifiedNames, uses, numberContextRef);
|
||||
public void getDependencies(Set<String> usedDeobfuscations, AbcIndexing abcIndex, int scriptIndex, int classIndex, boolean isStatic, String customNamespace, ABC abc, List<Dependency> dependencies, DottedChain ignorePackage, List<DottedChain> fullyQualifiedNames, List<String> uses, Reference<Integer> numberContextRef) throws InterruptedException {
|
||||
super.getDependencies(usedDeobfuscations, abcIndex, scriptIndex, -1, false, customNamespace, abc, dependencies, ignorePackage == null ? getPackage(abc) : ignorePackage, fullyQualifiedNames, uses, numberContextRef);
|
||||
ClassInfo classInfo = abc.class_info.get(class_info);
|
||||
InstanceInfo instanceInfo = abc.instance_info.get(class_info);
|
||||
DottedChain packageName = instanceInfo.getName(abc.constants).getNamespace(abc.constants).getName(abc.constants); //assume not null name
|
||||
|
||||
//DependencyParser.parseDependenciesFromMultiname(customNs, abc, dependencies, uses, abc.constants.getMultiname(instanceInfo.name_index), packageName, fullyQualifiedNames);
|
||||
if (instanceInfo.super_index > 0) {
|
||||
DependencyParser.parseDependenciesFromMultiname(abcIndex, customNamespace, abc, dependencies, abc.constants.getMultiname(instanceInfo.super_index), packageName, fullyQualifiedNames, DependencyType.INHERITANCE, uses);
|
||||
DependencyParser.parseDependenciesFromMultiname(usedDeobfuscations, abcIndex, customNamespace, abc, dependencies, abc.constants.getMultiname(instanceInfo.super_index), packageName, fullyQualifiedNames, DependencyType.INHERITANCE, uses);
|
||||
}
|
||||
for (int i : instanceInfo.interfaces) {
|
||||
DependencyParser.parseDependenciesFromMultiname(abcIndex, customNamespace, abc, dependencies, abc.constants.getMultiname(i), packageName, fullyQualifiedNames, DependencyType.INHERITANCE, uses);
|
||||
DependencyParser.parseDependenciesFromMultiname(usedDeobfuscations, abcIndex, customNamespace, abc, dependencies, abc.constants.getMultiname(i), packageName, fullyQualifiedNames, DependencyType.INHERITANCE, uses);
|
||||
}
|
||||
|
||||
//static
|
||||
classInfo.static_traits.getDependencies(abcIndex, scriptIndex, class_info, true, customNamespace, abc, dependencies, packageName, fullyQualifiedNames, uses, numberContextRef);
|
||||
classInfo.static_traits.getDependencies(usedDeobfuscations, abcIndex, scriptIndex, class_info, true, customNamespace, abc, dependencies, packageName, fullyQualifiedNames, uses, numberContextRef);
|
||||
|
||||
//static initializer
|
||||
DependencyParser.parseDependenciesFromMethodInfo(abcIndex, null, scriptIndex, class_info, true, customNamespace, abc, classInfo.cinit_index, dependencies, packageName, fullyQualifiedNames, new ArrayList<>(), uses, numberContextRef);
|
||||
DependencyParser.parseDependenciesFromMethodInfo(usedDeobfuscations, abcIndex, null, scriptIndex, class_info, true, customNamespace, abc, classInfo.cinit_index, dependencies, packageName, fullyQualifiedNames, new ArrayList<>(), uses, numberContextRef);
|
||||
|
||||
//instance
|
||||
instanceInfo.instance_traits.getDependencies(abcIndex, scriptIndex, class_info, false, customNamespace, abc, dependencies, packageName, fullyQualifiedNames, uses, numberContextRef);
|
||||
instanceInfo.instance_traits.getDependencies(usedDeobfuscations, abcIndex, scriptIndex, class_info, false, customNamespace, abc, dependencies, packageName, fullyQualifiedNames, uses, numberContextRef);
|
||||
|
||||
//instance initializer
|
||||
DependencyParser.parseDependenciesFromMethodInfo(abcIndex, null, scriptIndex, class_info, false, customNamespace, abc, instanceInfo.iinit_index, dependencies, packageName, fullyQualifiedNames, new ArrayList<>(), uses, numberContextRef);
|
||||
DependencyParser.parseDependenciesFromMethodInfo(usedDeobfuscations, abcIndex, null, scriptIndex, class_info, false, customNamespace, abc, instanceInfo.iinit_index, dependencies, packageName, fullyQualifiedNames, new ArrayList<>(), uses, numberContextRef);
|
||||
}
|
||||
|
||||
@Override
|
||||
public GraphTextWriter toStringHeader(int swfVersion, Trait parent, DottedChain packageName, ConvertData convertData, String path, ABC abc, boolean isStatic, ScriptExportMode exportMode, int scriptIndex, int classIndex, GraphTextWriter writer, List<DottedChain> fullyQualifiedNames, boolean parallel, boolean insideInterface) {
|
||||
abc.instance_info.get(class_info).getClassHeaderStr(convertData.assetsDir, writer, abc, fullyQualifiedNames, false, false /*??*/);
|
||||
public GraphTextWriter toStringHeader(Set<String> usedDeobfuscations, int swfVersion, Trait parent, DottedChain packageName, ConvertData convertData, String path, ABC abc, boolean isStatic, ScriptExportMode exportMode, int scriptIndex, int classIndex, GraphTextWriter writer, List<DottedChain> fullyQualifiedNames, boolean parallel, boolean insideInterface) {
|
||||
abc.instance_info.get(class_info).getClassHeaderStr(usedDeobfuscations, convertData.assetsDir, writer, abc, fullyQualifiedNames, false, false /*??*/);
|
||||
return writer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void convertHeader(int swfVersion, Trait parent, ConvertData convertData, String path, ABC abc, boolean isStatic, ScriptExportMode exportMode, int scriptIndex, int classIndex, NulWriter writer, List<DottedChain> fullyQualifiedNames, boolean parallel) {
|
||||
public void convertHeader(Set<String> usedDeobfuscations, int swfVersion, Trait parent, ConvertData convertData, String path, ABC abc, boolean isStatic, ScriptExportMode exportMode, int scriptIndex, int classIndex, NulWriter writer, List<DottedChain> fullyQualifiedNames, boolean parallel) {
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -169,28 +156,9 @@ public class TraitClass extends Trait implements TraitWithSlot {
|
||||
public String toString(ABC abc, List<DottedChain> fullyQualifiedNames) {
|
||||
return "Class " + abc.constants.getMultiname(name_index).toString(abc.constants, fullyQualifiedNames) + " slot=" + slot_id + " class_info=" + class_info + " metadata=" + Helper.intArrToString(metadata);
|
||||
}
|
||||
|
||||
/**
|
||||
* To string.
|
||||
*
|
||||
* @param abcIndex ABC indexing
|
||||
* @param parent Parent trait
|
||||
* @param convertData Convert data
|
||||
* @param path Path
|
||||
* @param abc ABC
|
||||
* @param isStatic Is static
|
||||
* @param exportMode Export mode
|
||||
* @param scriptIndex Script index
|
||||
* @param classIndex Class index
|
||||
* @param writer Writer
|
||||
* @param fullyQualifiedNames Fully qualified names
|
||||
* @param parallel Parallel
|
||||
* @param insideInterface Inside interface
|
||||
* @return Writer
|
||||
* @throws InterruptedException On interrupt
|
||||
*/
|
||||
|
||||
@Override
|
||||
public GraphTextWriter toString(int swfVersion, AbcIndexing abcIndex, DottedChain packageName, Trait parent, ConvertData convertData, String path, ABC abc, boolean isStatic, ScriptExportMode exportMode, int scriptIndex, int classIndex, GraphTextWriter writer, List<DottedChain> fullyQualifiedNames, boolean parallel, boolean insideInterface) throws InterruptedException {
|
||||
public GraphTextWriter toString(Set<String> usedDeobfuscations, int swfVersion, AbcIndexing abcIndex, DottedChain packageName, Trait parent, ConvertData convertData, String path, ABC abc, boolean isStatic, ScriptExportMode exportMode, int scriptIndex, int classIndex, GraphTextWriter writer, List<DottedChain> fullyQualifiedNames, boolean parallel, boolean insideInterface) throws InterruptedException {
|
||||
|
||||
InstanceInfo instanceInfo = abc.instance_info.get(class_info);
|
||||
|
||||
@@ -201,16 +169,16 @@ public class TraitClass extends Trait implements TraitWithSlot {
|
||||
|
||||
Reference<Boolean> first = new Reference<>(true);
|
||||
|
||||
String instanceInfoName = instanceInfoMultiname.getName(abc, abc.constants, fullyQualifiedNames, false, true);
|
||||
String instanceInfoName = instanceInfoMultiname.getName(usedDeobfuscations, abc, abc.constants, fullyQualifiedNames, false, true);
|
||||
|
||||
getMetaData(this, convertData, abc, writer);
|
||||
getMetaData(usedDeobfuscations, this, convertData, abc, writer);
|
||||
|
||||
boolean allowEmbed = true;
|
||||
|
||||
if (convertData.exportEmbedFlaMode) {
|
||||
allowEmbed = false;
|
||||
if (abc.getSwf() != null) {
|
||||
CharacterTag ct = abc.getSwf().getCharacterByClass(instanceInfoMultiname.getNameWithNamespace(abc, abc.constants, false).toRawString());
|
||||
CharacterTag ct = abc.getSwf().getCharacterByClass(instanceInfoMultiname.getNameWithNamespace(usedDeobfuscations, abc, abc.constants, false).toRawString());
|
||||
if (ct == null) {
|
||||
allowEmbed = false;
|
||||
} else {
|
||||
@@ -237,7 +205,7 @@ public class TraitClass extends Trait implements TraitWithSlot {
|
||||
}
|
||||
|
||||
//class header
|
||||
instanceInfo.getClassHeaderStr(convertData.assetsDir, writer, abc, fullyQualifiedNames, false, allowEmbed);
|
||||
instanceInfo.getClassHeaderStr(usedDeobfuscations, convertData.assetsDir, writer, abc, fullyQualifiedNames, false, allowEmbed);
|
||||
writer.endTrait();
|
||||
writer.startClass(class_info);
|
||||
writer.startBlock();
|
||||
@@ -261,7 +229,7 @@ public class TraitClass extends Trait implements TraitWithSlot {
|
||||
}
|
||||
|
||||
//static variables & constants
|
||||
classInfo.static_traits.toString(swfVersion, packageName, first, abcIndex, new Class[]{TraitSlotConst.class}, this, convertData, path + "/" + instanceInfoName, abc, true, exportMode, false, scriptIndex, class_info, writer, fullyQualifiedNames, parallel, new ArrayList<>(), isInterface);
|
||||
classInfo.static_traits.toString(usedDeobfuscations, swfVersion, packageName, first, abcIndex, new Class[]{TraitSlotConst.class}, this, convertData, path + "/" + instanceInfoName, abc, true, exportMode, false, scriptIndex, class_info, writer, fullyQualifiedNames, parallel, new ArrayList<>(), isInterface);
|
||||
|
||||
//static initializer continue
|
||||
if (bodyIndex != -1) {
|
||||
@@ -276,7 +244,7 @@ public class TraitClass extends Trait implements TraitWithSlot {
|
||||
first.setVal(false);
|
||||
List<MethodBody> callStack = new ArrayList<>();
|
||||
callStack.add(abc.bodies.get(bodyIndex));
|
||||
abc.bodies.get(bodyIndex).toString(swfVersion, callStack, abcIndex, path + "/" + instanceInfoName + ".staticinitializer", exportMode, abc, this, writer, fullyQualifiedNames, new HashSet<>());
|
||||
abc.bodies.get(bodyIndex).toString(usedDeobfuscations, swfVersion, callStack, abcIndex, path + "/" + instanceInfoName + ".staticinitializer", exportMode, abc, this, writer, fullyQualifiedNames, new HashSet<>());
|
||||
//first.setVal(true);
|
||||
//writer.endBlock();
|
||||
} else {
|
||||
@@ -303,7 +271,7 @@ public class TraitClass extends Trait implements TraitWithSlot {
|
||||
}
|
||||
|
||||
//instance variables
|
||||
instanceInfo.instance_traits.toString(swfVersion, packageName, first, abcIndex, new Class[]{TraitSlotConst.class}, this, convertData, path + "/" + instanceInfoName, abc, false, exportMode, false, scriptIndex, class_info, writer, fullyQualifiedNames, parallel, ignoredInstanceVariableNames, isInterface);
|
||||
instanceInfo.instance_traits.toString(usedDeobfuscations, swfVersion, packageName, first, abcIndex, new Class[]{TraitSlotConst.class}, this, convertData, path + "/" + instanceInfoName, abc, false, exportMode, false, scriptIndex, class_info, writer, fullyQualifiedNames, parallel, ignoredInstanceVariableNames, isInterface);
|
||||
|
||||
//instance initializer - constructor
|
||||
if (!instanceInfo.isInterface()) {
|
||||
@@ -318,17 +286,17 @@ public class TraitClass extends Trait implements TraitWithSlot {
|
||||
writer.startMethod(instanceInfo.iinit_index, "iinit");
|
||||
writer.appendNoHilight(modifier);
|
||||
writer.appendNoHilight("function ");
|
||||
writer.appendNoHilight(m.getName(abc, abc.constants, null/*do not want full names here*/, false, true));
|
||||
writer.appendNoHilight(m.getName(usedDeobfuscations, abc, abc.constants, null/*do not want full names here*/, false, true));
|
||||
writer.appendNoHilight("(");
|
||||
bodyIndex = abc.findBodyIndex(instanceInfo.iinit_index);
|
||||
MethodBody body = bodyIndex == -1 ? null : abc.bodies.get(bodyIndex);
|
||||
abc.method_info.get(instanceInfo.iinit_index).getParamStr(writer, abc.constants, body, abc, fullyQualifiedNames);
|
||||
abc.method_info.get(instanceInfo.iinit_index).getParamStr(writer, abc.constants, body, abc, fullyQualifiedNames, usedDeobfuscations);
|
||||
writer.appendNoHilight(")").startBlock();
|
||||
if (exportMode != ScriptExportMode.AS_METHOD_STUBS) {
|
||||
if (body != null) {
|
||||
List<MethodBody> callStack = new ArrayList<>();
|
||||
callStack.add(body);
|
||||
body.toString(swfVersion, callStack, abcIndex, path + "/" + instanceInfoName + ".initializer", exportMode, abc, this, writer, fullyQualifiedNames, new HashSet<>());
|
||||
body.toString(usedDeobfuscations, swfVersion, callStack, abcIndex, path + "/" + instanceInfoName + ".initializer", exportMode, abc, this, writer, fullyQualifiedNames, new HashSet<>());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -338,7 +306,7 @@ public class TraitClass extends Trait implements TraitWithSlot {
|
||||
}
|
||||
|
||||
//static methods
|
||||
classInfo.static_traits.toString(swfVersion, packageName, first, abcIndex, new Class[]{TraitClass.class, TraitFunction.class, TraitMethodGetterSetter.class}, this, convertData, path + "/" + instanceInfoName, abc, true, exportMode, false, scriptIndex, class_info, writer, fullyQualifiedNames, parallel, new ArrayList<>(), isInterface);
|
||||
classInfo.static_traits.toString(usedDeobfuscations, swfVersion, packageName, first, abcIndex, new Class[]{TraitClass.class, TraitFunction.class, TraitMethodGetterSetter.class}, this, convertData, path + "/" + instanceInfoName, abc, true, exportMode, false, scriptIndex, class_info, writer, fullyQualifiedNames, parallel, new ArrayList<>(), isInterface);
|
||||
|
||||
List<String> ignoredInstanceTraitNames = new ArrayList<>();
|
||||
if (convertData.ignoreFrameScripts) {
|
||||
@@ -346,7 +314,7 @@ public class TraitClass extends Trait implements TraitWithSlot {
|
||||
}
|
||||
if (convertData.ignoreAccessibility) {
|
||||
for (Trait t : instanceInfo.instance_traits.traits) {
|
||||
String traitName = t.getName(abc).getName(abc, abc.constants, new ArrayList<>(), true, false);;
|
||||
String traitName = t.getName(abc).getName(usedDeobfuscations, abc, abc.constants, new ArrayList<>(), true, false);;
|
||||
if (traitName.startsWith("__setAcc_")
|
||||
|| traitName.startsWith("__setTab_")) {
|
||||
ignoredInstanceTraitNames.add(traitName);
|
||||
@@ -355,7 +323,7 @@ public class TraitClass extends Trait implements TraitWithSlot {
|
||||
}
|
||||
|
||||
//instance methods
|
||||
instanceInfo.instance_traits.toString(swfVersion, packageName, first, abcIndex, new Class[]{TraitClass.class, TraitFunction.class, TraitMethodGetterSetter.class}, this, convertData, path + "/" + instanceInfoName, abc, false, exportMode, false, scriptIndex, class_info, writer, fullyQualifiedNames, parallel, ignoredInstanceTraitNames, isInterface);
|
||||
instanceInfo.instance_traits.toString(usedDeobfuscations, swfVersion, packageName, first, abcIndex, new Class[]{TraitClass.class, TraitFunction.class, TraitMethodGetterSetter.class}, this, convertData, path + "/" + instanceInfoName, abc, false, exportMode, false, scriptIndex, class_info, writer, fullyQualifiedNames, parallel, ignoredInstanceTraitNames, isInterface);
|
||||
|
||||
if (first.getVal()) {
|
||||
writer.newLine();
|
||||
@@ -367,12 +335,12 @@ public class TraitClass extends Trait implements TraitWithSlot {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void convert(int swfVersion, AbcIndexing abcIndex, Trait parent, ConvertData convertData, String path, ABC abc, boolean isStatic, ScriptExportMode exportMode, int scriptIndex, int classIndex, NulWriter writer, List<DottedChain> fullyQualifiedNames, boolean parallel, ScopeStack scopeStack) throws InterruptedException {
|
||||
public void convert(Set<String> usedDeobfuscations, int swfVersion, AbcIndexing abcIndex, Trait parent, ConvertData convertData, String path, ABC abc, boolean isStatic, ScriptExportMode exportMode, int scriptIndex, int classIndex, NulWriter writer, List<DottedChain> fullyQualifiedNames, boolean parallel, ScopeStack scopeStack) throws InterruptedException {
|
||||
|
||||
fullyQualifiedNames = new ArrayList<>();
|
||||
|
||||
InstanceInfo instanceInfo = abc.instance_info.get(class_info);
|
||||
String instanceInfoName = instanceInfo.getName(abc.constants).getName(abc, abc.constants, fullyQualifiedNames, false, true);
|
||||
String instanceInfoName = instanceInfo.getName(abc.constants).getName(usedDeobfuscations, abc, abc.constants, fullyQualifiedNames, false, true);
|
||||
ClassInfo classInfo = abc.class_info.get(class_info);
|
||||
|
||||
AbcIndexing index = new AbcIndexing(abc.getSwf());
|
||||
@@ -382,7 +350,7 @@ public class TraitClass extends Trait implements TraitWithSlot {
|
||||
int nsIndex = abc.constants.getNamespaceId(Namespace.KIND_PACKAGE, DottedChain.TOPLEVEL, sIndex, false);
|
||||
if (nsIndex > -1) {
|
||||
Reference<Boolean> foundStatic = new Reference<>(null);
|
||||
convertData.thisHasDefaultToPrimitive = null == index.findProperty(new AbcIndexing.PropertyDef("toString", new TypeItem(instanceInfo.getName(abc.constants).getNameWithNamespace(abc, abc.constants, true)), abc, nsIndex), false, true, false, foundStatic);
|
||||
convertData.thisHasDefaultToPrimitive = null == index.findProperty(new AbcIndexing.PropertyDef("toString", new TypeItem(instanceInfo.getName(abc.constants).getNameWithNamespace(usedDeobfuscations, abc, abc.constants, true)), abc, nsIndex), false, true, false, foundStatic);
|
||||
} else {
|
||||
convertData.thisHasDefaultToPrimitive = true;
|
||||
}
|
||||
@@ -398,7 +366,7 @@ public class TraitClass extends Trait implements TraitWithSlot {
|
||||
callStack.add(abc.bodies.get(bodyIndex));
|
||||
|
||||
if (!abc.instance_info.get(class_info).isInterface()) {
|
||||
AbcIndexing.ClassIndex cls = abcIndex.findClass(AbcIndexing.multinameToType(abc.instance_info.get(class_info).name_index, abc, abc.constants), abc, scriptIndex);
|
||||
AbcIndexing.ClassIndex cls = abcIndex.findClass(AbcIndexing.multinameToType(new LinkedHashSet<>(), abc.instance_info.get(class_info).name_index, abc, abc.constants), abc, scriptIndex);
|
||||
List<AbcIndexing.ClassIndex> clsList = new ArrayList<>();
|
||||
cls = cls.parent;
|
||||
while (cls != null) {
|
||||
@@ -406,11 +374,11 @@ public class TraitClass extends Trait implements TraitWithSlot {
|
||||
cls = cls.parent;
|
||||
}
|
||||
for (AbcIndexing.ClassIndex cls2 : clsList) {
|
||||
newScopeStack.push(new ClassAVM2Item(cls2.abc.instance_info.get(cls2.index).getName(cls2.abc.constants).getNameWithNamespace(cls2.abc, cls2.abc.constants, true)));
|
||||
newScopeStack.push(new ClassAVM2Item(cls2.abc.instance_info.get(cls2.index).getName(cls2.abc.constants).getNameWithNamespace(usedDeobfuscations, cls2.abc, cls2.abc.constants, true)));
|
||||
}
|
||||
}
|
||||
|
||||
abc.bodies.get(bodyIndex).convert(swfVersion, callStack, abcIndex, convertData, path + "/" + instanceInfoName + ".staticinitializer", exportMode, true, classInfo.cinit_index, scriptIndex, class_info, abc, this, newScopeStack, GraphTextWriter.TRAIT_CLASS_INITIALIZER, writer, fullyQualifiedNames, classInfo.static_traits, true, new HashSet<>(), new ArrayList<>());
|
||||
abc.bodies.get(bodyIndex).convert(swfVersion, callStack, abcIndex, convertData, path + "/" + instanceInfoName + ".staticinitializer", exportMode, true, classInfo.cinit_index, scriptIndex, class_info, abc, this, newScopeStack, GraphTextWriter.TRAIT_CLASS_INITIALIZER, writer, fullyQualifiedNames, classInfo.static_traits, true, new HashSet<>(), new ArrayList<>(), usedDeobfuscations);
|
||||
|
||||
newScopeStack.push(new ClassAVM2Item(abc.instance_info.get(class_info).getName(abc.constants)));
|
||||
classInitializerIsEmpty = !writer.getMark();
|
||||
@@ -423,7 +391,7 @@ public class TraitClass extends Trait implements TraitWithSlot {
|
||||
MethodBody constructorBody = abc.bodies.get(bodyIndex);
|
||||
List<MethodBody> callStack = new ArrayList<>();
|
||||
callStack.add(constructorBody);
|
||||
constructorBody.convert(swfVersion, callStack, abcIndex, convertData, path + "/" + instanceInfoName + ".initializer", exportMode, false, instanceInfo.iinit_index, scriptIndex, class_info, abc, this, new ScopeStack(), GraphTextWriter.TRAIT_INSTANCE_INITIALIZER, writer, fullyQualifiedNames, instanceInfo.instance_traits, true, new HashSet<>(), new ArrayList<>());
|
||||
constructorBody.convert(swfVersion, callStack, abcIndex, convertData, path + "/" + instanceInfoName + ".initializer", exportMode, false, instanceInfo.iinit_index, scriptIndex, class_info, abc, this, new ScopeStack(), GraphTextWriter.TRAIT_INSTANCE_INITIALIZER, writer, fullyQualifiedNames, instanceInfo.instance_traits, true, new HashSet<>(), new ArrayList<>(), usedDeobfuscations);
|
||||
|
||||
if (convertData.ignoreFrameScripts) {
|
||||
//find all addFrameScript(xx,this.method) in constructor
|
||||
@@ -453,14 +421,14 @@ public class TraitClass extends Trait implements TraitWithSlot {
|
||||
if (callProp.arguments.get(i) instanceof IntegerValueAVM2Item) {
|
||||
if (callProp.arguments.get(i + 1) instanceof GetLexAVM2Item) {
|
||||
GetLexAVM2Item lex = (GetLexAVM2Item) callProp.arguments.get(i + 1);
|
||||
frameTraitNames.add(lex.propertyName.getName(abc, abc.constants, new ArrayList<>(), false, true));
|
||||
frameTraitNames.add(lex.propertyName.getName(usedDeobfuscations, abc, abc.constants, new ArrayList<>(), false, true));
|
||||
} else if (callProp.arguments.get(i + 1) instanceof GetPropertyAVM2Item) {
|
||||
GetPropertyAVM2Item getProp = (GetPropertyAVM2Item) callProp.arguments.get(i + 1);
|
||||
if (getProp.object instanceof ThisAVM2Item) {
|
||||
if (getProp.propertyName instanceof FullMultinameAVM2Item) {
|
||||
FullMultinameAVM2Item framePropName = (FullMultinameAVM2Item) getProp.propertyName;
|
||||
int multinameIndex = framePropName.multinameIndex;
|
||||
frameTraitNames.add(abc.constants.getMultiname(multinameIndex).getName(abc, abc.constants, new ArrayList<>(), false, true));
|
||||
frameTraitNames.add(abc.constants.getMultiname(multinameIndex).getName(usedDeobfuscations, abc, abc.constants, new ArrayList<>(), false, true));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -574,9 +542,9 @@ public class TraitClass extends Trait implements TraitWithSlot {
|
||||
}
|
||||
|
||||
//static variables,constants & methods
|
||||
classInfo.static_traits.convert(swfVersion, abcIndex, this, convertData, path + "/" + instanceInfoName, abc, true, exportMode, false, scriptIndex, class_info, writer, fullyQualifiedNames, parallel, newScopeStack);
|
||||
classInfo.static_traits.convert(usedDeobfuscations, swfVersion, abcIndex, this, convertData, path + "/" + instanceInfoName, abc, true, exportMode, false, scriptIndex, class_info, writer, fullyQualifiedNames, parallel, newScopeStack);
|
||||
|
||||
instanceInfo.instance_traits.convert(swfVersion, abcIndex, this, convertData, path + "/" + instanceInfoName, abc, false, exportMode, false, scriptIndex, class_info, writer, fullyQualifiedNames, parallel, newScopeStack);
|
||||
instanceInfo.instance_traits.convert(usedDeobfuscations, swfVersion, abcIndex, this, convertData, path + "/" + instanceInfoName, abc, false, exportMode, false, scriptIndex, class_info, writer, fullyQualifiedNames, parallel, newScopeStack);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+20
-34
@@ -34,6 +34,7 @@ import com.jpexs.helpers.Reference;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Function trait in ABC file.
|
||||
@@ -77,23 +78,23 @@ public class TraitFunction extends Trait implements TraitWithSlot {
|
||||
}
|
||||
|
||||
@Override
|
||||
public GraphTextWriter toStringHeader(int swfVersion, Trait parent, DottedChain packageName, ConvertData convertData, String path, ABC abc, boolean isStatic, ScriptExportMode exportMode, int scriptIndex, int classIndex, GraphTextWriter writer, List<DottedChain> fullyQualifiedNames, boolean parallel, boolean insideInterface) {
|
||||
public GraphTextWriter toStringHeader(Set<String> usedDeobfuscations, int swfVersion, Trait parent, DottedChain packageName, ConvertData convertData, String path, ABC abc, boolean isStatic, ScriptExportMode exportMode, int scriptIndex, int classIndex, GraphTextWriter writer, List<DottedChain> fullyQualifiedNames, boolean parallel, boolean insideInterface) {
|
||||
MethodBody body = abc.findBody(method_info);
|
||||
if (body == null) {
|
||||
writer.appendNoHilight("native ");
|
||||
}
|
||||
getModifiers(abc, isStatic, insideInterface, writer, classIndex);
|
||||
getModifiers(usedDeobfuscations, abc, isStatic, insideInterface, writer, classIndex);
|
||||
writer.hilightSpecial("function ", HighlightSpecialType.TRAIT_TYPE);
|
||||
writer.hilightSpecial(abc.constants.getMultiname(name_index).getName(abc, abc.constants, fullyQualifiedNames, false, true), HighlightSpecialType.TRAIT_NAME);
|
||||
writer.hilightSpecial(abc.constants.getMultiname(name_index).getName(usedDeobfuscations, abc, abc.constants, fullyQualifiedNames, false, true), HighlightSpecialType.TRAIT_NAME);
|
||||
writer.appendNoHilight("(");
|
||||
abc.method_info.get(method_info).getParamStr(writer, abc.constants, body, abc, fullyQualifiedNames);
|
||||
abc.method_info.get(method_info).getParamStr(writer, abc.constants, body, abc, fullyQualifiedNames, usedDeobfuscations);
|
||||
writer.appendNoHilight(") : ");
|
||||
abc.method_info.get(method_info).getReturnTypeStr(writer, abc, abc.constants, fullyQualifiedNames);
|
||||
abc.method_info.get(method_info).getReturnTypeStr(writer, abc, abc.constants, fullyQualifiedNames, usedDeobfuscations);
|
||||
return writer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void convertHeader(int swfVersion, Trait parent, ConvertData convertData, String path, ABC abc, boolean isStatic, ScriptExportMode exportMode, int scriptIndex, int classIndex, NulWriter writer, List<DottedChain> fullyQualifiedNames, boolean parallel) {
|
||||
public void convertHeader(Set<String> usedDeobfuscations, int swfVersion, Trait parent, ConvertData convertData, String path, ABC abc, boolean isStatic, ScriptExportMode exportMode, int scriptIndex, int classIndex, NulWriter writer, List<DottedChain> fullyQualifiedNames, boolean parallel) {
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -109,10 +110,10 @@ public class TraitFunction extends Trait implements TraitWithSlot {
|
||||
}
|
||||
|
||||
@Override
|
||||
public GraphTextWriter toString(int swfVersion, AbcIndexing abcIndex, DottedChain packageName, Trait parent, ConvertData convertData, String path, ABC abc, boolean isStatic, ScriptExportMode exportMode, int scriptIndex, int classIndex, GraphTextWriter writer, List<DottedChain> fullyQualifiedNames, boolean parallel, boolean insideInterface) throws InterruptedException {
|
||||
getMetaData(this, convertData, abc, writer);
|
||||
writer.startMethod(method_info, getName(abc).getName(abc, abc.constants, new ArrayList<>(), true, false));
|
||||
toStringHeader(swfVersion, parent, packageName, convertData, path, abc, isStatic, exportMode, scriptIndex, classIndex, writer, fullyQualifiedNames, parallel, insideInterface);
|
||||
public GraphTextWriter toString(Set<String> usedDeobfuscations, int swfVersion, AbcIndexing abcIndex, DottedChain packageName, Trait parent, ConvertData convertData, String path, ABC abc, boolean isStatic, ScriptExportMode exportMode, int scriptIndex, int classIndex, GraphTextWriter writer, List<DottedChain> fullyQualifiedNames, boolean parallel, boolean insideInterface) throws InterruptedException {
|
||||
getMetaData(usedDeobfuscations, this, convertData, abc, writer);
|
||||
writer.startMethod(method_info, getName(abc).getName(usedDeobfuscations, abc, abc.constants, new ArrayList<>(), true, false));
|
||||
toStringHeader(usedDeobfuscations, swfVersion, parent, packageName, convertData, path, abc, isStatic, exportMode, scriptIndex, classIndex, writer, fullyQualifiedNames, parallel, insideInterface);
|
||||
|
||||
writer.startBlock();
|
||||
int bodyIndex = abc.findBodyIndex(method_info);
|
||||
@@ -120,7 +121,7 @@ public class TraitFunction extends Trait implements TraitWithSlot {
|
||||
//writeUses(scriptIndex, classIndex, isStatic, abc, writer);
|
||||
List<MethodBody> callStack = new ArrayList<>();
|
||||
callStack.add(abc.bodies.get(bodyIndex));
|
||||
abc.bodies.get(bodyIndex).toString(swfVersion, callStack, abcIndex, path + "." + abc.constants.getMultiname(name_index).getName(abc, abc.constants, fullyQualifiedNames, false, true), exportMode, abc, this, writer, fullyQualifiedNames, new HashSet<>());
|
||||
abc.bodies.get(bodyIndex).toString(usedDeobfuscations, swfVersion, callStack, abcIndex, path + "." + abc.constants.getMultiname(name_index).getName(usedDeobfuscations, abc, abc.constants, fullyQualifiedNames, false, true), exportMode, abc, this, writer, fullyQualifiedNames, new HashSet<>());
|
||||
}
|
||||
writer.endBlock();
|
||||
|
||||
@@ -131,15 +132,15 @@ public class TraitFunction extends Trait implements TraitWithSlot {
|
||||
|
||||
|
||||
@Override
|
||||
public void convert(int swfVersion, AbcIndexing abcIndex, Trait parent, ConvertData convertData, String path, ABC abc, boolean isStatic, ScriptExportMode exportMode, int scriptIndex, int classIndex, NulWriter writer, List<DottedChain> fullyQualifiedNames, boolean parallel, ScopeStack scopeStack) throws InterruptedException {
|
||||
public void convert(Set<String> usedDeobfuscations, int swfVersion, AbcIndexing abcIndex, Trait parent, ConvertData convertData, String path, ABC abc, boolean isStatic, ScriptExportMode exportMode, int scriptIndex, int classIndex, NulWriter writer, List<DottedChain> fullyQualifiedNames, boolean parallel, ScopeStack scopeStack) throws InterruptedException {
|
||||
fullyQualifiedNames = new ArrayList<>();
|
||||
writer.startMethod(method_info, getName(abc).getName(abc, abc.constants, new ArrayList<>(), true, false));
|
||||
convertHeader(swfVersion, parent, convertData, path, abc, isStatic, exportMode, scriptIndex, classIndex, writer, fullyQualifiedNames, parallel);
|
||||
writer.startMethod(method_info, getName(abc).getName(usedDeobfuscations, abc, abc.constants, new ArrayList<>(), true, false));
|
||||
convertHeader(usedDeobfuscations, swfVersion, parent, convertData, path, abc, isStatic, exportMode, scriptIndex, classIndex, writer, fullyQualifiedNames, parallel);
|
||||
int bodyIndex = abc.findBodyIndex(method_info);
|
||||
if (bodyIndex != -1) {
|
||||
List<MethodBody> callStack = new ArrayList<>();
|
||||
callStack.add(abc.bodies.get(bodyIndex));
|
||||
abc.bodies.get(bodyIndex).convert(swfVersion, callStack, abcIndex, convertData, path + "." + abc.constants.getMultiname(name_index).getName(abc, abc.constants, fullyQualifiedNames, false, true), exportMode, isStatic, method_info, scriptIndex, classIndex, abc, this, scopeStack, 0, writer, fullyQualifiedNames, null, true, new HashSet<>(), new ArrayList<>());
|
||||
abc.bodies.get(bodyIndex).convert(swfVersion, callStack, abcIndex, convertData, path + "." + abc.constants.getMultiname(name_index).getName(usedDeobfuscations, abc, abc.constants, fullyQualifiedNames, false, true), exportMode, isStatic, method_info, scriptIndex, classIndex, abc, this, scopeStack, 0, writer, fullyQualifiedNames, null, true, new HashSet<>(), new ArrayList<>(), usedDeobfuscations);
|
||||
}
|
||||
writer.endMethod();
|
||||
}
|
||||
@@ -174,29 +175,14 @@ public class TraitFunction extends Trait implements TraitWithSlot {
|
||||
TraitFunction ret = (TraitFunction) super.clone();
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets dependencies.
|
||||
*
|
||||
* @param abcIndex ABC indexing
|
||||
* @param scriptIndex Script index
|
||||
* @param classIndex Class index
|
||||
* @param isStatic Is static
|
||||
* @param customNamespace Custom namespace
|
||||
* @param abc ABC
|
||||
* @param dependencies Dependencies
|
||||
* @param ignorePackage Ignore package
|
||||
* @param fullyQualifiedNames Fully qualified names
|
||||
* @param uses Uses
|
||||
* @throws InterruptedException On interrupt
|
||||
*/
|
||||
|
||||
@Override
|
||||
public void getDependencies(AbcIndexing abcIndex, int scriptIndex, int classIndex, boolean isStatic, String customNamespace, ABC abc, List<Dependency> dependencies, DottedChain ignorePackage, List<DottedChain> fullyQualifiedNames, List<String> uses, Reference<Integer> numberContextRef) throws InterruptedException {
|
||||
public void getDependencies(Set<String> usedDeobfuscations, AbcIndexing abcIndex, int scriptIndex, int classIndex, boolean isStatic, String customNamespace, ABC abc, List<Dependency> dependencies, DottedChain ignorePackage, List<DottedChain> fullyQualifiedNames, List<String> uses, Reference<Integer> numberContextRef) throws InterruptedException {
|
||||
if (ignorePackage == null) {
|
||||
ignorePackage = getPackage(abc);
|
||||
}
|
||||
super.getDependencies(abcIndex, scriptIndex, classIndex, false, customNamespace, abc, dependencies, ignorePackage, fullyQualifiedNames, uses, numberContextRef);
|
||||
DependencyParser.parseDependenciesFromMethodInfo(abcIndex, this, scriptIndex, classIndex, false, customNamespace, abc, method_info, dependencies, ignorePackage, fullyQualifiedNames, new ArrayList<>(), uses, numberContextRef);
|
||||
super.getDependencies(usedDeobfuscations, abcIndex, scriptIndex, classIndex, false, customNamespace, abc, dependencies, ignorePackage, fullyQualifiedNames, uses, numberContextRef);
|
||||
DependencyParser.parseDependenciesFromMethodInfo(usedDeobfuscations, abcIndex, this, scriptIndex, classIndex, false, customNamespace, abc, method_info, dependencies, ignorePackage, fullyQualifiedNames, new ArrayList<>(), uses, numberContextRef);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+25
-38
@@ -40,7 +40,9 @@ import com.jpexs.helpers.Helper;
|
||||
import com.jpexs.helpers.Reference;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Method, getter or setter trait in ABC file.
|
||||
@@ -74,30 +76,15 @@ public class TraitMethodGetterSetter extends Trait {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void convertHeader(int swfVersion, Trait parent, ConvertData convertData, String path, ABC abc, boolean isStatic, ScriptExportMode exportMode, int scriptIndex, int classIndex, NulWriter writer, List<DottedChain> fullyQualifiedNames, boolean parallel) {
|
||||
public void convertHeader(Set<String> usedDeobfuscations, int swfVersion, Trait parent, ConvertData convertData, String path, ABC abc, boolean isStatic, ScriptExportMode exportMode, int scriptIndex, int classIndex, NulWriter writer, List<DottedChain> fullyQualifiedNames, boolean parallel) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets dependencies.
|
||||
*
|
||||
* @param abcIndex ABC indexing
|
||||
* @param scriptIndex Script index
|
||||
* @param classIndex Class index
|
||||
* @param isStatic Is static
|
||||
* @param customNamespace Custom namespace
|
||||
* @param abc ABC
|
||||
* @param dependencies Dependencies
|
||||
* @param ignorePackage Ignore package
|
||||
* @param fullyQualifiedNames Fully qualified names
|
||||
* @param uses Uses
|
||||
* @throws InterruptedException On interrupt
|
||||
*/
|
||||
|
||||
@Override
|
||||
public void getDependencies(AbcIndexing abcIndex, int scriptIndex, int classIndex, boolean isStatic, String customNamespace, ABC abc, List<Dependency> dependencies, DottedChain ignorePackage, List<DottedChain> fullyQualifiedNames, List<String> uses, Reference<Integer> numberContextRef) throws InterruptedException {
|
||||
public void getDependencies(Set<String> usedDeobfuscations, AbcIndexing abcIndex, int scriptIndex, int classIndex, boolean isStatic, String customNamespace, ABC abc, List<Dependency> dependencies, DottedChain ignorePackage, List<DottedChain> fullyQualifiedNames, List<String> uses, Reference<Integer> numberContextRef) throws InterruptedException {
|
||||
if (ignorePackage == null) {
|
||||
ignorePackage = getPackage(abc);
|
||||
}
|
||||
super.getDependencies(abcIndex, scriptIndex, classIndex, isStatic, customNamespace, abc, dependencies, ignorePackage, fullyQualifiedNames, uses, numberContextRef);
|
||||
super.getDependencies(usedDeobfuscations, abcIndex, scriptIndex, classIndex, isStatic, customNamespace, abc, dependencies, ignorePackage, fullyQualifiedNames, uses, numberContextRef);
|
||||
|
||||
if (customNamespace == null) {
|
||||
Multiname m = getName(abc);
|
||||
@@ -106,11 +93,11 @@ public class TraitMethodGetterSetter extends Trait {
|
||||
customNamespace = m.getSimpleNamespaceName(abc.constants).toRawString();
|
||||
}
|
||||
}
|
||||
DependencyParser.parseDependenciesFromMethodInfo(abcIndex, this, scriptIndex, classIndex, isStatic, customNamespace, abc, method_info, dependencies, ignorePackage, fullyQualifiedNames, new ArrayList<>(), uses, numberContextRef);
|
||||
DependencyParser.parseDependenciesFromMethodInfo(usedDeobfuscations, abcIndex, this, scriptIndex, classIndex, isStatic, customNamespace, abc, method_info, dependencies, ignorePackage, fullyQualifiedNames, new ArrayList<>(), uses, numberContextRef);
|
||||
}
|
||||
|
||||
@Override
|
||||
public GraphTextWriter toStringHeader(int swfVersion, Trait parent, DottedChain packageName, ConvertData convertData, String path, ABC abc, boolean isStatic, ScriptExportMode exportMode, int scriptIndex, int classIndex, GraphTextWriter writer, List<DottedChain> fullyQualifiedNames, boolean parallel, boolean insideInterface) {
|
||||
public GraphTextWriter toStringHeader(Set<String> usedDeobfuscations, int swfVersion, Trait parent, DottedChain packageName, ConvertData convertData, String path, ABC abc, boolean isStatic, ScriptExportMode exportMode, int scriptIndex, int classIndex, GraphTextWriter writer, List<DottedChain> fullyQualifiedNames, boolean parallel, boolean insideInterface) {
|
||||
String addKind = "";
|
||||
if (kindType == TRAIT_GETTER) {
|
||||
addKind = "get ";
|
||||
@@ -120,34 +107,34 @@ public class TraitMethodGetterSetter extends Trait {
|
||||
}
|
||||
MethodBody body = abc.findBody(method_info);
|
||||
|
||||
getModifiers(abc, isStatic, insideInterface, writer, classIndex);
|
||||
getModifiers(usedDeobfuscations, abc, isStatic, insideInterface, writer, classIndex);
|
||||
|
||||
if (abc.method_info.get(method_info).flagNative()) {
|
||||
writer.appendNoHilight("native ");
|
||||
}
|
||||
|
||||
writer.hilightSpecial("function " + addKind, HighlightSpecialType.TRAIT_TYPE);
|
||||
writer.hilightSpecial(getName(abc).getName(abc, abc.constants, new ArrayList<>(), false, true), HighlightSpecialType.TRAIT_NAME);
|
||||
writer.hilightSpecial(getName(abc).getName(usedDeobfuscations, abc, abc.constants, new ArrayList<>(), false, true), HighlightSpecialType.TRAIT_NAME);
|
||||
writer.appendNoHilight("(");
|
||||
abc.method_info.get(method_info).getParamStr(writer, abc.constants, body, abc, fullyQualifiedNames);
|
||||
abc.method_info.get(method_info).getParamStr(writer, abc.constants, body, abc, fullyQualifiedNames, usedDeobfuscations);
|
||||
writer.appendNoHilight(") : ");
|
||||
abc.method_info.get(method_info).getReturnTypeStr(writer, abc, abc.constants, fullyQualifiedNames);
|
||||
abc.method_info.get(method_info).getReturnTypeStr(writer, abc, abc.constants, fullyQualifiedNames, usedDeobfuscations);
|
||||
return writer;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void convert(int swfVersion, AbcIndexing abcIndex, Trait parent, ConvertData convertData, String path, ABC abc, boolean isStatic, ScriptExportMode exportMode, int scriptIndex, int classIndex, NulWriter writer, List<DottedChain> fullyQualifiedNames, boolean parallel, ScopeStack scopeStack) throws InterruptedException {
|
||||
public void convert(Set<String> usedDeobfuscations, int swfVersion, AbcIndexing abcIndex, Trait parent, ConvertData convertData, String path, ABC abc, boolean isStatic, ScriptExportMode exportMode, int scriptIndex, int classIndex, NulWriter writer, List<DottedChain> fullyQualifiedNames, boolean parallel, ScopeStack scopeStack) throws InterruptedException {
|
||||
int nsKind = getName(abc).getSimpleNamespaceKind(abc.constants);
|
||||
writer.startMethod(method_info, getName(abc).getName(abc, abc.constants, new ArrayList<>(), true, false));
|
||||
path = path + "." + getName(abc).getName(abc, abc.constants, fullyQualifiedNames, false, true);
|
||||
convertHeader(swfVersion, parent, convertData, path, abc, isStatic, exportMode, scriptIndex, classIndex, writer, fullyQualifiedNames, parallel);
|
||||
writer.startMethod(method_info, getName(abc).getName(usedDeobfuscations, abc, abc.constants, new ArrayList<>(), true, false));
|
||||
path = path + "." + getName(abc).getName(usedDeobfuscations, abc, abc.constants, fullyQualifiedNames, false, true);
|
||||
convertHeader(usedDeobfuscations, swfVersion, parent, convertData, path, abc, isStatic, exportMode, scriptIndex, classIndex, writer, fullyQualifiedNames, parallel);
|
||||
int bodyIndex = abc.findBodyIndex(method_info);
|
||||
if (exportMode != ScriptExportMode.AS_METHOD_STUBS) {
|
||||
if (!(classIndex != -1 && abc.instance_info.get(classIndex).isInterface() || bodyIndex == -1)) {
|
||||
if (bodyIndex != -1) {
|
||||
List<MethodBody> callStack = new ArrayList<>();
|
||||
callStack.add(abc.bodies.get(bodyIndex));
|
||||
abc.bodies.get(bodyIndex).convert(swfVersion, callStack, abcIndex, convertData, path, exportMode, isStatic, method_info, scriptIndex, classIndex, abc, this, scopeStack, 0, writer, fullyQualifiedNames, null, true, new HashSet<>(), new ArrayList<>());
|
||||
abc.bodies.get(bodyIndex).convert(swfVersion, callStack, abcIndex, convertData, path, exportMode, isStatic, method_info, scriptIndex, classIndex, abc, this, scopeStack, 0, writer, fullyQualifiedNames, null, true, new HashSet<>(), new ArrayList<>(), usedDeobfuscations);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -167,11 +154,11 @@ public class TraitMethodGetterSetter extends Trait {
|
||||
}
|
||||
|
||||
@Override
|
||||
public GraphTextWriter toString(int swfVersion, AbcIndexing abcIndex, DottedChain packageName, Trait parent, ConvertData convertData, String path, ABC abc, boolean isStatic, ScriptExportMode exportMode, int scriptIndex, int classIndex, GraphTextWriter writer, List<DottedChain> fullyQualifiedNames, boolean parallel, boolean insideInterface) throws InterruptedException {
|
||||
getMetaData(this, convertData, abc, writer);
|
||||
writer.startMethod(method_info, getName(abc).getName(abc, abc.constants, new ArrayList<>(), true, false));
|
||||
path = path + "." + getName(abc).getName(abc, abc.constants, fullyQualifiedNames, false, true);
|
||||
toStringHeader(swfVersion, parent, packageName, convertData, path, abc, isStatic, exportMode, scriptIndex, classIndex, writer, fullyQualifiedNames, parallel, insideInterface);
|
||||
public GraphTextWriter toString(Set<String> usedDeobfuscations, int swfVersion, AbcIndexing abcIndex, DottedChain packageName, Trait parent, ConvertData convertData, String path, ABC abc, boolean isStatic, ScriptExportMode exportMode, int scriptIndex, int classIndex, GraphTextWriter writer, List<DottedChain> fullyQualifiedNames, boolean parallel, boolean insideInterface) throws InterruptedException {
|
||||
getMetaData(usedDeobfuscations, this, convertData, abc, writer);
|
||||
writer.startMethod(method_info, getName(abc).getName(usedDeobfuscations, abc, abc.constants, new ArrayList<>(), true, false));
|
||||
path = path + "." + getName(abc).getName(usedDeobfuscations, abc, abc.constants, fullyQualifiedNames, false, true);
|
||||
toStringHeader(usedDeobfuscations, swfVersion, parent, packageName, convertData, path, abc, isStatic, exportMode, scriptIndex, classIndex, writer, fullyQualifiedNames, parallel, insideInterface);
|
||||
int bodyIndex = abc.findBodyIndex(method_info);
|
||||
if (classIndex != -1 && abc.instance_info.get(classIndex).isInterface() || bodyIndex == -1) {
|
||||
writer.appendNoHilight(";");
|
||||
@@ -185,7 +172,7 @@ public class TraitMethodGetterSetter extends Trait {
|
||||
//writeUses(scriptIndex, classIndex, isStatic, abc, writer);
|
||||
List<MethodBody> callStack = new ArrayList<>();
|
||||
callStack.add(abc.bodies.get(bodyIndex));
|
||||
abc.bodies.get(bodyIndex).toString(swfVersion, callStack, abcIndex, path, exportMode, abc, this, writer, fullyQualifiedNames, new HashSet<>());
|
||||
abc.bodies.get(bodyIndex).toString(usedDeobfuscations, swfVersion, callStack, abcIndex, path, exportMode, abc, this, writer, fullyQualifiedNames, new HashSet<>());
|
||||
}
|
||||
} else {
|
||||
String retTypeRaw = abc.method_info.get(method_info).getReturnTypeRaw(abc, abc.constants, fullyQualifiedNames);
|
||||
@@ -256,10 +243,10 @@ public class TraitMethodGetterSetter extends Trait {
|
||||
@Override
|
||||
public boolean isVisible(boolean isStatic, ABC abc) {
|
||||
if (Configuration.handleSkinPartsAutomatically.get()) {
|
||||
if ("skinParts".equals(getName(abc).getName(abc, abc.constants, new ArrayList<>(), true, true))) {
|
||||
if ("skinParts".equals(getName(abc).getName(new LinkedHashSet<>(), abc, abc.constants, new ArrayList<>(), true, true))) {
|
||||
if (kindType == TRAIT_GETTER) {
|
||||
MethodInfo mi = abc.method_info.get(method_info);
|
||||
if (mi.param_types.length == 0 && "Object".equals(abc.constants.getMultiname(mi.ret_type).getNameWithNamespace(abc, abc.constants, true).toRawString())) {
|
||||
if (mi.param_types.length == 0 && "Object".equals(abc.constants.getMultiname(mi.ret_type).getNameWithNamespace(new LinkedHashSet<>(), abc, abc.constants, true).toRawString())) {
|
||||
if (abc.constants.getNamespace(abc.constants.getMultiname(name_index).namespace_index).kind == Namespace.KIND_PROTECTED) {
|
||||
return false;
|
||||
}
|
||||
|
||||
+27
-37
@@ -44,7 +44,9 @@ import com.jpexs.helpers.Reference;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Slot or const trait in ABC file.
|
||||
@@ -99,15 +101,16 @@ public class TraitSlotConst extends Trait implements TraitWithSlot {
|
||||
/**
|
||||
* Gets type as string.
|
||||
*
|
||||
* @param usedDeobfuscations Used deobfuscations
|
||||
* @param abc ABC
|
||||
* @param constants Constant pool
|
||||
* @param fullyQualifiedNames Fully qualified names
|
||||
* @return Type as string
|
||||
*/
|
||||
public String getType(ABC abc, AVM2ConstantPool constants, List<DottedChain> fullyQualifiedNames) {
|
||||
public String getType(Set<String> usedDeobfuscations, ABC abc, AVM2ConstantPool constants, List<DottedChain> fullyQualifiedNames) {
|
||||
String typeStr = "*";
|
||||
if (type_index > 0) {
|
||||
typeStr = constants.getMultiname(type_index).getName(abc, constants, fullyQualifiedNames, false, true);
|
||||
typeStr = constants.getMultiname(type_index).getName(usedDeobfuscations, abc, constants, fullyQualifiedNames, false, true);
|
||||
}
|
||||
return typeStr;
|
||||
}
|
||||
@@ -118,10 +121,11 @@ public class TraitSlotConst extends Trait implements TraitWithSlot {
|
||||
* @param writer Writer
|
||||
* @param abc ABC
|
||||
* @param fullyQualifiedNames Fully qualified names
|
||||
* @param usedDeobfuscations Used deobfuscations
|
||||
* @return Writer
|
||||
*/
|
||||
public GraphTextWriter getNameStr(GraphTextWriter writer, ABC abc, List<DottedChain> fullyQualifiedNames) {
|
||||
String typeStr = getType(abc, abc.constants, fullyQualifiedNames);
|
||||
public GraphTextWriter getNameStr(GraphTextWriter writer, ABC abc, List<DottedChain> fullyQualifiedNames, Set<String> usedDeobfuscations) {
|
||||
String typeStr = getType(usedDeobfuscations, abc, abc.constants, fullyQualifiedNames);
|
||||
ValueKind val = null;
|
||||
if (value_kind != 0) {
|
||||
val = new ValueKind(value_index, value_kind);
|
||||
@@ -138,7 +142,7 @@ public class TraitSlotConst extends Trait implements TraitWithSlot {
|
||||
typeStr = "";
|
||||
}
|
||||
writer.hilightSpecial(slotconst + " ", HighlightSpecialType.TRAIT_TYPE);
|
||||
writer.hilightSpecial(getName(abc).getName(abc, abc.constants, new ArrayList<>(), false, true), HighlightSpecialType.TRAIT_NAME);
|
||||
writer.hilightSpecial(getName(abc).getName(usedDeobfuscations, abc, abc.constants, new ArrayList<>(), false, true), HighlightSpecialType.TRAIT_NAME);
|
||||
writer.hilightSpecial(typeStr, HighlightSpecialType.TRAIT_TYPE_NAME);
|
||||
return writer;
|
||||
}
|
||||
@@ -165,6 +169,7 @@ public class TraitSlotConst extends Trait implements TraitWithSlot {
|
||||
/**
|
||||
* Gets value as string.
|
||||
*
|
||||
* @param usedDeobfuscations Used deobfuscations
|
||||
* @param swfVersion SWF version
|
||||
* @param abcIndex ABC indexing
|
||||
* @param exportMode Export mode
|
||||
@@ -174,7 +179,7 @@ public class TraitSlotConst extends Trait implements TraitWithSlot {
|
||||
* @param fullyQualifiedNames Fully qualified names
|
||||
* @throws InterruptedException On interrupt
|
||||
*/
|
||||
public void getValueStr(int swfVersion, AbcIndexing abcIndex, ScriptExportMode exportMode, ConvertData convertData, GraphTextWriter writer, ABC abc, List<DottedChain> fullyQualifiedNames) throws InterruptedException {
|
||||
public void getValueStr(Set<String> usedDeobfuscations, int swfVersion, AbcIndexing abcIndex, ScriptExportMode exportMode, ConvertData convertData, GraphTextWriter writer, ABC abc, List<DottedChain> fullyQualifiedNames) throws InterruptedException {
|
||||
if (convertData.assignedValues.containsKey(this)) {
|
||||
|
||||
AssignedValue assignment = convertData.assignedValues.get(this);
|
||||
@@ -190,7 +195,7 @@ public class TraitSlotConst extends Trait implements TraitWithSlot {
|
||||
if (exportMode != ScriptExportMode.AS_METHOD_STUBS) {
|
||||
List<MethodBody> callStack = new ArrayList<>();
|
||||
callStack.add(abc.bodies.get(abc.findBodyIndex(assignment.method)));
|
||||
assignment.value.toString(writer, LocalData.create(callStack, abcIndex, abc, new HashMap<>(), fullyQualifiedNames, new HashSet<>(), exportMode, swfVersion));
|
||||
assignment.value.toString(writer, LocalData.create(callStack, abcIndex, abc, new HashMap<>(), fullyQualifiedNames, new HashSet<>(), exportMode, swfVersion, usedDeobfuscations));
|
||||
}
|
||||
writer.endMethod();
|
||||
writer.endTrait();
|
||||
@@ -233,8 +238,8 @@ public class TraitSlotConst extends Trait implements TraitWithSlot {
|
||||
}
|
||||
|
||||
@Override
|
||||
public GraphTextWriter toString(int swfVersion, AbcIndexing abcIndex, DottedChain packageName, Trait parent, ConvertData convertData, String path, ABC abc, boolean isStatic, ScriptExportMode exportMode, int scriptIndex, int classIndex, GraphTextWriter writer, List<DottedChain> fullyQualifiedNames, boolean parallel, boolean insideInterface) throws InterruptedException {
|
||||
getMetaData(this, convertData, abc, writer);
|
||||
public GraphTextWriter toString(Set<String> usedDeobfuscations, int swfVersion, AbcIndexing abcIndex, DottedChain packageName, Trait parent, ConvertData convertData, String path, ABC abc, boolean isStatic, ScriptExportMode exportMode, int scriptIndex, int classIndex, GraphTextWriter writer, List<DottedChain> fullyQualifiedNames, boolean parallel, boolean insideInterface) throws InterruptedException {
|
||||
getMetaData(usedDeobfuscations, this, convertData, abc, writer);
|
||||
Multiname n = getName(abc);
|
||||
boolean showModifier = true;
|
||||
if ((classIndex == -1) && (n != null)) {
|
||||
@@ -246,7 +251,7 @@ public class TraitSlotConst extends Trait implements TraitWithSlot {
|
||||
}
|
||||
}
|
||||
if (showModifier) {
|
||||
getModifiers(abc, isStatic, insideInterface, writer, classIndex);
|
||||
getModifiers(usedDeobfuscations, abc, isStatic, insideInterface, writer, classIndex);
|
||||
}
|
||||
if (convertData.assignedValues.containsKey(this)) {
|
||||
GraphTargetItem val = convertData.assignedValues.get(this).value;
|
||||
@@ -254,22 +259,22 @@ public class TraitSlotConst extends Trait implements TraitWithSlot {
|
||||
List<MethodBody> callStack = new ArrayList<>();
|
||||
AssignedValue assignment = convertData.assignedValues.get(this);
|
||||
callStack.add(abc.bodies.get(abc.findBodyIndex(assignment.method)));
|
||||
return val.toString(writer, LocalData.create(callStack, abcIndex, abc, new HashMap<>(), fullyQualifiedNames, new HashSet<>(), exportMode, swfVersion));
|
||||
return val.toString(writer, LocalData.create(callStack, abcIndex, abc, new HashMap<>(), fullyQualifiedNames, new HashSet<>(), exportMode, swfVersion, usedDeobfuscations));
|
||||
}
|
||||
}
|
||||
getNameStr(writer, abc, fullyQualifiedNames);
|
||||
getNameStr(writer, abc, fullyQualifiedNames, usedDeobfuscations);
|
||||
if (hasValueStr(abc, convertData)) {
|
||||
writer.appendNoHilight(" = ");
|
||||
getValueStr(swfVersion, abcIndex, exportMode, convertData, writer, abc, fullyQualifiedNames);
|
||||
getValueStr(usedDeobfuscations, swfVersion, abcIndex, exportMode, convertData, writer, abc, fullyQualifiedNames);
|
||||
}
|
||||
return writer.appendNoHilight(";").newLine();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void convert(int swfVersion, AbcIndexing abcIndex, Trait parent, ConvertData convertData, String path, ABC abc, boolean isStatic, ScriptExportMode exportMode, int scriptIndex, int classIndex, NulWriter writer, List<DottedChain> fullyQualifiedNames, boolean parallel, ScopeStack scopeStack) throws InterruptedException {
|
||||
getNameStr(writer, abc, fullyQualifiedNames);
|
||||
public void convert(Set<String> usedDeobfuscations, int swfVersion, AbcIndexing abcIndex, Trait parent, ConvertData convertData, String path, ABC abc, boolean isStatic, ScriptExportMode exportMode, int scriptIndex, int classIndex, NulWriter writer, List<DottedChain> fullyQualifiedNames, boolean parallel, ScopeStack scopeStack) throws InterruptedException {
|
||||
getNameStr(writer, abc, fullyQualifiedNames, usedDeobfuscations);
|
||||
if (hasValueStr(abc, convertData)) {
|
||||
getValueStr(swfVersion, abcIndex, exportMode, convertData, writer, abc, fullyQualifiedNames);
|
||||
getValueStr(usedDeobfuscations, swfVersion, abcIndex, exportMode, convertData, writer, abc, fullyQualifiedNames);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -317,29 +322,14 @@ public class TraitSlotConst extends Trait implements TraitWithSlot {
|
||||
TraitSlotConst ret = (TraitSlotConst) super.clone();
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets dependencies.
|
||||
*
|
||||
* @param abcIndex ABC indexing
|
||||
* @param scriptIndex Script index
|
||||
* @param classIndex Class index
|
||||
* @param isStatic Is static
|
||||
* @param customNamespace Custom namespace
|
||||
* @param abc ABC
|
||||
* @param dependencies Dependencies
|
||||
* @param ignorePackage Ignore package
|
||||
* @param fullyQualifiedNames Fully qualified names
|
||||
* @param uses Uses
|
||||
* @throws InterruptedException On interrupt
|
||||
*/
|
||||
|
||||
@Override
|
||||
public void getDependencies(AbcIndexing abcIndex, int scriptIndex, int classIndex, boolean isStatic, String customNamespace, ABC abc, List<Dependency> dependencies, DottedChain ignorePackage, List<DottedChain> fullyQualifiedNames, List<String> uses, Reference<Integer> numberContextRef) throws InterruptedException {
|
||||
public void getDependencies(Set<String> usedDeobfuscations, AbcIndexing abcIndex, int scriptIndex, int classIndex, boolean isStatic, String customNamespace, ABC abc, List<Dependency> dependencies, DottedChain ignorePackage, List<DottedChain> fullyQualifiedNames, List<String> uses, Reference<Integer> numberContextRef) throws InterruptedException {
|
||||
if (ignorePackage == null) {
|
||||
ignorePackage = getPackage(abc);
|
||||
}
|
||||
super.getDependencies(abcIndex, scriptIndex, classIndex, isStatic, customNamespace, abc, dependencies, ignorePackage, fullyQualifiedNames, uses, numberContextRef);
|
||||
DependencyParser.parseDependenciesFromMultiname(abcIndex, customNamespace, abc, dependencies, abc.constants.getMultiname(type_index), getPackage(abc), fullyQualifiedNames, DependencyType.SIGNATURE, uses);
|
||||
super.getDependencies(usedDeobfuscations, abcIndex, scriptIndex, classIndex, isStatic, customNamespace, abc, dependencies, ignorePackage, fullyQualifiedNames, uses, numberContextRef);
|
||||
DependencyParser.parseDependenciesFromMultiname(usedDeobfuscations, abcIndex, customNamespace, abc, dependencies, abc.constants.getMultiname(type_index), getPackage(abc), fullyQualifiedNames, DependencyType.SIGNATURE, uses);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -357,9 +347,9 @@ public class TraitSlotConst extends Trait implements TraitWithSlot {
|
||||
Hide: private static var _skinParts
|
||||
(part of [SkinPart] compilations)
|
||||
*/
|
||||
if (isStatic && "_skinParts".equals(getName(abc).getName(abc, abc.constants, new ArrayList<>(), true, true))) {
|
||||
if (isStatic && "_skinParts".equals(getName(abc).getName(new LinkedHashSet<>(), abc, abc.constants, new ArrayList<>(), true, true))) {
|
||||
if (kindType == Trait.TRAIT_SLOT) {
|
||||
if ("_skinParts".equals(getName(abc).getName(abc, abc.constants, new ArrayList<>(), true, true))) {
|
||||
if ("_skinParts".equals(getName(abc).getName(new LinkedHashSet<>(), abc, abc.constants, new ArrayList<>(), true, true))) {
|
||||
if (getName(abc).getNamespace(abc.constants).kind == Namespace.KIND_PRIVATE) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -31,6 +31,8 @@ import com.jpexs.helpers.Reference;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
@@ -218,6 +220,15 @@ public class Traits implements Cloneable, Serializable {
|
||||
* Convert data
|
||||
*/
|
||||
ConvertData convertData;
|
||||
|
||||
/**
|
||||
* Used deobfuscations
|
||||
*/
|
||||
private final Set<String> usedDeobfuscations;
|
||||
|
||||
/**
|
||||
* SWF version
|
||||
*/
|
||||
private final int swfVersion;
|
||||
|
||||
/**
|
||||
@@ -233,6 +244,7 @@ public class Traits implements Cloneable, Serializable {
|
||||
/**
|
||||
* Constructs a new TraitConvertTask object.
|
||||
*
|
||||
* @param usedDeobfuscations Used deobfuscations
|
||||
* @param swfVersion SWF version
|
||||
* @param abcIndex ABC indexing
|
||||
* @param trait Trait
|
||||
@@ -251,7 +263,7 @@ public class Traits implements Cloneable, Serializable {
|
||||
* @param parallel Parallel flag
|
||||
* @param scopeStack Scope stack
|
||||
*/
|
||||
public TraitConvertTask(int swfVersion, AbcIndexing abcIndex, Trait trait, Trait parent, ConvertData convertData, boolean makePackages, String path, ABC abc, boolean isStatic, ScriptExportMode exportMode, int scriptIndex, int classIndex, NulWriter writer, List<DottedChain> fullyQualifiedNames, int traitIndex, boolean parallel, ScopeStack scopeStack) {
|
||||
public TraitConvertTask(Set<String> usedDeobfuscations, int swfVersion, AbcIndexing abcIndex, Trait trait, Trait parent, ConvertData convertData, boolean makePackages, String path, ABC abc, boolean isStatic, ScriptExportMode exportMode, int scriptIndex, int classIndex, NulWriter writer, List<DottedChain> fullyQualifiedNames, int traitIndex, boolean parallel, ScopeStack scopeStack) {
|
||||
this.trait = trait;
|
||||
this.parent = parent;
|
||||
this.convertData = convertData;
|
||||
@@ -266,6 +278,7 @@ public class Traits implements Cloneable, Serializable {
|
||||
this.fullyQualifiedNames = fullyQualifiedNames;
|
||||
this.traitIndex = traitIndex;
|
||||
this.parallel = parallel;
|
||||
this.usedDeobfuscations = usedDeobfuscations;
|
||||
this.swfVersion = swfVersion;
|
||||
this.abcIndex = abcIndex;
|
||||
this.scopeStack = scopeStack;
|
||||
@@ -280,9 +293,9 @@ public class Traits implements Cloneable, Serializable {
|
||||
@Override
|
||||
public Void call() throws InterruptedException {
|
||||
if (makePackages) {
|
||||
trait.convertPackaged(swfVersion, abcIndex, parent, convertData, path, abc, isStatic, exportMode, scriptIndex, classIndex, writer, fullyQualifiedNames, parallel, scopeStack);
|
||||
trait.convertPackaged(usedDeobfuscations, swfVersion, abcIndex, parent, convertData, path, abc, isStatic, exportMode, scriptIndex, classIndex, writer, fullyQualifiedNames, parallel, scopeStack);
|
||||
} else {
|
||||
trait.convert(swfVersion, abcIndex, parent, convertData, path, abc, isStatic, exportMode, scriptIndex, classIndex, writer, fullyQualifiedNames, parallel, scopeStack);
|
||||
trait.convert(usedDeobfuscations, swfVersion, abcIndex, parent, convertData, path, abc, isStatic, exportMode, scriptIndex, classIndex, writer, fullyQualifiedNames, parallel, scopeStack);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -291,6 +304,7 @@ public class Traits implements Cloneable, Serializable {
|
||||
/**
|
||||
* To string.
|
||||
*
|
||||
* @param usedDeobfuscations Used deobfuscations
|
||||
* @param swfVersion SWF version
|
||||
* @param packageName Package name
|
||||
* @param first Whether to add newline
|
||||
@@ -313,7 +327,7 @@ public class Traits implements Cloneable, Serializable {
|
||||
* @return Writer
|
||||
* @throws InterruptedException On interrupt
|
||||
*/
|
||||
public GraphTextWriter toString(int swfVersion, DottedChain packageName, Reference<Boolean> first, AbcIndexing abcIndex, Class[] traitTypes, Trait parent, ConvertData convertData, String path, ABC abc, boolean isStatic, ScriptExportMode exportMode, boolean makePackages, int scriptIndex, int classIndex, GraphTextWriter writer, List<DottedChain> fullyQualifiedNames, boolean parallel, List<String> ignoredTraitNames, boolean insideInterface) throws InterruptedException {
|
||||
public GraphTextWriter toString(Set<String> usedDeobfuscations, int swfVersion, DottedChain packageName, Reference<Boolean> first, AbcIndexing abcIndex, Class[] traitTypes, Trait parent, ConvertData convertData, String path, ABC abc, boolean isStatic, ScriptExportMode exportMode, boolean makePackages, int scriptIndex, int classIndex, GraphTextWriter writer, List<DottedChain> fullyQualifiedNames, boolean parallel, List<String> ignoredTraitNames, boolean insideInterface) throws InterruptedException {
|
||||
List<Trait> ordered = traits;
|
||||
|
||||
for (Trait trait : ordered) {
|
||||
@@ -333,7 +347,7 @@ public class Traits implements Cloneable, Serializable {
|
||||
if (!trait.isVisible(isStatic, abc)) {
|
||||
continue;
|
||||
}
|
||||
if (ignoredTraitNames.contains(trait.getName(abc).getName(abc, abc.constants, new ArrayList<>(), false, false))) {
|
||||
if (ignoredTraitNames.contains(trait.getName(abc).getName(usedDeobfuscations, abc, abc.constants, new ArrayList<>(), false, false))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -348,9 +362,9 @@ public class Traits implements Cloneable, Serializable {
|
||||
int h = abc.getGlobalTraitId(TraitType.METHOD, isStatic, classIndex, t);
|
||||
writer.startTrait(h);
|
||||
if (makePackages) {
|
||||
trait.toStringPackaged(swfVersion, abcIndex, parent, convertData, path, abc, isStatic, exportMode, scriptIndex, classIndex, writer, fullyQualifiedNames, parallel, insideInterface);
|
||||
trait.toStringPackaged(usedDeobfuscations, swfVersion, abcIndex, parent, convertData, path, abc, isStatic, exportMode, scriptIndex, classIndex, writer, fullyQualifiedNames, parallel, insideInterface);
|
||||
} else {
|
||||
trait.toString(swfVersion, abcIndex, packageName, parent, convertData, path, abc, isStatic, exportMode, scriptIndex, classIndex, writer, fullyQualifiedNames, parallel, insideInterface);
|
||||
trait.toString(usedDeobfuscations, swfVersion, abcIndex, packageName, parent, convertData, path, abc, isStatic, exportMode, scriptIndex, classIndex, writer, fullyQualifiedNames, parallel, insideInterface);
|
||||
}
|
||||
writer.endTrait();
|
||||
}
|
||||
@@ -360,6 +374,7 @@ public class Traits implements Cloneable, Serializable {
|
||||
/**
|
||||
* Converts traits.
|
||||
*
|
||||
* @param usedDeobfuscations Used deobfuscations
|
||||
* @param swfVersion SWF version
|
||||
* @param abcIndex ABC indexing
|
||||
* @param parent Parent trait
|
||||
@@ -377,10 +392,10 @@ public class Traits implements Cloneable, Serializable {
|
||||
* @param scopeStack Scope stack
|
||||
* @throws InterruptedException On interrupt
|
||||
*/
|
||||
public void convert(int swfVersion, AbcIndexing abcIndex, Trait parent, ConvertData convertData, String path, ABC abc, boolean isStatic, ScriptExportMode exportMode, boolean makePackages, int scriptIndex, int classIndex, NulWriter writer, List<DottedChain> fullyQualifiedNames, boolean parallel, ScopeStack scopeStack) throws InterruptedException {
|
||||
public void convert(Set<String> usedDeobfuscations, int swfVersion, AbcIndexing abcIndex, Trait parent, ConvertData convertData, String path, ABC abc, boolean isStatic, ScriptExportMode exportMode, boolean makePackages, int scriptIndex, int classIndex, NulWriter writer, List<DottedChain> fullyQualifiedNames, boolean parallel, ScopeStack scopeStack) throws InterruptedException {
|
||||
if (!parallel || traits.size() < 2) {
|
||||
for (int t = 0; t < traits.size(); t++) {
|
||||
TraitConvertTask task = new TraitConvertTask(swfVersion, abcIndex, traits.get(t), parent, convertData, makePackages, path, abc, isStatic, exportMode, scriptIndex, classIndex, writer, fullyQualifiedNames, t, parallel, scopeStack);
|
||||
TraitConvertTask task = new TraitConvertTask(usedDeobfuscations, swfVersion, abcIndex, traits.get(t), parent, convertData, makePackages, path, abc, isStatic, exportMode, scriptIndex, classIndex, writer, fullyQualifiedNames, t, parallel, scopeStack);
|
||||
task.call();
|
||||
}
|
||||
} else {
|
||||
@@ -390,7 +405,7 @@ public class Traits implements Cloneable, Serializable {
|
||||
futureResults = new ArrayList<>();
|
||||
for (int t = 0; t < traits.size(); t++) {
|
||||
// each convert task needs a separate NulWriter, because they are executed parallel
|
||||
TraitConvertTask task = new TraitConvertTask(swfVersion, abcIndex, traits.get(t), parent, convertData, makePackages, path, abc, isStatic, exportMode, scriptIndex, classIndex, new NulWriter(), fullyQualifiedNames, t, parallel, scopeStack);
|
||||
TraitConvertTask task = new TraitConvertTask(usedDeobfuscations, swfVersion, abcIndex, traits.get(t), parent, convertData, makePackages, path, abc, isStatic, exportMode, scriptIndex, classIndex, new NulWriter(), fullyQualifiedNames, t, parallel, scopeStack);
|
||||
Future<Void> future = executor.submit(task);
|
||||
futureResults.add(future);
|
||||
}
|
||||
@@ -435,6 +450,7 @@ public class Traits implements Cloneable, Serializable {
|
||||
/**
|
||||
* Gets dependencies.
|
||||
*
|
||||
* @param usedDeobfuscations Used deobfuscations
|
||||
* @param abcIndex ABC indexing
|
||||
* @param scriptIndex Script index
|
||||
* @param classIndex Class index
|
||||
@@ -447,9 +463,9 @@ public class Traits implements Cloneable, Serializable {
|
||||
* @param uses Uses
|
||||
* @throws InterruptedException On interrupt
|
||||
*/
|
||||
public void getDependencies(AbcIndexing abcIndex, int scriptIndex, int classIndex, boolean isStatic, String customNs, ABC abc, List<Dependency> dependencies, DottedChain ignorePackage, List<DottedChain> fullyQualifiedNames, List<String> uses, Reference<Integer> numberContextRef) throws InterruptedException {
|
||||
public void getDependencies(Set<String> usedDeobfuscations, AbcIndexing abcIndex, int scriptIndex, int classIndex, boolean isStatic, String customNs, ABC abc, List<Dependency> dependencies, DottedChain ignorePackage, List<DottedChain> fullyQualifiedNames, List<String> uses, Reference<Integer> numberContextRef) throws InterruptedException {
|
||||
for (Trait t : traits) {
|
||||
t.getDependencies(abcIndex, scriptIndex, classIndex, isStatic, customNs, abc, dependencies, ignorePackage, fullyQualifiedNames, uses, numberContextRef);
|
||||
t.getDependencies(usedDeobfuscations, abcIndex, scriptIndex, classIndex, isStatic, customNs, abc, dependencies, ignorePackage, fullyQualifiedNames, uses, numberContextRef);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -18,6 +18,7 @@ package com.jpexs.decompiler.flash.abc.usages.multinames;
|
||||
|
||||
import com.jpexs.decompiler.flash.abc.ABC;
|
||||
import com.jpexs.decompiler.flash.abc.types.InstanceInfo;
|
||||
import java.util.LinkedHashSet;
|
||||
|
||||
/**
|
||||
* Class name multiname usage.
|
||||
@@ -49,7 +50,7 @@ public class ClassNameMultinameUsage extends MultinameUsage implements Definitio
|
||||
public String toString() {
|
||||
InstanceInfo ii = abc.instance_info.get(classIndex);
|
||||
String kind = ii.isInterface() ? "interface" : "class";
|
||||
return kind + " " + ii.getName(abc.constants).getNameWithNamespace(abc, abc.constants, true).toPrintableString(abc.getSwf(), true) + " name";
|
||||
return kind + " " + ii.getName(abc.constants).getNameWithNamespace(new LinkedHashSet<>(), abc, abc.constants, true).toPrintableString(new LinkedHashSet<>(), abc.getSwf(), true) + " name";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+7
-6
@@ -27,6 +27,7 @@ import com.jpexs.decompiler.flash.helpers.HighlightedTextWriter;
|
||||
import com.jpexs.decompiler.flash.helpers.NulWriter;
|
||||
import com.jpexs.decompiler.graph.DottedChain;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashSet;
|
||||
|
||||
/**
|
||||
* Const or var multiname usage.
|
||||
@@ -56,13 +57,13 @@ public abstract class ConstVarMultinameUsage extends TraitMultinameUsage {
|
||||
ConvertData convertData = new ConvertData();
|
||||
if (parentTraitIndex > -1) {
|
||||
if (traitsType == TRAITS_TYPE_CLASS) {
|
||||
((TraitMethodGetterSetter) abc.class_info.get(classIndex).static_traits.traits.get(parentTraitIndex)).convertHeader(-1, null, convertData, "", abc, traitsType == TRAITS_TYPE_CLASS, ScriptExportMode.AS, -1/*FIXME*/, classIndex, nulWriter, new ArrayList<>(), false);
|
||||
((TraitMethodGetterSetter) abc.class_info.get(classIndex).static_traits.traits.get(parentTraitIndex)).convertHeader(new LinkedHashSet<>(), -1, null, convertData, "", abc, traitsType == TRAITS_TYPE_CLASS, ScriptExportMode.AS, -1/*FIXME*/, classIndex, nulWriter, new ArrayList<>(), false);
|
||||
} else if (traitsType == TRAITS_TYPE_INSTANCE) {
|
||||
((TraitMethodGetterSetter) abc.instance_info.get(classIndex).instance_traits.traits.get(parentTraitIndex)).convertHeader(-1, null, convertData, "", abc, traitsType == TRAITS_TYPE_CLASS, ScriptExportMode.AS, -1/*FIXME*/, classIndex, nulWriter, new ArrayList<>(), false);
|
||||
((TraitMethodGetterSetter) abc.instance_info.get(classIndex).instance_traits.traits.get(parentTraitIndex)).convertHeader(new LinkedHashSet<>(), -1, null, convertData, "", abc, traitsType == TRAITS_TYPE_CLASS, ScriptExportMode.AS, -1/*FIXME*/, classIndex, nulWriter, new ArrayList<>(), false);
|
||||
}
|
||||
}
|
||||
try {
|
||||
((TraitSlotConst) traits.traits.get(traitIndex)).convertHeader(-1, null, convertData, "", abc, traitsType == TRAITS_TYPE_CLASS /*?? FIXME*/, ScriptExportMode.AS, -1/*FIXME*/, classIndex, nulWriter, new ArrayList<>(), false);
|
||||
((TraitSlotConst) traits.traits.get(traitIndex)).convertHeader(new LinkedHashSet<>(), -1, null, convertData, "", abc, traitsType == TRAITS_TYPE_CLASS /*?? FIXME*/, ScriptExportMode.AS, -1/*FIXME*/, classIndex, nulWriter, new ArrayList<>(), false);
|
||||
} catch (InterruptedException ex) {
|
||||
// ignore
|
||||
}
|
||||
@@ -76,13 +77,13 @@ public abstract class ConstVarMultinameUsage extends TraitMultinameUsage {
|
||||
|
||||
if (parentTraitIndex > -1) {
|
||||
if (traitsType == TRAITS_TYPE_CLASS) {
|
||||
((TraitMethodGetterSetter) abc.class_info.get(classIndex).static_traits.traits.get(parentTraitIndex)).toStringHeader(-1, null, DottedChain.EMPTY /*??*/, convertData, "", abc, traitsType == TRAITS_TYPE_CLASS, ScriptExportMode.AS, -1/*FIXME*/, classIndex, writer, new ArrayList<>(), false, insideInterface);
|
||||
((TraitMethodGetterSetter) abc.class_info.get(classIndex).static_traits.traits.get(parentTraitIndex)).toStringHeader(new LinkedHashSet<>(), -1, null, DottedChain.EMPTY /*??*/, convertData, "", abc, traitsType == TRAITS_TYPE_CLASS, ScriptExportMode.AS, -1/*FIXME*/, classIndex, writer, new ArrayList<>(), false, insideInterface);
|
||||
} else if (traitsType == TRAITS_TYPE_INSTANCE) {
|
||||
((TraitMethodGetterSetter) abc.instance_info.get(classIndex).instance_traits.traits.get(parentTraitIndex)).toStringHeader(-1, null, DottedChain.EMPTY /*??*/, convertData, "", abc, traitsType == TRAITS_TYPE_CLASS, ScriptExportMode.AS, -1/*FIXME*/, classIndex, writer, new ArrayList<>(), false, insideInterface);
|
||||
((TraitMethodGetterSetter) abc.instance_info.get(classIndex).instance_traits.traits.get(parentTraitIndex)).toStringHeader(new LinkedHashSet<>(), -1, null, DottedChain.EMPTY /*??*/, convertData, "", abc, traitsType == TRAITS_TYPE_CLASS, ScriptExportMode.AS, -1/*FIXME*/, classIndex, writer, new ArrayList<>(), false, insideInterface);
|
||||
}
|
||||
}
|
||||
try {
|
||||
((TraitSlotConst) traits.traits.get(traitIndex)).toStringHeader(-1, null, DottedChain.EMPTY /*??*/, convertData, "", abc, traitsType == TRAITS_TYPE_CLASS, ScriptExportMode.AS, -1/*FIXME*/, classIndex, writer, new ArrayList<>(), false, insideInterface);
|
||||
((TraitSlotConst) traits.traits.get(traitIndex)).toStringHeader(new LinkedHashSet<>(), -1, null, DottedChain.EMPTY /*??*/, convertData, "", abc, traitsType == TRAITS_TYPE_CLASS, ScriptExportMode.AS, -1/*FIXME*/, classIndex, writer, new ArrayList<>(), false, insideInterface);
|
||||
} catch (InterruptedException ex) {
|
||||
// ignore
|
||||
}
|
||||
|
||||
+7
-6
@@ -26,6 +26,7 @@ import com.jpexs.decompiler.flash.helpers.HighlightedTextWriter;
|
||||
import com.jpexs.decompiler.flash.helpers.NulWriter;
|
||||
import com.jpexs.decompiler.graph.DottedChain;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashSet;
|
||||
|
||||
/**
|
||||
* Method multiname usage.
|
||||
@@ -70,12 +71,12 @@ public abstract class MethodMultinameUsage extends TraitMultinameUsage {
|
||||
if (!isInitializer) {
|
||||
if (parentTraitIndex > -1) {
|
||||
if (traitsType == TRAITS_TYPE_CLASS) {
|
||||
((TraitMethodGetterSetter) abc.class_info.get(classIndex).static_traits.traits.get(parentTraitIndex)).convertHeader(-1, null, convertData, "", abc, traitsType == TRAITS_TYPE_CLASS, ScriptExportMode.AS, -1/*FIXME*/, classIndex, nulWriter, new ArrayList<>(), false);
|
||||
((TraitMethodGetterSetter) abc.class_info.get(classIndex).static_traits.traits.get(parentTraitIndex)).convertHeader(new LinkedHashSet<>(), -1, null, convertData, "", abc, traitsType == TRAITS_TYPE_CLASS, ScriptExportMode.AS, -1/*FIXME*/, classIndex, nulWriter, new ArrayList<>(), false);
|
||||
} else {
|
||||
((TraitMethodGetterSetter) abc.instance_info.get(classIndex).instance_traits.traits.get(parentTraitIndex)).convertHeader(-1, null, convertData, "", abc, traitsType == TRAITS_TYPE_CLASS, ScriptExportMode.AS, -1/*FIXME*/, classIndex, nulWriter, new ArrayList<>(), false);
|
||||
((TraitMethodGetterSetter) abc.instance_info.get(classIndex).instance_traits.traits.get(parentTraitIndex)).convertHeader(new LinkedHashSet<>(), -1, null, convertData, "", abc, traitsType == TRAITS_TYPE_CLASS, ScriptExportMode.AS, -1/*FIXME*/, classIndex, nulWriter, new ArrayList<>(), false);
|
||||
}
|
||||
}
|
||||
((TraitMethodGetterSetter) traits.traits.get(traitIndex)).convertHeader(-1, null, convertData, "", abc, traitsType == TRAITS_TYPE_CLASS, ScriptExportMode.AS, -1/*FIXME*/, classIndex, nulWriter, new ArrayList<>(), false);
|
||||
((TraitMethodGetterSetter) traits.traits.get(traitIndex)).convertHeader(new LinkedHashSet<>(), -1, null, convertData, "", abc, traitsType == TRAITS_TYPE_CLASS, ScriptExportMode.AS, -1/*FIXME*/, classIndex, nulWriter, new ArrayList<>(), false);
|
||||
}
|
||||
|
||||
HighlightedTextWriter writer = new HighlightedTextWriter(Configuration.getCodeFormatting(), false);
|
||||
@@ -102,13 +103,13 @@ public abstract class MethodMultinameUsage extends TraitMultinameUsage {
|
||||
}
|
||||
if (parentTraitIndex > -1) {
|
||||
if (traitsType == TRAITS_TYPE_CLASS) {
|
||||
((TraitMethodGetterSetter) abc.class_info.get(classIndex).static_traits.traits.get(parentTraitIndex)).toStringHeader(-1, null, DottedChain.EMPTY /*??*/, convertData, "", abc, traitsType == TRAITS_TYPE_CLASS, ScriptExportMode.AS, -1/*FIXME*/, classIndex, writer, new ArrayList<>(), false, insideInterface);
|
||||
((TraitMethodGetterSetter) abc.class_info.get(classIndex).static_traits.traits.get(parentTraitIndex)).toStringHeader(new LinkedHashSet<>(), -1, null, DottedChain.EMPTY /*??*/, convertData, "", abc, traitsType == TRAITS_TYPE_CLASS, ScriptExportMode.AS, -1/*FIXME*/, classIndex, writer, new ArrayList<>(), false, insideInterface);
|
||||
} else {
|
||||
((TraitMethodGetterSetter) abc.instance_info.get(classIndex).instance_traits.traits.get(parentTraitIndex)).toStringHeader(-1, null, DottedChain.EMPTY /*??*/, convertData, "", abc, traitsType == TRAITS_TYPE_CLASS, ScriptExportMode.AS, -1/*FIXME*/, classIndex, writer, new ArrayList<>(), false, insideInterface);
|
||||
((TraitMethodGetterSetter) abc.instance_info.get(classIndex).instance_traits.traits.get(parentTraitIndex)).toStringHeader(new LinkedHashSet<>(), -1, null, DottedChain.EMPTY /*??*/, convertData, "", abc, traitsType == TRAITS_TYPE_CLASS, ScriptExportMode.AS, -1/*FIXME*/, classIndex, writer, new ArrayList<>(), false, insideInterface);
|
||||
}
|
||||
writer.appendNoHilight(" ");
|
||||
}
|
||||
((TraitMethodGetterSetter) traits.traits.get(traitIndex)).toStringHeader(-1, null, DottedChain.EMPTY /*??*/, convertData, "", abc, traitsType == TRAITS_TYPE_CLASS, ScriptExportMode.AS, -1/*FIXME*/, classIndex, writer, new ArrayList<>(), false, insideInterface);
|
||||
((TraitMethodGetterSetter) traits.traits.get(traitIndex)).toStringHeader(new LinkedHashSet<>(), -1, null, DottedChain.EMPTY /*??*/, convertData, "", abc, traitsType == TRAITS_TYPE_CLASS, ScriptExportMode.AS, -1/*FIXME*/, classIndex, writer, new ArrayList<>(), false, insideInterface);
|
||||
}
|
||||
writer.finishHilights();
|
||||
return writer.toString().trim();
|
||||
|
||||
+3
-2
@@ -21,6 +21,7 @@ import com.jpexs.decompiler.flash.abc.types.Multiname;
|
||||
import com.jpexs.decompiler.flash.abc.types.Namespace;
|
||||
import com.jpexs.decompiler.flash.abc.usages.Usage;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
@@ -86,8 +87,8 @@ public abstract class MultinameUsage implements Usage {
|
||||
return false;
|
||||
}
|
||||
if ((thisM.kind == Multiname.QNAME || thisM.kind == Multiname.QNAMEA) && otherM.kind == thisM.kind) {
|
||||
String thisName = thisM.getName(abc, abc.constants, new ArrayList<>(), true, true);
|
||||
String otherName = otherM.getName(other.abc, other.abc.constants, new ArrayList<>(), true, true);
|
||||
String thisName = thisM.getName(new LinkedHashSet<>(), abc, abc.constants, new ArrayList<>(), true, true);
|
||||
String otherName = otherM.getName(new LinkedHashSet<>(), other.abc, other.abc.constants, new ArrayList<>(), true, true);
|
||||
Namespace thisNs = thisM.getNamespace(abc.constants);
|
||||
Namespace otherNs = otherM.getNamespace(other.abc.constants);
|
||||
if (!Objects.equals(thisName, otherName)) {
|
||||
|
||||
+2
-1
@@ -18,6 +18,7 @@ package com.jpexs.decompiler.flash.abc.usages.multinames;
|
||||
|
||||
import com.jpexs.decompiler.flash.abc.ABC;
|
||||
import com.jpexs.decompiler.flash.abc.types.InstanceInfo;
|
||||
import java.util.LinkedHashSet;
|
||||
|
||||
/**
|
||||
* Super class multiname usage.
|
||||
@@ -52,7 +53,7 @@ public class SuperClassMultinameUsage extends MultinameUsage implements InsideCl
|
||||
public String toString() {
|
||||
InstanceInfo ii = abc.instance_info.get(classIndex);
|
||||
String kind = ii.isInterface() ? "interface" : "class";
|
||||
return kind + " " + ii.getName(abc.constants).getNameWithNamespace(abc, abc.constants, true) + " extends";
|
||||
return kind + " " + ii.getName(abc.constants).getNameWithNamespace(new LinkedHashSet<>(), abc, abc.constants, true) + " extends";
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+2
-1
@@ -18,6 +18,7 @@ package com.jpexs.decompiler.flash.abc.usages.multinames;
|
||||
|
||||
import com.jpexs.decompiler.flash.abc.ABC;
|
||||
import com.jpexs.decompiler.flash.abc.types.InstanceInfo;
|
||||
import java.util.LinkedHashSet;
|
||||
|
||||
/**
|
||||
* Super interface multiname usage.
|
||||
@@ -52,7 +53,7 @@ public class SuperInterfaceMultinameUsage extends MultinameUsage implements Insi
|
||||
public String toString() {
|
||||
InstanceInfo ii = abc.instance_info.get(classIndex);
|
||||
String kind = ii.isInterface() ? "interface" : "class";
|
||||
return kind + " " + ii.getName(abc.constants).getNameWithNamespace(abc, abc.constants, true) + " " + (ii.isInterface() ? "extends" : "implements");
|
||||
return kind + " " + ii.getName(abc.constants).getNameWithNamespace(new LinkedHashSet<>(), abc, abc.constants, true) + " " + (ii.isInterface() ? "extends" : "implements");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+4
-3
@@ -20,6 +20,7 @@ import com.jpexs.decompiler.flash.abc.ABC;
|
||||
import com.jpexs.decompiler.flash.abc.types.InstanceInfo;
|
||||
import com.jpexs.decompiler.flash.abc.types.traits.Traits;
|
||||
import com.jpexs.decompiler.graph.DottedChain;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
@@ -100,10 +101,10 @@ public abstract class TraitMultinameUsage extends MultinameUsage implements Insi
|
||||
if (classIndex != -1) {
|
||||
InstanceInfo ii = abc.instance_info.get(classIndex);
|
||||
String kind = ii.isInterface() ? "interface" : "class";
|
||||
return kind + " " + ii.getName(abc.constants).getNameWithNamespace(abc, abc.constants, true).toPrintableString(abc.getSwf(), true);
|
||||
return kind + " " + ii.getName(abc.constants).getNameWithNamespace(new LinkedHashSet<>(), abc, abc.constants, true).toPrintableString(new LinkedHashSet<>(), abc.getSwf(), true);
|
||||
}
|
||||
DottedChain scriptSimpleName = abc.script_info.get(scriptIndex).getSimplePackName(abc);
|
||||
return "script " + (scriptSimpleName == null ? "" + scriptIndex : scriptSimpleName.toPrintableString(abc.getSwf(), true));
|
||||
DottedChain scriptSimpleName = abc.script_info.get(scriptIndex).getSimplePackName(abc, new LinkedHashSet<>());
|
||||
return "script " + (scriptSimpleName == null ? "" + scriptIndex : scriptSimpleName.toPrintableString(new LinkedHashSet<>(), abc.getSwf(), true));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -87,9 +87,11 @@ import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
@@ -977,8 +979,9 @@ public abstract class Action implements GraphSourceItem {
|
||||
* @return Writer
|
||||
* @throws InterruptedException On interrupt
|
||||
*/
|
||||
public static GraphTextWriter actionsToSource(Map<String, Map<String, Trait>> uninitializedClassTraits, final ASMSource asm, final List<Action> actions, final String path, GraphTextWriter writer, String charset, List<ActionTreeOperation> treeOperations) throws InterruptedException {
|
||||
public static GraphTextWriter actionsToSource(Map<String, Map<String, Trait>> uninitializedClassTraits, final ASMSource asm, final List<Action> actions, final String path, GraphTextWriter writer, String charset, List<ActionTreeOperation> treeOperations) throws InterruptedException {
|
||||
writer.suspendMeasure();
|
||||
Set<String> usedDeobfuscations = Collections.synchronizedSet(new LinkedHashSet<>());
|
||||
List<GraphTargetItem> tree = null;
|
||||
Throwable convertException = null;
|
||||
int timeout = Configuration.decompilationTimeoutSingleMethod.get();
|
||||
@@ -990,7 +993,7 @@ public abstract class Action implements GraphSourceItem {
|
||||
public List<GraphTargetItem> call() throws Exception {
|
||||
int staticOperation = 0;
|
||||
boolean insideDoInitAction = (asm instanceof DoInitActionTag);
|
||||
List<GraphTargetItem> tree = actionsToTree(asm == null ? false : swf.needsCalculatingAS2UninitializeClassTraits(asm), uninitializedClassTraits, insideDoInitAction, false, new HashMap<>(), new HashMap<>(), new HashMap<>(), actions, version, staticOperation, path, charset);
|
||||
List<GraphTargetItem> tree = actionsToTree(usedDeobfuscations, asm == null ? false : swf.needsCalculatingAS2UninitializeClassTraits(asm), uninitializedClassTraits, insideDoInitAction, false, new HashMap<>(), new HashMap<>(), new HashMap<>(), actions, version, staticOperation, path, charset);
|
||||
SWFDecompilerPlugin.fireActionTreeCreated(tree, swf);
|
||||
for (ActionTreeOperation treeOperation : treeOperations) {
|
||||
treeOperation.run(tree);
|
||||
@@ -1037,6 +1040,8 @@ public abstract class Action implements GraphSourceItem {
|
||||
if (asm != null) {
|
||||
asm.getActionSourceSuffix(writer);
|
||||
}
|
||||
|
||||
//TODO: write the actual used deobfuscations !!!
|
||||
|
||||
return writer;
|
||||
}
|
||||
@@ -1044,6 +1049,7 @@ public abstract class Action implements GraphSourceItem {
|
||||
/**
|
||||
* Converts list of actions to List of treeItems
|
||||
*
|
||||
* @param usedDeobfuscations Used deobfuscations
|
||||
* @param needsUninitializedClassFieldsDetection Needs uninitialized class fields detection
|
||||
* @param uninitializedClassTraits Uninitialized class traits
|
||||
* @param insideDoInitAction Inside DoInitAction?
|
||||
@@ -1056,13 +1062,14 @@ public abstract class Action implements GraphSourceItem {
|
||||
* @return List of treeItems
|
||||
* @throws InterruptedException On interrupt
|
||||
*/
|
||||
public static List<GraphTargetItem> actionsToTree(boolean needsUninitializedClassFieldsDetection, Map<String, Map<String, Trait>> uninitializedClassTraits, boolean insideDoInitAction, boolean insideFunction, List<Action> actions, int version, int staticOperation, String path, String charset) throws InterruptedException {
|
||||
return actionsToTree(needsUninitializedClassFieldsDetection, uninitializedClassTraits, insideDoInitAction, insideFunction, new HashMap<>(), new HashMap<>(), new HashMap<>(), actions, version, staticOperation, path, charset);
|
||||
public static List<GraphTargetItem> actionsToTree(Set<String> usedDeobfuscations, boolean needsUninitializedClassFieldsDetection, Map<String, Map<String, Trait>> uninitializedClassTraits, boolean insideDoInitAction, boolean insideFunction, List<Action> actions, int version, int staticOperation, String path, String charset) throws InterruptedException {
|
||||
return actionsToTree(usedDeobfuscations, needsUninitializedClassFieldsDetection, uninitializedClassTraits, insideDoInitAction, insideFunction, new HashMap<>(), new HashMap<>(), new HashMap<>(), actions, version, staticOperation, path, charset);
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts list of actions to List of treeItems.
|
||||
*
|
||||
* @param usedDeobfuscations Used deobfuscations
|
||||
* @param needsUninitializedClassFieldsDetection Needs uninitialized class fields detection
|
||||
* @param uninitializedClassTraits Uninitialized class traits
|
||||
* @param insideDoInitAction Inside DoInitAction?
|
||||
@@ -1078,17 +1085,17 @@ public abstract class Action implements GraphSourceItem {
|
||||
* @return List of treeItems
|
||||
* @throws InterruptedException On interrupt
|
||||
*/
|
||||
public static List<GraphTargetItem> actionsToTree(boolean needsUninitializedClassFieldsDetection, Map<String, Map<String, Trait>> uninitializedClassTraits, boolean insideDoInitAction, boolean insideFunction, HashMap<Integer, String> regNames, HashMap<String, GraphTargetItem> variables, HashMap<String, GraphTargetItem> functions, List<Action> actions, int version, int staticOperation, String path, String charset) throws InterruptedException {
|
||||
public static List<GraphTargetItem> actionsToTree(Set<String> usedDeobfuscations, boolean needsUninitializedClassFieldsDetection, Map<String, Map<String, Trait>> uninitializedClassTraits, boolean insideDoInitAction, boolean insideFunction, HashMap<Integer, String> regNames, HashMap<String, GraphTargetItem> variables, HashMap<String, GraphTargetItem> functions, List<Action> actions, int version, int staticOperation, String path, String charset) throws InterruptedException {
|
||||
HashMap<String, GraphTargetItem> variablesBackup = new LinkedHashMap<>(variables);
|
||||
HashMap<String, GraphTargetItem> functionsBackup = new LinkedHashMap<>(functions);
|
||||
try {
|
||||
return ActionGraph.translateViaGraph(needsUninitializedClassFieldsDetection, uninitializedClassTraits, null, insideDoInitAction, insideFunction, regNames, variables, functions, fixActionsClassHeader(actions, needsUninitializedClassFieldsDetection, charset, path), version, staticOperation, path, charset, 0);
|
||||
return ActionGraph.translateViaGraph(usedDeobfuscations, needsUninitializedClassFieldsDetection, uninitializedClassTraits, null, insideDoInitAction, insideFunction, regNames, variables, functions, fixActionsClassHeader(actions, needsUninitializedClassFieldsDetection, charset, path), version, staticOperation, path, charset, 0);
|
||||
} catch (SecondPassException spe) {
|
||||
variables.clear();
|
||||
variables.putAll(variablesBackup);
|
||||
functions.clear();
|
||||
functions.putAll(functionsBackup);
|
||||
return ActionGraph.translateViaGraph(needsUninitializedClassFieldsDetection, uninitializedClassTraits, spe.getData(), insideDoInitAction, insideFunction, regNames, variables, functions, actions, version, staticOperation, path, charset, 0);
|
||||
return ActionGraph.translateViaGraph(usedDeobfuscations, needsUninitializedClassFieldsDetection, uninitializedClassTraits, spe.getData(), insideDoInitAction, insideFunction, regNames, variables, functions, actions, version, staticOperation, path, charset, 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1109,6 +1116,7 @@ public abstract class Action implements GraphSourceItem {
|
||||
/**
|
||||
* Translates this function to stack and output.
|
||||
*
|
||||
* @param usedDeobfuscations Used deobfuscations
|
||||
* @param uninitializedClassTraits Uninitialized class traits
|
||||
* @param secondPassData Second pass data
|
||||
* @param insideDoInitAction Inside DoInitAction?
|
||||
@@ -1122,7 +1130,7 @@ public abstract class Action implements GraphSourceItem {
|
||||
* @param path the value of path
|
||||
* @throws InterruptedException On interrupt
|
||||
*/
|
||||
public void translate(Map<String, Map<String, Trait>> uninitializedClassTraits, SecondPassData secondPassData, boolean insideDoInitAction, GraphSourceItem lineStartIns, TranslateStack stack, List<GraphTargetItem> output, HashMap<Integer, String> regNames, HashMap<String, GraphTargetItem> variables, HashMap<String, GraphTargetItem> functions, int staticOperation, String path) throws InterruptedException {
|
||||
public void translate(Set<String> usedDeobfuscations, Map<String, Map<String, Trait>> uninitializedClassTraits, SecondPassData secondPassData, boolean insideDoInitAction, GraphSourceItem lineStartIns, TranslateStack stack, List<GraphTargetItem> output, HashMap<Integer, String> regNames, HashMap<String, GraphTargetItem> variables, HashMap<String, GraphTargetItem> functions, int staticOperation, String path) throws InterruptedException {
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1138,7 +1146,7 @@ public abstract class Action implements GraphSourceItem {
|
||||
@Override
|
||||
public void translate(BaseLocalData localData, TranslateStack stack, List<GraphTargetItem> output, int staticOperation, String path) throws InterruptedException {
|
||||
ActionLocalData aLocalData = (ActionLocalData) localData;
|
||||
translate(aLocalData.uninitializedClassTraits, aLocalData.secondPassData, aLocalData.insideDoInitAction, aLocalData.lineStartAction, stack, output, aLocalData.regNames, aLocalData.variables, aLocalData.functions, staticOperation, path);
|
||||
translate(localData.usedDeobfuscations, aLocalData.uninitializedClassTraits, aLocalData.secondPassData, aLocalData.insideDoInitAction, aLocalData.lineStartAction, stack, output, aLocalData.regNames, aLocalData.variables, aLocalData.functions, staticOperation, path);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1225,6 +1233,7 @@ public abstract class Action implements GraphSourceItem {
|
||||
/**
|
||||
* Converts list of actions to tree.
|
||||
*
|
||||
* @param usedDeobfuscations Used deobfuscations
|
||||
* @param output Output
|
||||
* @param graph ActionGraph
|
||||
* @param switchParts Switch parts
|
||||
@@ -1245,11 +1254,11 @@ public abstract class Action implements GraphSourceItem {
|
||||
* @throws InterruptedException On interrupt
|
||||
* @throws GraphPartChangeException On graph part change
|
||||
*/
|
||||
public static void actionsPartToTree(List<GraphTargetItem> output, ActionGraph graph, Set<GraphPart> switchParts, SecondPassData secondPassData, boolean insideDoInitAction, Reference<GraphSourceItem> lineStartActionRef, HashMap<Integer, String> registerNames, HashMap<String, GraphTargetItem> variables, HashMap<String, GraphTargetItem> functions, TranslateStack stack, List<Action> actions, int start, int end, int version, int staticOperation, String path, String charset) throws InterruptedException, GraphPartChangeException {
|
||||
public static void actionsPartToTree(Set<String> usedDeobfuscations, List<GraphTargetItem> output, ActionGraph graph, Set<GraphPart> switchParts, SecondPassData secondPassData, boolean insideDoInitAction, Reference<GraphSourceItem> lineStartActionRef, HashMap<Integer, String> registerNames, HashMap<String, GraphTargetItem> variables, HashMap<String, GraphTargetItem> functions, TranslateStack stack, List<Action> actions, int start, int end, int version, int staticOperation, String path, String charset) throws InterruptedException, GraphPartChangeException {
|
||||
if (start < actions.size() && (end > 0) && (start > 0)) {
|
||||
logger.log(Level.FINE, "Entering {0}-{1}{2}", new Object[]{start, end, actions.size() > 0 ? (" (" + actions.get(start).toString() + " - " + actions.get(end == actions.size() ? end - 1 : end) + ")") : ""});
|
||||
}
|
||||
ActionLocalData localData = new ActionLocalData(switchParts, secondPassData, insideDoInitAction, registerNames, variables, functions, graph.getUninitializedClassTraits());
|
||||
ActionLocalData localData = new ActionLocalData(switchParts, secondPassData, insideDoInitAction, registerNames, variables, functions, graph.getUninitializedClassTraits(), usedDeobfuscations);
|
||||
localData.lineStartAction = lineStartActionRef.getVal();
|
||||
int ip = start;
|
||||
boolean isWhile = false;
|
||||
@@ -1313,10 +1322,10 @@ public abstract class Action implements GraphSourceItem {
|
||||
}
|
||||
int startIp = adr2ip(actions, endAddr);
|
||||
try {
|
||||
out = ActionGraph.translateViaGraph(graph.doesNeedUninitializedClassFieldsDetection(), graph.getUninitializedClassTraits(), null, insideDoInitAction, true, regNames, variables2, functions, actions.subList(0, adr2ip(actions, endAddr + size)), version, staticOperation, path + (cntName == null ? "" : "/" + cntName), charset, startIp);
|
||||
out = ActionGraph.translateViaGraph(usedDeobfuscations, graph.doesNeedUninitializedClassFieldsDetection(), graph.getUninitializedClassTraits(), null, insideDoInitAction, true, regNames, variables2, functions, actions.subList(0, adr2ip(actions, endAddr + size)), version, staticOperation, path + (cntName == null ? "" : "/" + cntName), charset, startIp);
|
||||
} catch (SecondPassException spe) {
|
||||
variables2 = prepareVariables(cnt, variables);
|
||||
out = ActionGraph.translateViaGraph(graph.doesNeedUninitializedClassFieldsDetection(), graph.getUninitializedClassTraits(), spe.getData(), insideDoInitAction, true, regNames, variables2, functions, actions.subList(0, adr2ip(actions, endAddr + size)), version, staticOperation, path + (cntName == null ? "" : "/" + cntName), charset, startIp);
|
||||
out = ActionGraph.translateViaGraph(usedDeobfuscations, graph.doesNeedUninitializedClassFieldsDetection(), graph.getUninitializedClassTraits(), spe.getData(), insideDoInitAction, true, regNames, variables2, functions, actions.subList(0, adr2ip(actions, endAddr + size)), version, staticOperation, path + (cntName == null ? "" : "/" + cntName), charset, startIp);
|
||||
}
|
||||
} catch (OutOfMemoryError | TranslateException | StackOverflowError ex) {
|
||||
logger.log(Level.SEVERE, "Decompilation error in: " + path, ex);
|
||||
|
||||
@@ -226,6 +226,7 @@ public class ActionGraph extends Graph {
|
||||
/**
|
||||
* Translates via Graph - decompiles.
|
||||
*
|
||||
* @param usedDeobfuscations Used deobfuscations
|
||||
* @param needsUninitializedClassFieldsDetection Needs uninitialized class fields detection
|
||||
* @param uninitializedClassTraits Uninitialized class traits
|
||||
* @param secondPassData Second pass data
|
||||
@@ -242,9 +243,9 @@ public class ActionGraph extends Graph {
|
||||
* @return List of graph target items
|
||||
* @throws InterruptedException On interrupt
|
||||
*/
|
||||
public static List<GraphTargetItem> translateViaGraph(boolean needsUninitializedClassFieldsDetection, Map<String, Map<String, Trait>> uninitializedClassTraits, SecondPassData secondPassData, boolean insideDoInitAction, boolean insideFunction, HashMap<Integer, String> registerNames, HashMap<String, GraphTargetItem> variables, HashMap<String, GraphTargetItem> functions, List<Action> code, int version, int staticOperation, String path, String charset, int startIp) throws InterruptedException {
|
||||
public static List<GraphTargetItem> translateViaGraph(Set<String> usedDeobfuscations, boolean needsUninitializedClassFieldsDetection, Map<String, Map<String, Trait>> uninitializedClassTraits, SecondPassData secondPassData, boolean insideDoInitAction, boolean insideFunction, HashMap<Integer, String> registerNames, HashMap<String, GraphTargetItem> variables, HashMap<String, GraphTargetItem> functions, List<Action> code, int version, int staticOperation, String path, String charset, int startIp) throws InterruptedException {
|
||||
ActionGraph g = new ActionGraph(needsUninitializedClassFieldsDetection, uninitializedClassTraits, path, insideDoInitAction, insideFunction, code, registerNames, variables, functions, version, charset, startIp);
|
||||
ActionLocalData localData = new ActionLocalData(secondPassData, insideDoInitAction, registerNames, uninitializedClassTraits);
|
||||
ActionLocalData localData = new ActionLocalData(secondPassData, insideDoInitAction, registerNames, uninitializedClassTraits, usedDeobfuscations);
|
||||
g.init(localData);
|
||||
return g.translate(localData, staticOperation, path);
|
||||
}
|
||||
|
||||
@@ -213,7 +213,7 @@ public class ActionGraphSource extends GraphSource {
|
||||
public void translatePart(List<GraphTargetItem> output, Graph graph, GraphPart part, BaseLocalData localData, TranslateStack stack, int start, int end, int staticOperation, String path) throws InterruptedException, GraphPartChangeException {
|
||||
Reference<GraphSourceItem> fi = new Reference<>(localData.lineStartInstruction);
|
||||
|
||||
Action.actionsPartToTree(output, (ActionGraph) graph, localData.allSwitchParts, localData.secondPassData, this.insideDoInitAction, fi, registerNames, variables, functions, stack, actions, start, end, version, staticOperation, path, charset);
|
||||
Action.actionsPartToTree(localData.usedDeobfuscations, output, (ActionGraph) graph, localData.allSwitchParts, localData.secondPassData, this.insideDoInitAction, fi, registerNames, variables, functions, stack, actions, start, end, version, staticOperation, path, charset);
|
||||
localData.lineStartInstruction = fi.getVal();
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -38,6 +38,7 @@ import com.jpexs.decompiler.graph.GraphTargetItem;
|
||||
import com.jpexs.decompiler.graph.TranslateStack;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -53,7 +54,7 @@ public class ActionIncorrectClassHeaderRemover extends SWFDecompilerAdapter {
|
||||
public void actionListParsed(ActionList actions, SWF swf) throws InterruptedException {
|
||||
FastActionList list = new FastActionList(actions);
|
||||
int ip = 0;
|
||||
BaseLocalData ld = new ActionLocalData(null, true, new HashMap<>());
|
||||
BaseLocalData ld = new ActionLocalData(null, true, new HashMap<>(), new LinkedHashSet<>());
|
||||
TranslateStack stack = new TranslateStack("");
|
||||
List<GraphTargetItem> output = new ArrayList<>();
|
||||
FastActionListIterator iterator = list.iterator();
|
||||
|
||||
@@ -71,13 +71,14 @@ public class ActionLocalData extends BaseLocalData {
|
||||
* @param insideDoInitAction Is inside doInitAction
|
||||
* @param uninitializedClassTraits Uninitialized class traits
|
||||
*/
|
||||
public ActionLocalData(SecondPassData secondPassData, boolean insideDoInitAction, Map<String, Map<String, Trait>> uninitializedClassTraits) {
|
||||
public ActionLocalData(SecondPassData secondPassData, boolean insideDoInitAction, Map<String, Map<String, Trait>> uninitializedClassTraits, Set<String> usedDeobfuscations) {
|
||||
this.secondPassData = secondPassData;
|
||||
regNames = new HashMap<>();
|
||||
variables = new HashMap<>();
|
||||
functions = new HashMap<>();
|
||||
this.insideDoInitAction = insideDoInitAction;
|
||||
this.uninitializedClassTraits = uninitializedClassTraits;
|
||||
this.usedDeobfuscations = usedDeobfuscations;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -88,13 +89,14 @@ public class ActionLocalData extends BaseLocalData {
|
||||
* @param regNames Register names
|
||||
* @param uninitializedClassTraits Uninitialized class traits
|
||||
*/
|
||||
public ActionLocalData(SecondPassData secondPassData, boolean insideDoInitAction, HashMap<Integer, String> regNames, Map<String, Map<String, Trait>> uninitializedClassTraits) {
|
||||
public ActionLocalData(SecondPassData secondPassData, boolean insideDoInitAction, HashMap<Integer, String> regNames, Map<String, Map<String, Trait>> uninitializedClassTraits, Set<String> usedDeobfuscations) {
|
||||
this.regNames = regNames;
|
||||
this.secondPassData = secondPassData;
|
||||
variables = new HashMap<>();
|
||||
functions = new HashMap<>();
|
||||
this.insideDoInitAction = insideDoInitAction;
|
||||
this.uninitializedClassTraits = uninitializedClassTraits;
|
||||
this.usedDeobfuscations = usedDeobfuscations;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -108,7 +110,7 @@ public class ActionLocalData extends BaseLocalData {
|
||||
* @param functions Functions
|
||||
* @param uninitializedClassTraits Uninitialized class traits
|
||||
*/
|
||||
public ActionLocalData(Set<GraphPart> switchParts, SecondPassData secondPassData, boolean insideDoInitAction, HashMap<Integer, String> regNames, HashMap<String, GraphTargetItem> variables, HashMap<String, GraphTargetItem> functions, Map<String, Map<String, Trait>> uninitializedClassTraits) {
|
||||
public ActionLocalData(Set<GraphPart> switchParts, SecondPassData secondPassData, boolean insideDoInitAction, HashMap<Integer, String> regNames, HashMap<String, GraphTargetItem> variables, HashMap<String, GraphTargetItem> functions, Map<String, Map<String, Trait>> uninitializedClassTraits, Set<String> usedDeobfuscations) {
|
||||
this.allSwitchParts = switchParts;
|
||||
this.regNames = regNames;
|
||||
this.variables = variables;
|
||||
@@ -116,5 +118,6 @@ public class ActionLocalData extends BaseLocalData {
|
||||
this.insideDoInitAction = insideDoInitAction;
|
||||
this.secondPassData = secondPassData;
|
||||
this.uninitializedClassTraits = uninitializedClassTraits;
|
||||
this.usedDeobfuscations = usedDeobfuscations;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ package com.jpexs.decompiler.flash.action;
|
||||
import com.jpexs.decompiler.flash.SWF;
|
||||
import com.jpexs.decompiler.flash.action.model.ConstantPool;
|
||||
import com.jpexs.decompiler.graph.TranslateStack;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* Store type action interface.
|
||||
@@ -30,10 +31,11 @@ public interface StoreTypeAction {
|
||||
/**
|
||||
* Gets variable name.
|
||||
*
|
||||
* @param usedDeobfuscations Used deobufscations
|
||||
* @param stack Stack
|
||||
* @param cpool Constant pool
|
||||
* @param swf SWF
|
||||
* @return Variable name
|
||||
*/
|
||||
public String getVariableName(TranslateStack stack, ConstantPool cpool, SWF swf);
|
||||
public String getVariableName(Set<String> usedDeobfuscations, TranslateStack stack, ConstantPool cpool, SWF swf);
|
||||
}
|
||||
|
||||
+2
-1
@@ -43,6 +43,7 @@ import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
@@ -71,7 +72,7 @@ public class UninitializedClassFieldsDetector {
|
||||
DoInitActionTag doi = (DoInitActionTag) asm;
|
||||
String exportName = doi.getSwf().getExportName(doi.spriteId);
|
||||
if (exportName != null) {
|
||||
asmPath = DottedChain.parseNoSuffix(exportName).toPrintableString(doi.getSwf(), false);
|
||||
asmPath = DottedChain.parseNoSuffix(exportName).toPrintableString(new LinkedHashSet<>(), doi.getSwf(), false);
|
||||
}
|
||||
}
|
||||
for (ProgressListener listener : progressListeners) {
|
||||
|
||||
+2
-1
@@ -29,6 +29,7 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* FSCommand2 action - file system command.
|
||||
@@ -51,7 +52,7 @@ public class ActionFSCommand2 extends Action {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void translate(Map<String, Map<String, Trait>> uninitializedClassTraits, SecondPassData secondPassData, boolean insideDoInitAction, GraphSourceItem lineStartItem, TranslateStack stack, List<GraphTargetItem> output, HashMap<Integer, String> regNames, HashMap<String, GraphTargetItem> variables, HashMap<String, GraphTargetItem> functions, int staticOperation, String path) {
|
||||
public void translate(Set<String> usedDeobfuscations, Map<String, Map<String, Trait>> uninitializedClassTraits, SecondPassData secondPassData, boolean insideDoInitAction, GraphSourceItem lineStartItem, TranslateStack stack, List<GraphTargetItem> output, HashMap<Integer, String> regNames, HashMap<String, GraphTargetItem> variables, HashMap<String, GraphTargetItem> functions, int staticOperation, String path) {
|
||||
long numArgs = popLong(stack);
|
||||
List<GraphTargetItem> args = new ArrayList<>();
|
||||
for (long l = 0; l < numArgs; l++) {
|
||||
|
||||
+2
-1
@@ -33,6 +33,7 @@ import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* StrictMode action - set strict mode.
|
||||
@@ -104,7 +105,7 @@ public class ActionStrictMode extends Action {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void translate(Map<String, Map<String, Trait>> uninitializedClassTraits, SecondPassData secondPassData, boolean insideDoInitAction, GraphSourceItem lineStartItem, TranslateStack stack, List<GraphTargetItem> output, HashMap<Integer, String> regNames, HashMap<String, GraphTargetItem> variables, HashMap<String, GraphTargetItem> functions, int staticOperation, String path) {
|
||||
public void translate(Set<String> usedDeobfuscations, Map<String, Map<String, Trait>> uninitializedClassTraits, SecondPassData secondPassData, boolean insideDoInitAction, GraphSourceItem lineStartItem, TranslateStack stack, List<GraphTargetItem> output, HashMap<Integer, String> regNames, HashMap<String, GraphTargetItem> variables, HashMap<String, GraphTargetItem> functions, int staticOperation, String path) {
|
||||
if (mode != 1) {
|
||||
return;
|
||||
}
|
||||
|
||||
+3
-3
@@ -142,7 +142,7 @@ public class DirectValueActionItem extends ActionItem implements SimpleValue {
|
||||
}
|
||||
|
||||
if (value instanceof RegisterNumber) {
|
||||
return IdentifiersDeobfuscation.printIdentifier(localData.swf, false, ((RegisterNumber) value).translate());
|
||||
return IdentifiersDeobfuscation.printIdentifier(localData.swf, localData.usedDeobfuscations, false, ((RegisterNumber) value).translate());
|
||||
}
|
||||
|
||||
return value.toString();
|
||||
@@ -164,7 +164,7 @@ public class DirectValueActionItem extends ActionItem implements SimpleValue {
|
||||
}
|
||||
|
||||
if (value instanceof RegisterNumber) {
|
||||
return writer.append(IdentifiersDeobfuscation.printIdentifier(localData.swf, false, ((RegisterNumber) value).translate()));
|
||||
return writer.append(IdentifiersDeobfuscation.printIdentifier(localData.swf, localData.usedDeobfuscations, false, ((RegisterNumber) value).translate()));
|
||||
}
|
||||
|
||||
return writer.append(value.toString());
|
||||
@@ -197,7 +197,7 @@ public class DirectValueActionItem extends ActionItem implements SimpleValue {
|
||||
srcData.localName = ((RegisterNumber) value).translate();
|
||||
srcData.regIndex = ((RegisterNumber) value).number;
|
||||
|
||||
return writer.appendWithData(IdentifiersDeobfuscation.printIdentifier(localData.swf, false, ((RegisterNumber) value).translate()), srcData);
|
||||
return writer.appendWithData(IdentifiersDeobfuscation.printIdentifier(localData.swf, localData.usedDeobfuscations, false, ((RegisterNumber) value).translate()), srcData);
|
||||
}
|
||||
return writer.append(EcmaScript.toString(value));
|
||||
}
|
||||
|
||||
+1
-1
@@ -82,7 +82,7 @@ public class GetMemberActionItem extends ActionItem {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
StringBuilderTextWriter sbw = new StringBuilderTextWriter(new CodeFormatting(), sb);
|
||||
stripQuotes(memberName, localData, sbw);
|
||||
writer.append(IdentifiersDeobfuscation.printIdentifier(localData.swf, false, sb.toString()));
|
||||
writer.append(IdentifiersDeobfuscation.printIdentifier(localData.swf, localData.usedDeobfuscations, false, sb.toString()));
|
||||
return writer;
|
||||
}
|
||||
if (((!(memberName instanceof DirectValueActionItem)) || (!((DirectValueActionItem) memberName).isString()) || (!printObfuscatedMemberName && !IdentifiersDeobfuscation.isValidName(false, ((DirectValueActionItem) memberName).toStringNoQuotes(localData))))) {
|
||||
|
||||
+1
-1
@@ -102,7 +102,7 @@ public class GetVariableActionItem extends ActionItem {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
StringBuilderTextWriter sbw = new StringBuilderTextWriter(new CodeFormatting(), sb);
|
||||
stripQuotes(name, localData, sbw);
|
||||
writer.append(IdentifiersDeobfuscation.printIdentifier(localData.swf, false, sb.toString()));
|
||||
writer.append(IdentifiersDeobfuscation.printIdentifier(localData.swf, localData.usedDeobfuscations, false, sb.toString()));
|
||||
return writer;
|
||||
}
|
||||
if ((name instanceof DirectValueActionItem) && (((DirectValueActionItem) name).isString()) && (printObfuscatedName || IdentifiersDeobfuscation.isValidNameWithDot(false, ((DirectValueActionItem) name).toStringNoQuotes(localData), "this", "super"))) {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user