Skip to content
Permalink
Browse files

removed some unnecessary parameters + small fixes

  • Loading branch information
honfika committed Oct 21, 2015
1 parent a093b25 commit 099bffdf68f1b5141dd1fea86d1fd220e9657d74
Showing with 270 additions and 158 deletions.
  1. +13 −0 examples/DeobfuscatorSample.java
  2. +26 −0 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/IdentifiersDeobfuscation.java
  3. +18 −6 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/AVM2LocalData.java
  4. +3 −2 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/ScriptPack.java
  5. +22 −24 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/AVM2Code.java
  6. +2 −4 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/deobfuscation/AVM2DeobfuscatorJumps.java
  7. +4 −4 ...rc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/deobfuscation/AVM2DeobfuscatorRegisters.java
  8. +6 −8 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/deobfuscation/AVM2DeobfuscatorSimple.java
  9. +0 −2 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/graph/AVM2Graph.java
  10. +1 −1 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/graph/AVM2GraphSource.java
  11. +1 −4 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/InstructionDefinition.java
  12. +3 −3 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/construction/ConstructIns.java
  13. +2 −2 ...ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/construction/ConstructPropIns.java
  14. +2 −2 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/construction/NewClassIns.java
  15. +1 −1 ...c/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/construction/NewFunctionIns.java
  16. +1 −1 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/executing/CallMethodIns.java
  17. +1 −1 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/executing/CallPropLexIns.java
  18. +1 −1 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/executing/CallPropVoidIns.java
  19. +1 −1 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/executing/CallPropertyIns.java
  20. +1 −1 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/executing/CallStaticIns.java
  21. +1 −1 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/executing/CallSuperIns.java
  22. +1 −1 ...rc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/executing/CallSuperVoidIns.java
  23. +3 −3 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/localregs/GetLocalTypeIns.java
  24. +1 −1 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/DeletePropertyIns.java
  25. +1 −1 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/FindDefIns.java
  26. +1 −1 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/FindPropertyIns.java
  27. +1 −1 ...c/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/FindPropertyStrictIns.java
  28. +1 −1 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/GetDescendantsIns.java
  29. +1 −1 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/GetGlobalScopeIns.java
  30. +1 −1 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/GetGlobalSlotIns.java
  31. +1 −1 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/GetLexIns.java
  32. +1 −1 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/GetPropertyIns.java
  33. +2 −2 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/GetSlotIns.java
  34. +1 −1 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/GetSuperIns.java
  35. +1 −1 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/InitPropertyIns.java
  36. +1 −1 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/SetPropertyIns.java
  37. +3 −3 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/SetSlotIns.java
  38. +1 −1 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/other/SetSuperIns.java
  39. +1 −1 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushDoubleIns.java
  40. +1 −1 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushIntIns.java
  41. +1 −1 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushStringIns.java
  42. +1 −1 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/stack/PushUIntIns.java
  43. +1 −1 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/CoerceAIns.java
  44. +1 −1 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/CoerceIns.java
  45. +1 −1 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/CoerceSIns.java
  46. +1 −1 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ConvertBIns.java
  47. +1 −1 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ConvertDIns.java
  48. +1 −1 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ConvertIIns.java
  49. +1 −1 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ConvertOIns.java
  50. +1 −1 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ConvertSIns.java
  51. +1 −1 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/types/ConvertUIns.java
  52. +1 −1 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/instructions/xml/DXNSIns.java
  53. +5 −13 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/avm2/model/NewFunctionAVM2Item.java
  54. +14 −14 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/MethodBody.java
  55. +6 −6 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/traits/TraitClass.java
  56. +3 −3 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/traits/TraitFunction.java
  57. +3 −3 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/abc/types/traits/TraitMethodGetterSetter.java
  58. +10 −1 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/Action.java
  59. +5 −0 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/deobfuscation/ActionDeobfuscatorSimple.java
  60. +5 −0 ...c/ffdec_lib/src/com/jpexs/decompiler/flash/action/deobfuscation/ActionDeobfuscatorSimpleFast.java
  61. +2 −2 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/DirectValueActionItem.java
  62. +1 −1 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/model/GetVariableActionItem.java
  63. +1 −1 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf4/ActionIf.java
  64. +1 −1 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/action/swf4/ActionJump.java
  65. +4 −0 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/helpers/SWFDecompilerListener.java
  66. +52 −1 libsrc/ffdec_lib/src/com/jpexs/decompiler/flash/helpers/SWFDecompilerPlugin.java
  67. +1 −1 libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/ActionScript3DeobfuscatorTest.java
  68. +2 −2 libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/ActionScript3Test.java
  69. +2 −2 libsrc/ffdec_lib/test/com/jpexs/decompiler/flash/generators/AS3Generator.java
  70. +7 −2 src/com/jpexs/decompiler/flash/gui/tagtree/TagTreeContextMenu.java
@@ -2,9 +2,12 @@
import com.jpexs.decompiler.flash.SWF;
import com.jpexs.decompiler.flash.abc.ABC;
import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.traits.Trait;
import com.jpexs.decompiler.flash.action.ActionList;
import com.jpexs.decompiler.flash.helpers.SWFDecompilerListener;
import com.jpexs.decompiler.flash.tags.base.ASMSource;
import com.jpexs.decompiler.graph.GraphTargetItem;
import java.util.List;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -22,6 +25,11 @@ public void actionListParsed(ActionList actions, SWF swf) {
System.out.println("actionListParsed");
}

@Override
public void actionTreeCreated(List<GraphTargetItem> tree, SWF swf) {
System.out.println("actionTreeCreated");
}

