Better AS1/2 deobfuscation

This commit is contained in:
Jindra Pet��k
2013-04-01 16:52:05 +02:00
parent ca6725838c
commit 381c1707ff
18 changed files with 610 additions and 298 deletions
@@ -61,6 +61,33 @@ public class DirectValueTreeItem extends TreeItem {
if (value instanceof Boolean) {
return ((Boolean) value) ? 1 : 0;
}
if (value instanceof String) {
String s=(String) value;
if(s.length()==1){
return s.charAt(0);
}
double ret=0.0;
try{
ret=Double.parseDouble(s);
}catch(NumberFormatException nex){
}
return ret;
}
if (value instanceof ConstantIndex) {
String s=(this.constants.get(((ConstantIndex) value).index));
if(s.length()==1){
return s.charAt(0);
}
double ret=0.0;
try{
ret=Double.parseDouble(s);
}catch(NumberFormatException nex){
}
return ret;
}
return super.toNumber();
}
@@ -81,6 +108,20 @@ public class DirectValueTreeItem extends TreeItem {
if (value instanceof Long) {
return ((Long) value) != 0;
}
if (value instanceof String) {
String s=(String) value;
if(s.length()==1){
return toNumber()==0;
}
return !s.equals("");
}
if (value instanceof ConstantIndex) {
String s=(this.constants.get(((ConstantIndex) value).index));
if(s.length()==1){
return toNumber()==0;
}
return !s.equals("");
}
return false;
}
@@ -148,6 +189,9 @@ public class DirectValueTreeItem extends TreeItem {
@Override
public boolean isCompileTime() {
return (value instanceof Double) || (value instanceof Float) || (value instanceof Boolean) || (value instanceof Long) || (value instanceof Null) || (computedRegValue != null && computedRegValue.isCompileTime());
return (value instanceof Double) || (value instanceof Float) || (value instanceof Boolean) || (value instanceof Long) || (value instanceof Null) || (computedRegValue != null && computedRegValue.isCompileTime())
//||(value instanceof String) || (value instanceof ConstantIndex)
;
}
}