Detect V3.5

This commit is contained in:
de4dot 2012-01-24 01:01:30 +01:00
parent d59fa86515
commit 88c8dcbb7a

View File

@ -136,6 +136,8 @@ namespace de4dot.code.deobfuscators.DeepSea {
string detectVersion() {
switch (stringDecrypter.Version) {
case StringDecrypter.DecrypterVersion.V1_3:
if (detectMethodProxyObfuscation())
return DeobfuscatorInfo.THE_NAME + " 3.5";
return DeobfuscatorInfo.THE_NAME + " 1.x-3.x";
case StringDecrypter.DecrypterVersion.V4:
return DeobfuscatorInfo.THE_NAME + " 4.x";
@ -144,6 +146,27 @@ namespace de4dot.code.deobfuscators.DeepSea {
return DeobfuscatorInfo.THE_NAME;
}
bool detectMethodProxyObfuscation() {
const int MIN_FOUND_PROXIES = 20;
int foundProxies = 0, checkedMethods = 0;
foreach (var type in module.GetTypes()) {
foreach (var method in type.Methods) {
if (foundProxies >= MIN_FOUND_PROXIES)
goto done;
if (!method.IsStatic || method.Body == null)
continue;
if (checkedMethods++ >= 1000)
goto done;
if (!DeepSea.MethodCallInliner.canInline(method))
continue;
foundProxies++;
}
}
done:
return foundProxies >= MIN_FOUND_PROXIES;
}
public override void deobfuscateBegin() {
base.deobfuscateBegin();