action deobfuscator improved again

This commit is contained in:
honfika@gmail.com
2015-09-25 21:37:54 +02:00
parent 54093acab5
commit c878297f20
2 changed files with 17 additions and 14 deletions

View File

@@ -169,11 +169,10 @@ public class ActionDeobfuscator extends ActionDeobfuscatorSimple {
if (result.constantPool != null) {
newIstructionCount++;
}
if (!result.stack.isEmpty()) {
newIstructionCount++;
}
newIstructionCount += 2 * result.variables.size();
newIstructionCount += result.stack.size();
newIstructionCount += 3 * result.variables.size(); /* 2x Push + Set or Define */
boolean allValueValid = true;
for (Object value : result.variables.values()) {
@@ -308,7 +307,8 @@ public class ActionDeobfuscator extends ActionDeobfuscatorSimple {
}
String variableName = variableNameObj.getResult().toString();
if (!localData.variables.containsKey(variableName) && !allowGetUninitializedVariables) {
if (!localData.variables.containsKey(variableName)
&& (!allowGetUninitializedVariables || !isFakeName(variableName))) {
break;
}
}
@@ -486,16 +486,8 @@ public class ActionDeobfuscator extends ActionDeobfuscatorSimple {
if (action instanceof ActionDefineFunction) {
ActionDefineFunction def = (ActionDefineFunction) action;
if (def.paramNames.isEmpty()) {
boolean isFakeName = true;
for (char ch : def.functionName.toCharArray()) {
if (ch > 31) {
isFakeName = false;
break;
}
}
// remove funcion only when the function name contains only non printable characters
if (!isFakeName) {
if (!isFakeName(def.functionName)) {
continue;
}

View File

@@ -259,6 +259,17 @@ public class ActionDeobfuscatorSimple implements SWFDecompilerListener {
return result;
}
protected boolean isFakeName(String name) {
boolean isFakeName = true;
for (char ch : name.toCharArray()) {
if (ch > 31) {
return false;
}
}
return true;
}
private void executeActions(ActionList actions, int idx, int endIdx, ExecutionResult result) throws InterruptedException {
List<GraphTargetItem> output = new ArrayList<>();
ActionLocalData localData = new ActionLocalData();