AS1/2 deobfuscation fixes

This commit is contained in:
Jindra Petřík
2016-02-20 01:00:47 +01:00
parent fed7439d18
commit 9c8583957c
5 changed files with 17 additions and 13 deletions
@@ -466,9 +466,9 @@ public class ActionDeobfuscator extends SWFDecompilerAdapter {
Action action = item.action;
/*System.out.print(action.getASMSource(actions, new ArrayList<Long>(), ScriptExportMode.PCODE));
for (int j = 0; j < stack.size(); j++) {
for (int j = 0; j < stack.size(); j++) {
System.out.print(" '" + stack.get(j).getResult() + "'");
}
}
System.out.println();*/
if (action instanceof ActionConstantPool) {
lastConstantPool = (ActionConstantPool) action;
@@ -98,18 +98,12 @@ public class GetVariableActionItem extends ActionItem {
@Override
public boolean isCompileTime(Set<GraphTargetItem> dependencies) {
if (computedValue == null) {
return false;
}
return computedCompiletime;
return false; //?
}
@Override
public Object getResult() {
if (computedValue == null) {
return Undefined.INSTANCE;
}
return computedResult;
return null;
}
public void setComputedValue(GraphTargetItem computedValue) {
@@ -47,12 +47,13 @@ public class ActionDelete extends Action {
@Override
public boolean execute(LocalDataArea lda) {
String memberName = lda.popAsString();
/* String memberName = lda.popAsString();
Object o = lda.pop();
if (o instanceof ActionScriptObject) {
((ActionScriptObject) o).setMember(memberName, Undefined.INSTANCE);
}
return true;
return true;*/
return false;
}
@Override
@@ -62,8 +62,9 @@ public class ActionNewObject extends Action {
}
ActionScriptObject obj = new ActionScriptObject();
//TODO:check type
ActionScriptFunction constructor = (ActionScriptFunction) lda.stage.getMember(objectName);
/*ActionScriptFunction constructor = (ActionScriptFunction) lda.stage.getMember(objectName);
lda.stage.callFunction(constructor.getFunctionOffset(), constructor.getFunctionLength(), args, constructor.getFuncRegNames(), obj);
*/
lda.stack.push(obj);
return true;
}
@@ -45,9 +45,13 @@ public class EcmaScript {
if (o instanceof Boolean) {
return (Boolean) o ? 1.0 : 0.0;
}
if (o instanceof Float) {
o = (double) (float) (Float) o;
}
if (o instanceof Double) {
return (Double) o;
}
if (o instanceof Long) {
return (double) (long) (Long) o;
}
@@ -397,6 +401,10 @@ public class EcmaScript {
if (o instanceof Integer) {
return ((Integer) o) != 0;
}
if (o instanceof Float) {
o = (double) (float) (Float) o;
}
if (o instanceof Double) {
Double d = (Double) o;
if (d.isNaN()) {