@Override
public void swfParsed(SWF swf) {
System.out.println("swfParsed");
@@ -44,4 +52,9 @@ public void abcParsed(ABC abc, SWF swf) {
public void methodBodyParsed(MethodBody body, SWF swf) {
System.out.println("methodBodyParsed");
}

@Override
public void avm2CodeRemoveTraps(String path, int classIndex, boolean isStatic, int scriptIndex, ABC abc, Trait trait, int methodInfo, MethodBody body) throws InterruptedException {
System.out.println("avm2CodeRemoveTraps");
}
}
@@ -58,6 +58,10 @@

private static final Pattern IDENTIFIER_PATTERN = Pattern.compile("^[" + VALID_FIRST_CHARACTERS + "][" + VALID_NEXT_CHARACTERS + "]*$");

private static final Pattern VALID_NAME_PATTERN_DOT = Pattern.compile("^[a-zA-Z_\\$][a-zA-Z0-9_.\\$]*$");

private static final Pattern IDENTIFIER_PATTERN_DOT = Pattern.compile("^[" + VALID_FIRST_CHARACTERS + "][" + VALID_NEXT_CHARACTERS + ".]*$");

public static final String FOO_CHARACTERS = "bcdfghjklmnpqrstvwz";

public static final String FOO_JOIN_CHARACTERS = "aeiouy";
@@ -228,6 +232,28 @@ public String deobfuscateNameWithPackage(boolean as3, String n, HashMap<DottedCh
return null;
}

public static boolean isValidNameWithDot(boolean as3, String s, String... exceptions) {
for (String e : exceptions) {
if (e.equals(s)) {
return true;
}
}

if (isReservedWord(s, as3)) {
return false;
}

// simple fast test
if (VALID_NAME_PATTERN_DOT.matcher(s).matches()) {
return true;
}
// unicode test
if (IDENTIFIER_PATTERN_DOT.matcher(s).matches()) {
return true;
}
return false;
}

public static boolean isValidName(boolean as3, String s, String... exceptions) {
for (String e : exceptions) {
if (e.equals(s)) {
@@ -20,8 +20,10 @@
import com.jpexs.decompiler.flash.abc.avm2.AVM2Code;
import com.jpexs.decompiler.flash.abc.avm2.AVM2ConstantPool;
import com.jpexs.decompiler.flash.abc.types.ABCException;
import com.jpexs.decompiler.flash.abc.types.InstanceInfo;
import com.jpexs.decompiler.flash.abc.types.MethodBody;
import com.jpexs.decompiler.flash.abc.types.MethodInfo;
import com.jpexs.decompiler.flash.abc.types.ScriptInfo;
import com.jpexs.decompiler.graph.DottedChain;
import com.jpexs.decompiler.graph.GraphTargetItem;
import com.jpexs.decompiler.graph.ScopeStack;
@@ -44,10 +46,6 @@

public ScopeStack scopeStack;

public AVM2ConstantPool constants;

public List<MethodInfo> methodInfo;

public MethodBody methodBody;

public ABC abc;
@@ -83,8 +81,6 @@ public AVM2LocalData(AVM2LocalData localData) {
classIndex = localData.classIndex;
localRegs = localData.localRegs;
scopeStack = localData.scopeStack;
constants = localData.constants;
methodInfo = localData.methodInfo;
methodBody = localData.methodBody;
abc = localData.abc;
localRegNames = localData.localRegNames;
@@ -99,4 +95,20 @@ public AVM2LocalData(AVM2LocalData localData) {
refs = localData.refs;
code = localData.code;
}

public AVM2ConstantPool getConstants() {
return abc.constants;
}

public List<MethodInfo> getMethodInfo() {
return abc.method_info;
}

public List<InstanceInfo> getInstanceInfo() {
return abc.instance_info;
}

public List<ScriptInfo> getScriptInfo() {
return abc.script_info;
}
}
@@ -68,6 +68,7 @@
private final ClassPath path;

public boolean isSimple = false;

public boolean scriptInitializerIsEmpty = false;

@Override
@@ -162,7 +163,7 @@ public void convert(final NulWriter writer, final List<Trait> traits, final Scri
}

writer.mark();
abc.bodies.get(bodyIndex).convert(path +/*packageName +*/ "/.scriptinitializer", exportMode, true, script_init, scriptIndex, -1, abc, null, abc.constants, abc.method_info, new ScopeStack(), GraphTextWriter.TRAIT_SCRIPT_INITIALIZER, writer, new ArrayList<DottedChain>(), ts, true);
abc.bodies.get(bodyIndex).convert(path +/*packageName +*/ "/.scriptinitializer", exportMode, true, script_init, scriptIndex, -1, abc, null, new ScopeStack(), GraphTextWriter.TRAIT_SCRIPT_INITIALIZER, writer, new ArrayList<DottedChain>(), ts, true);
scriptInitializerIsEmpty = !writer.getMark();

}
@@ -190,7 +191,7 @@ private void appendTo(GraphTextWriter writer, List<Trait> traits, ScriptExportMo
writer.startMethod(script_init);
if (!scriptInitializerIsEmpty) {
writer.startBlock();
abc.bodies.get(bodyIndex).toString(path +/*packageName +*/ "/.scriptinitializer", exportMode, abc, null, abc.constants, abc.method_info, writer, new ArrayList<DottedChain>());
abc.bodies.get(bodyIndex).toString(path +/*packageName +*/ "/.scriptinitializer", exportMode, abc, null, writer, new ArrayList<>());
writer.endBlock();
} else {
writer.append(" ");

0 comments on commit 099bffd

Please sign in to comment.
You can’t perform that action at this time.