2012-02-29 05:30:22 +08:00
|
|
|
|
/*
|
2015-10-30 05:45:26 +08:00
|
|
|
|
Copyright (C) 2011-2015 de4dot@gmail.com
|
2012-02-29 05:30:22 +08:00
|
|
|
|
|
|
|
|
|
This file is part of de4dot.
|
|
|
|
|
|
|
|
|
|
de4dot is free software: you can redistribute it and/or modify
|
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
|
|
de4dot is distributed in the hope that it will be useful,
|
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
|
along with de4dot. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
*/
|
|
|
|
|
|
2012-03-19 05:59:34 +08:00
|
|
|
|
using System;
|
2012-02-29 05:30:22 +08:00
|
|
|
|
using System.Collections.Generic;
|
2012-12-20 09:06:09 +08:00
|
|
|
|
using dnlib.DotNet;
|
2012-02-29 05:30:22 +08:00
|
|
|
|
using de4dot.blocks;
|
|
|
|
|
|
|
|
|
|
namespace de4dot.code.deobfuscators.Eazfuscator_NET {
|
|
|
|
|
class VersionDetector {
|
|
|
|
|
StringDecrypter stringDecrypter;
|
2012-03-19 05:59:34 +08:00
|
|
|
|
FrameworkType frameworkType;
|
2012-02-29 05:30:22 +08:00
|
|
|
|
|
2012-11-18 08:09:07 +08:00
|
|
|
|
public VersionDetector(ModuleDefMD module, StringDecrypter stringDecrypter) {
|
2012-02-29 05:30:22 +08:00
|
|
|
|
this.stringDecrypter = stringDecrypter;
|
2013-01-19 20:03:57 +08:00
|
|
|
|
this.frameworkType = DotNetUtils.GetFrameworkType(module);
|
2012-02-29 05:30:22 +08:00
|
|
|
|
}
|
|
|
|
|
|
2013-01-19 20:03:57 +08:00
|
|
|
|
public string Detect() {
|
2012-02-29 05:30:22 +08:00
|
|
|
|
var decryptStringType = stringDecrypter.Type;
|
|
|
|
|
var decryptStringMethod = stringDecrypter.Method;
|
|
|
|
|
if (decryptStringType == null || decryptStringMethod == null)
|
|
|
|
|
return null;
|
|
|
|
|
|
2012-11-02 22:57:11 +08:00
|
|
|
|
var otherMethods = new List<MethodDef>();
|
|
|
|
|
MethodDef cctor = null;
|
2012-02-29 05:30:22 +08:00
|
|
|
|
foreach (var method in decryptStringType.Methods) {
|
|
|
|
|
if (method == decryptStringMethod)
|
|
|
|
|
continue;
|
|
|
|
|
if (method.Name == ".cctor")
|
|
|
|
|
cctor = method;
|
|
|
|
|
else
|
|
|
|
|
otherMethods.Add(method);
|
|
|
|
|
}
|
|
|
|
|
if (cctor == null)
|
|
|
|
|
return null;
|
|
|
|
|
|
2013-01-19 20:03:57 +08:00
|
|
|
|
bool hasConstantM2 = DeobUtils.HasInteger(decryptStringMethod, -2);
|
2012-02-29 05:30:22 +08:00
|
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////
|
|
|
|
|
/////////////////////////////////////////////////////////////////
|
|
|
|
|
/////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
var fields11 = new string[] {
|
|
|
|
|
"System.Collections.Generic.Dictionary`2<System.Int32,System.String>",
|
|
|
|
|
"System.IO.BinaryReader",
|
|
|
|
|
"System.Byte[]",
|
|
|
|
|
"System.Int16",
|
|
|
|
|
"System.Boolean",
|
|
|
|
|
};
|
2013-01-19 20:03:57 +08:00
|
|
|
|
var locals11 = CreateLocalsArray(
|
2012-02-29 05:30:22 +08:00
|
|
|
|
"System.Boolean",
|
|
|
|
|
"System.Byte[]",
|
|
|
|
|
"System.Char[]",
|
|
|
|
|
"System.Int16",
|
|
|
|
|
"System.Int32",
|
|
|
|
|
"System.Reflection.Assembly",
|
2012-03-19 05:59:34 +08:00
|
|
|
|
"System.String"
|
|
|
|
|
);
|
2012-02-29 05:30:22 +08:00
|
|
|
|
if (otherMethods.Count == 0 &&
|
2012-03-06 15:17:55 +08:00
|
|
|
|
decryptStringType.NestedTypes.Count == 0 &&
|
2012-02-29 05:30:22 +08:00
|
|
|
|
!hasConstantM2 &&
|
2012-11-18 08:09:07 +08:00
|
|
|
|
!decryptStringMethod.IsNoInlining &&
|
2012-02-29 05:30:22 +08:00
|
|
|
|
decryptStringMethod.IsPublic &&
|
|
|
|
|
decryptStringMethod.IsSynchronized &&
|
2012-11-18 08:09:07 +08:00
|
|
|
|
decryptStringMethod.Body.MaxStack >= 35 &&
|
|
|
|
|
decryptStringMethod.Body.MaxStack <= 50 &&
|
2012-02-29 05:30:22 +08:00
|
|
|
|
decryptStringMethod.Body.ExceptionHandlers.Count == 0 &&
|
2013-01-19 20:03:57 +08:00
|
|
|
|
new LocalTypes(decryptStringMethod).Exactly(locals11) &&
|
|
|
|
|
CheckTypeFields(fields11)) {
|
2012-02-29 05:30:22 +08:00
|
|
|
|
return "1.1 - 1.2";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////
|
|
|
|
|
/////////////////////////////////////////////////////////////////
|
|
|
|
|
/////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
var fields13 = new string[] {
|
|
|
|
|
"System.Collections.Generic.Dictionary`2<System.Int32,System.String>",
|
|
|
|
|
"System.IO.BinaryReader",
|
|
|
|
|
"System.Byte[]",
|
|
|
|
|
"System.Int16",
|
|
|
|
|
"System.Boolean",
|
|
|
|
|
"System.Byte[]",
|
|
|
|
|
};
|
2013-01-19 20:03:57 +08:00
|
|
|
|
var locals13 = CreateLocalsArray(
|
2012-02-29 05:30:22 +08:00
|
|
|
|
"System.Boolean",
|
|
|
|
|
"System.Byte",
|
|
|
|
|
"System.Byte[]",
|
|
|
|
|
"System.Char[]",
|
|
|
|
|
"System.Int16",
|
|
|
|
|
"System.Int32",
|
|
|
|
|
"System.Reflection.Assembly",
|
2012-03-19 05:59:34 +08:00
|
|
|
|
"System.String"
|
|
|
|
|
);
|
2012-02-29 05:30:22 +08:00
|
|
|
|
if (otherMethods.Count == 0 &&
|
2012-03-06 15:17:55 +08:00
|
|
|
|
decryptStringType.NestedTypes.Count == 0 &&
|
2012-02-29 05:30:22 +08:00
|
|
|
|
!hasConstantM2 &&
|
2012-11-18 08:09:07 +08:00
|
|
|
|
!decryptStringMethod.IsNoInlining &&
|
2012-02-29 05:30:22 +08:00
|
|
|
|
decryptStringMethod.IsPublic &&
|
|
|
|
|
decryptStringMethod.IsSynchronized &&
|
2012-11-18 08:09:07 +08:00
|
|
|
|
decryptStringMethod.Body.MaxStack >= 35 &&
|
|
|
|
|
decryptStringMethod.Body.MaxStack <= 50 &&
|
2012-02-29 05:30:22 +08:00
|
|
|
|
decryptStringMethod.Body.ExceptionHandlers.Count == 0 &&
|
2013-01-19 20:03:57 +08:00
|
|
|
|
new LocalTypes(decryptStringMethod).Exactly(locals13) &&
|
|
|
|
|
CheckTypeFields(fields13)) {
|
2012-02-29 05:30:22 +08:00
|
|
|
|
return "1.3";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////
|
|
|
|
|
/////////////////////////////////////////////////////////////////
|
|
|
|
|
/////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
var fields14 = new string[] {
|
|
|
|
|
"System.Collections.Generic.Dictionary`2<System.Int32,System.String>",
|
|
|
|
|
"System.IO.BinaryReader",
|
|
|
|
|
"System.Byte[]",
|
|
|
|
|
"System.Int16",
|
|
|
|
|
"System.Boolean",
|
|
|
|
|
"System.Byte[]",
|
|
|
|
|
};
|
2013-01-19 20:03:57 +08:00
|
|
|
|
var locals14 = CreateLocalsArray(
|
2012-02-29 05:30:22 +08:00
|
|
|
|
"System.Boolean",
|
|
|
|
|
"System.Byte",
|
|
|
|
|
"System.Byte[]",
|
|
|
|
|
"System.Char[]",
|
|
|
|
|
"System.Int16",
|
|
|
|
|
"System.Int32",
|
|
|
|
|
"System.Reflection.Assembly",
|
2012-03-19 05:59:34 +08:00
|
|
|
|
"System.String"
|
|
|
|
|
);
|
2012-02-29 05:30:22 +08:00
|
|
|
|
if (otherMethods.Count == 0 &&
|
2012-03-06 15:17:55 +08:00
|
|
|
|
decryptStringType.NestedTypes.Count == 0 &&
|
2012-02-29 05:30:22 +08:00
|
|
|
|
!hasConstantM2 &&
|
2012-11-18 08:09:07 +08:00
|
|
|
|
!decryptStringMethod.IsNoInlining &&
|
2012-02-29 05:30:22 +08:00
|
|
|
|
decryptStringMethod.IsPublic &&
|
|
|
|
|
decryptStringMethod.IsSynchronized &&
|
2012-11-18 08:09:07 +08:00
|
|
|
|
decryptStringMethod.Body.MaxStack >= 150 &&
|
|
|
|
|
decryptStringMethod.Body.MaxStack <= 200 &&
|
2012-02-29 05:30:22 +08:00
|
|
|
|
decryptStringMethod.Body.ExceptionHandlers.Count == 0 &&
|
2013-01-19 20:03:57 +08:00
|
|
|
|
new LocalTypes(decryptStringMethod).Exactly(locals14) &&
|
|
|
|
|
CheckTypeFields(fields14)) {
|
2012-02-29 05:30:22 +08:00
|
|
|
|
return "1.4 - 2.3";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////
|
|
|
|
|
/////////////////////////////////////////////////////////////////
|
|
|
|
|
/////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
var fields24 = new string[] {
|
|
|
|
|
"System.Collections.Generic.Dictionary`2<System.Int32,System.String>",
|
|
|
|
|
"System.IO.BinaryReader",
|
|
|
|
|
"System.Byte[]",
|
|
|
|
|
"System.Int16",
|
|
|
|
|
"System.Boolean",
|
|
|
|
|
"System.Byte[]",
|
|
|
|
|
};
|
2013-01-19 20:03:57 +08:00
|
|
|
|
var locals24 = CreateLocalsArray(
|
2012-02-29 05:30:22 +08:00
|
|
|
|
"System.Boolean",
|
|
|
|
|
"System.Byte",
|
|
|
|
|
"System.Byte[]",
|
|
|
|
|
"System.Char[]",
|
|
|
|
|
"System.Int16",
|
|
|
|
|
"System.Int32",
|
|
|
|
|
"System.Reflection.Assembly",
|
|
|
|
|
"System.Reflection.AssemblyName",
|
2012-03-19 05:59:34 +08:00
|
|
|
|
"System.String"
|
|
|
|
|
);
|
2012-02-29 05:30:22 +08:00
|
|
|
|
if (otherMethods.Count == 0 &&
|
2012-03-06 15:17:55 +08:00
|
|
|
|
decryptStringType.NestedTypes.Count == 0 &&
|
2012-02-29 05:30:22 +08:00
|
|
|
|
!hasConstantM2 &&
|
2012-11-18 08:09:07 +08:00
|
|
|
|
!decryptStringMethod.IsNoInlining &&
|
2012-02-29 05:30:22 +08:00
|
|
|
|
decryptStringMethod.IsPublic &&
|
|
|
|
|
decryptStringMethod.IsSynchronized &&
|
2012-11-18 08:09:07 +08:00
|
|
|
|
decryptStringMethod.Body.MaxStack >= 1 &&
|
|
|
|
|
decryptStringMethod.Body.MaxStack <= 8 &&
|
2012-02-29 05:30:22 +08:00
|
|
|
|
decryptStringMethod.Body.ExceptionHandlers.Count == 0 &&
|
2013-01-19 20:03:57 +08:00
|
|
|
|
new LocalTypes(decryptStringMethod).Exactly(locals24) &&
|
|
|
|
|
CheckTypeFields(fields24)) {
|
2012-02-29 05:30:22 +08:00
|
|
|
|
return "2.4 - 2.5";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////
|
|
|
|
|
/////////////////////////////////////////////////////////////////
|
|
|
|
|
/////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
var fields26 = new string[] {
|
|
|
|
|
"System.Collections.Generic.Dictionary`2<System.Int32,System.String>",
|
|
|
|
|
"System.IO.BinaryReader",
|
|
|
|
|
"System.Byte[]",
|
|
|
|
|
"System.Int16",
|
|
|
|
|
"System.Boolean",
|
|
|
|
|
"System.Byte[]",
|
|
|
|
|
};
|
2013-01-19 20:03:57 +08:00
|
|
|
|
var locals26 = CreateLocalsArray(
|
2012-02-29 05:30:22 +08:00
|
|
|
|
"System.Boolean",
|
|
|
|
|
"System.Byte",
|
|
|
|
|
"System.Byte[]",
|
|
|
|
|
"System.Char[]",
|
|
|
|
|
"System.Collections.Generic.Dictionary`2<System.Int32,System.String>",
|
|
|
|
|
"System.Int16",
|
|
|
|
|
"System.Int32",
|
|
|
|
|
"System.Reflection.Assembly",
|
|
|
|
|
"System.Reflection.AssemblyName",
|
2012-03-19 05:59:34 +08:00
|
|
|
|
"System.String"
|
|
|
|
|
);
|
2012-02-29 05:30:22 +08:00
|
|
|
|
if (otherMethods.Count == 0 &&
|
2012-03-06 15:17:55 +08:00
|
|
|
|
decryptStringType.NestedTypes.Count == 0 &&
|
2012-02-29 05:30:22 +08:00
|
|
|
|
!hasConstantM2 &&
|
2012-11-18 08:09:07 +08:00
|
|
|
|
!decryptStringMethod.IsNoInlining &&
|
2012-02-29 05:30:22 +08:00
|
|
|
|
decryptStringMethod.IsPublic &&
|
|
|
|
|
!decryptStringMethod.IsSynchronized &&
|
2012-11-18 08:09:07 +08:00
|
|
|
|
decryptStringMethod.Body.MaxStack >= 1 &&
|
|
|
|
|
decryptStringMethod.Body.MaxStack <= 8 &&
|
2012-02-29 05:30:22 +08:00
|
|
|
|
decryptStringMethod.Body.ExceptionHandlers.Count == 1 &&
|
2013-01-19 20:03:57 +08:00
|
|
|
|
new LocalTypes(decryptStringMethod).Exactly(locals26) &&
|
|
|
|
|
CheckTypeFields(fields26)) {
|
2012-02-29 05:30:22 +08:00
|
|
|
|
return "2.6";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////
|
|
|
|
|
/////////////////////////////////////////////////////////////////
|
|
|
|
|
/////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
var fields27 = new string[] {
|
|
|
|
|
"System.Collections.Generic.Dictionary`2<System.Int32,System.String>",
|
|
|
|
|
"System.IO.BinaryReader",
|
|
|
|
|
"System.Byte[]",
|
|
|
|
|
"System.Int16",
|
|
|
|
|
"System.Boolean",
|
|
|
|
|
"System.Byte[]",
|
|
|
|
|
};
|
2013-01-19 20:03:57 +08:00
|
|
|
|
var locals27 = CreateLocalsArray(
|
2012-02-29 05:30:22 +08:00
|
|
|
|
"System.Boolean",
|
|
|
|
|
"System.Byte",
|
|
|
|
|
"System.Byte[]",
|
|
|
|
|
"System.Char[]",
|
|
|
|
|
"System.Collections.Generic.Dictionary`2<System.Int32,System.String>",
|
|
|
|
|
"System.Int16",
|
|
|
|
|
"System.Int32",
|
|
|
|
|
"System.Reflection.Assembly",
|
|
|
|
|
"System.Reflection.AssemblyName",
|
2012-03-19 05:59:34 +08:00
|
|
|
|
"System.String"
|
|
|
|
|
);
|
2012-02-29 05:30:22 +08:00
|
|
|
|
if (otherMethods.Count == 0 &&
|
2012-03-06 15:17:55 +08:00
|
|
|
|
decryptStringType.NestedTypes.Count == 0 &&
|
2012-02-29 05:30:22 +08:00
|
|
|
|
!hasConstantM2 &&
|
2012-11-18 08:09:07 +08:00
|
|
|
|
decryptStringMethod.IsNoInlining &&
|
2012-02-29 05:30:22 +08:00
|
|
|
|
decryptStringMethod.IsPublic &&
|
|
|
|
|
!decryptStringMethod.IsSynchronized &&
|
2012-11-18 08:09:07 +08:00
|
|
|
|
decryptStringMethod.Body.MaxStack >= 1 &&
|
|
|
|
|
decryptStringMethod.Body.MaxStack <= 8 &&
|
2012-02-29 05:30:22 +08:00
|
|
|
|
decryptStringMethod.Body.ExceptionHandlers.Count == 1 &&
|
2013-01-19 20:03:57 +08:00
|
|
|
|
new LocalTypes(decryptStringMethod).Exactly(locals27) &&
|
|
|
|
|
CheckTypeFields(fields27)) {
|
2012-02-29 05:30:22 +08:00
|
|
|
|
return "2.7";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////
|
|
|
|
|
/////////////////////////////////////////////////////////////////
|
|
|
|
|
/////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
var fields28 = new string[] {
|
|
|
|
|
"System.Collections.Generic.Dictionary`2<System.Int32,System.String>",
|
|
|
|
|
"System.IO.BinaryReader",
|
|
|
|
|
"System.Byte[]",
|
|
|
|
|
"System.Int16",
|
|
|
|
|
"System.Boolean",
|
|
|
|
|
"System.Byte[]",
|
|
|
|
|
"System.Boolean",
|
|
|
|
|
};
|
2013-01-19 20:03:57 +08:00
|
|
|
|
var locals28 = CreateLocalsArray(
|
2012-02-29 05:30:22 +08:00
|
|
|
|
"System.Boolean",
|
|
|
|
|
"System.Byte",
|
|
|
|
|
"System.Byte[]",
|
|
|
|
|
"System.Char[]",
|
|
|
|
|
"System.Collections.Generic.Dictionary`2<System.Int32,System.String>",
|
|
|
|
|
"System.Int16",
|
|
|
|
|
"System.Int32",
|
|
|
|
|
"System.Reflection.Assembly",
|
|
|
|
|
"System.Reflection.AssemblyName",
|
2012-03-19 05:59:34 +08:00
|
|
|
|
"System.String"
|
|
|
|
|
);
|
2012-02-29 05:30:22 +08:00
|
|
|
|
if (otherMethods.Count == 0 &&
|
2012-03-06 15:17:55 +08:00
|
|
|
|
decryptStringType.NestedTypes.Count == 0 &&
|
2012-02-29 05:30:22 +08:00
|
|
|
|
!hasConstantM2 &&
|
2012-11-18 08:09:07 +08:00
|
|
|
|
decryptStringMethod.IsNoInlining &&
|
2012-02-29 05:30:22 +08:00
|
|
|
|
decryptStringMethod.IsAssembly &&
|
|
|
|
|
!decryptStringMethod.IsSynchronized &&
|
2012-11-18 08:09:07 +08:00
|
|
|
|
decryptStringMethod.Body.MaxStack >= 1 &&
|
|
|
|
|
decryptStringMethod.Body.MaxStack <= 8 &&
|
2012-02-29 05:30:22 +08:00
|
|
|
|
decryptStringMethod.Body.ExceptionHandlers.Count == 1 &&
|
2013-01-19 20:03:57 +08:00
|
|
|
|
new LocalTypes(decryptStringMethod).Exactly(locals28) &&
|
|
|
|
|
CheckTypeFields(fields28)) {
|
2012-02-29 05:30:22 +08:00
|
|
|
|
return "2.8";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////
|
|
|
|
|
/////////////////////////////////////////////////////////////////
|
|
|
|
|
/////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
var fields29 = new string[] {
|
|
|
|
|
"System.Collections.Generic.Dictionary`2<System.Int32,System.String>",
|
|
|
|
|
"System.IO.BinaryReader",
|
|
|
|
|
"System.Byte[]",
|
|
|
|
|
"System.Int16",
|
|
|
|
|
"System.Int32",
|
|
|
|
|
"System.Byte[]",
|
|
|
|
|
};
|
2013-01-19 20:03:57 +08:00
|
|
|
|
var locals29 = CreateLocalsArray(
|
2012-02-29 05:30:22 +08:00
|
|
|
|
"System.Boolean",
|
|
|
|
|
"System.Byte",
|
|
|
|
|
"System.Byte[]",
|
|
|
|
|
"System.Char[]",
|
|
|
|
|
"System.Collections.Generic.Dictionary`2<System.Int32,System.String>",
|
|
|
|
|
"System.Diagnostics.StackFrame",
|
|
|
|
|
"System.Diagnostics.StackTrace",
|
|
|
|
|
"System.Int16",
|
|
|
|
|
"System.Int32",
|
|
|
|
|
"System.IO.Stream",
|
|
|
|
|
"System.Reflection.Assembly",
|
|
|
|
|
"System.Reflection.AssemblyName",
|
|
|
|
|
"System.Reflection.MethodBase",
|
|
|
|
|
"System.String",
|
2012-03-19 05:59:34 +08:00
|
|
|
|
"System.Type"
|
|
|
|
|
);
|
2012-02-29 05:30:22 +08:00
|
|
|
|
if (otherMethods.Count == 0 &&
|
2012-03-06 15:17:55 +08:00
|
|
|
|
decryptStringType.NestedTypes.Count == 0 &&
|
2012-02-29 05:30:22 +08:00
|
|
|
|
!hasConstantM2 &&
|
2012-11-18 08:09:07 +08:00
|
|
|
|
decryptStringMethod.IsNoInlining &&
|
2012-02-29 05:30:22 +08:00
|
|
|
|
decryptStringMethod.IsAssembly &&
|
|
|
|
|
!decryptStringMethod.IsSynchronized &&
|
2012-11-18 08:09:07 +08:00
|
|
|
|
decryptStringMethod.Body.MaxStack >= 1 &&
|
|
|
|
|
decryptStringMethod.Body.MaxStack <= 8 &&
|
2012-03-19 05:59:34 +08:00
|
|
|
|
(decryptStringMethod.Body.ExceptionHandlers.Count == 1 || decryptStringMethod.Body.ExceptionHandlers.Count == 2) &&
|
2013-01-19 20:03:57 +08:00
|
|
|
|
new LocalTypes(decryptStringMethod).Exactly(locals29) &&
|
|
|
|
|
CheckTypeFields(fields29)) {
|
2012-02-29 05:30:22 +08:00
|
|
|
|
return "2.9";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////
|
|
|
|
|
/////////////////////////////////////////////////////////////////
|
|
|
|
|
/////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
var fields30 = new string[] {
|
|
|
|
|
"System.Collections.Generic.Dictionary`2<System.Int32,System.String>",
|
|
|
|
|
"System.IO.BinaryReader",
|
|
|
|
|
"System.Byte[]",
|
|
|
|
|
"System.Int16",
|
|
|
|
|
"System.Int32",
|
|
|
|
|
"System.Byte[]",
|
|
|
|
|
};
|
2013-01-19 20:03:57 +08:00
|
|
|
|
var locals30 = CreateLocalsArray(
|
2012-02-29 05:30:22 +08:00
|
|
|
|
"System.Boolean",
|
|
|
|
|
"System.Byte",
|
|
|
|
|
"System.Byte[]",
|
|
|
|
|
"System.Char[]",
|
|
|
|
|
"System.Collections.Generic.Dictionary`2<System.Int32,System.String>",
|
|
|
|
|
"System.Diagnostics.StackFrame",
|
|
|
|
|
"System.Diagnostics.StackTrace",
|
|
|
|
|
"System.Int16",
|
|
|
|
|
"System.Int32",
|
|
|
|
|
"System.IO.Stream",
|
|
|
|
|
"System.Reflection.Assembly",
|
|
|
|
|
"System.Reflection.AssemblyName",
|
|
|
|
|
"System.Reflection.MethodBase",
|
|
|
|
|
"System.String",
|
2012-03-19 05:59:34 +08:00
|
|
|
|
"System.Type"
|
|
|
|
|
);
|
2013-01-19 20:03:57 +08:00
|
|
|
|
var olocals30 = CreateLocalsArray(
|
2012-03-19 05:59:34 +08:00
|
|
|
|
"System.Int32"
|
|
|
|
|
);
|
2012-02-29 05:30:22 +08:00
|
|
|
|
if (otherMethods.Count == 1 &&
|
2012-03-06 15:17:55 +08:00
|
|
|
|
decryptStringType.NestedTypes.Count == 0 &&
|
2013-01-19 20:03:57 +08:00
|
|
|
|
DotNetUtils.IsMethod(otherMethods[0], "System.Int32", "(System.Byte[],System.Int32,System.Byte[])") &&
|
2012-02-29 05:30:22 +08:00
|
|
|
|
otherMethods[0].IsPrivate &&
|
|
|
|
|
otherMethods[0].IsStatic &&
|
2013-01-19 20:03:57 +08:00
|
|
|
|
new LocalTypes(otherMethods[0]).Exactly(olocals30) &&
|
2012-02-29 05:30:22 +08:00
|
|
|
|
!hasConstantM2 &&
|
2012-11-18 08:09:07 +08:00
|
|
|
|
decryptStringMethod.IsNoInlining &&
|
2012-02-29 05:30:22 +08:00
|
|
|
|
decryptStringMethod.IsAssembly &&
|
|
|
|
|
!decryptStringMethod.IsSynchronized &&
|
2012-11-18 08:09:07 +08:00
|
|
|
|
decryptStringMethod.Body.MaxStack >= 1 &&
|
|
|
|
|
decryptStringMethod.Body.MaxStack <= 8 &&
|
2012-03-19 05:59:34 +08:00
|
|
|
|
(decryptStringMethod.Body.ExceptionHandlers.Count == 1 || decryptStringMethod.Body.ExceptionHandlers.Count == 2) &&
|
2013-01-19 20:03:57 +08:00
|
|
|
|
new LocalTypes(decryptStringMethod).Exactly(locals30) &&
|
|
|
|
|
CheckTypeFields(fields30)) {
|
2012-02-29 05:30:22 +08:00
|
|
|
|
return "3.0";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////
|
|
|
|
|
/////////////////////////////////////////////////////////////////
|
|
|
|
|
/////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
var fields31 = new string[] {
|
|
|
|
|
"System.Collections.Generic.Dictionary`2<System.Int32,System.String>",
|
|
|
|
|
"System.IO.BinaryReader",
|
|
|
|
|
"System.Byte[]",
|
|
|
|
|
"System.Int16",
|
|
|
|
|
"System.Int32",
|
|
|
|
|
"System.Byte[]",
|
|
|
|
|
};
|
2013-01-19 20:03:57 +08:00
|
|
|
|
var locals31 = CreateLocalsArray(
|
2012-02-29 05:30:22 +08:00
|
|
|
|
"System.Boolean",
|
|
|
|
|
"System.Byte",
|
|
|
|
|
"System.Byte[]",
|
|
|
|
|
"System.Char[]",
|
|
|
|
|
"System.Collections.Generic.Dictionary`2<System.Int32,System.String>",
|
|
|
|
|
"System.Diagnostics.StackFrame",
|
|
|
|
|
"System.Diagnostics.StackTrace",
|
|
|
|
|
"System.Int16",
|
|
|
|
|
"System.Int32",
|
|
|
|
|
"System.IO.Stream",
|
|
|
|
|
"System.Reflection.Assembly",
|
|
|
|
|
"System.Reflection.AssemblyName",
|
|
|
|
|
"System.Reflection.MethodBase",
|
|
|
|
|
"System.String",
|
2012-03-19 05:59:34 +08:00
|
|
|
|
"System.Type"
|
|
|
|
|
);
|
2013-01-19 20:03:57 +08:00
|
|
|
|
var olocals31 = CreateLocalsArray(
|
2012-03-19 05:59:34 +08:00
|
|
|
|
"System.Int32"
|
|
|
|
|
);
|
2012-02-29 05:30:22 +08:00
|
|
|
|
if (otherMethods.Count == 1 &&
|
2012-03-06 15:17:55 +08:00
|
|
|
|
decryptStringType.NestedTypes.Count == 0 &&
|
2013-01-19 20:03:57 +08:00
|
|
|
|
DotNetUtils.IsMethod(otherMethods[0], "System.Int32", "(System.Byte[],System.Int32,System.Byte[])") &&
|
2012-02-29 05:30:22 +08:00
|
|
|
|
otherMethods[0].IsPrivate &&
|
|
|
|
|
otherMethods[0].IsStatic &&
|
2013-01-19 20:03:57 +08:00
|
|
|
|
new LocalTypes(otherMethods[0]).Exactly(olocals31) &&
|
2012-02-29 05:30:22 +08:00
|
|
|
|
hasConstantM2 &&
|
2012-11-18 08:09:07 +08:00
|
|
|
|
decryptStringMethod.IsNoInlining &&
|
2012-02-29 05:30:22 +08:00
|
|
|
|
decryptStringMethod.IsAssembly &&
|
|
|
|
|
!decryptStringMethod.IsSynchronized &&
|
2012-11-18 08:09:07 +08:00
|
|
|
|
decryptStringMethod.Body.MaxStack >= 1 &&
|
|
|
|
|
decryptStringMethod.Body.MaxStack <= 8 &&
|
2012-03-19 05:59:34 +08:00
|
|
|
|
(decryptStringMethod.Body.ExceptionHandlers.Count == 1 || decryptStringMethod.Body.ExceptionHandlers.Count == 2) &&
|
2013-01-19 20:03:57 +08:00
|
|
|
|
new LocalTypes(decryptStringMethod).Exactly(locals31) &&
|
|
|
|
|
CheckTypeFields(fields31)) {
|
2012-02-29 05:30:22 +08:00
|
|
|
|
return "3.1";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////
|
|
|
|
|
/////////////////////////////////////////////////////////////////
|
|
|
|
|
/////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
var fields32 = new string[] {
|
|
|
|
|
"System.Collections.Generic.Dictionary`2<System.Int32,System.String>",
|
|
|
|
|
"System.IO.BinaryReader",
|
|
|
|
|
"System.Byte[]",
|
|
|
|
|
"System.Int16",
|
|
|
|
|
"System.Int32",
|
|
|
|
|
"System.Byte[]",
|
|
|
|
|
"System.Int32",
|
|
|
|
|
};
|
2013-01-19 20:03:57 +08:00
|
|
|
|
var locals32 = CreateLocalsArray(
|
2012-02-29 05:30:22 +08:00
|
|
|
|
"System.Boolean",
|
|
|
|
|
"System.Byte",
|
|
|
|
|
"System.Byte[]",
|
|
|
|
|
"System.Char[]",
|
|
|
|
|
"System.Collections.Generic.Dictionary`2<System.Int32,System.String>",
|
|
|
|
|
"System.Diagnostics.StackFrame",
|
|
|
|
|
"System.Diagnostics.StackTrace",
|
|
|
|
|
"System.Int16",
|
|
|
|
|
"System.Int32",
|
|
|
|
|
"System.Int64",
|
|
|
|
|
"System.IO.Stream",
|
|
|
|
|
"System.Reflection.Assembly",
|
|
|
|
|
"System.Reflection.AssemblyName",
|
|
|
|
|
"System.Reflection.MethodBase",
|
|
|
|
|
"System.String",
|
2012-03-19 05:59:34 +08:00
|
|
|
|
"System.Type"
|
|
|
|
|
);
|
2013-01-19 20:03:57 +08:00
|
|
|
|
var olocals32 = CreateLocalsArray(
|
2012-03-19 05:59:34 +08:00
|
|
|
|
"System.Int32"
|
|
|
|
|
);
|
2012-02-29 05:30:22 +08:00
|
|
|
|
if (otherMethods.Count == 1 &&
|
2012-03-06 15:17:55 +08:00
|
|
|
|
decryptStringType.NestedTypes.Count == 0 &&
|
2013-01-19 20:03:57 +08:00
|
|
|
|
DotNetUtils.IsMethod(otherMethods[0], "System.Void", "(System.Byte[],System.Int32,System.Byte[])") &&
|
2012-02-29 05:30:22 +08:00
|
|
|
|
otherMethods[0].IsPrivate &&
|
|
|
|
|
otherMethods[0].IsStatic &&
|
2013-01-19 20:03:57 +08:00
|
|
|
|
new LocalTypes(otherMethods[0]).Exactly(olocals32) &&
|
2012-02-29 05:30:22 +08:00
|
|
|
|
hasConstantM2 &&
|
2012-11-18 08:09:07 +08:00
|
|
|
|
decryptStringMethod.IsNoInlining &&
|
2012-02-29 05:30:22 +08:00
|
|
|
|
decryptStringMethod.IsAssembly &&
|
|
|
|
|
!decryptStringMethod.IsSynchronized &&
|
2012-11-18 08:09:07 +08:00
|
|
|
|
decryptStringMethod.Body.MaxStack >= 1 &&
|
|
|
|
|
decryptStringMethod.Body.MaxStack <= 8 &&
|
2012-03-19 05:59:34 +08:00
|
|
|
|
(decryptStringMethod.Body.ExceptionHandlers.Count == 1 || decryptStringMethod.Body.ExceptionHandlers.Count == 2) &&
|
2013-01-19 20:03:57 +08:00
|
|
|
|
new LocalTypes(decryptStringMethod).Exactly(locals32) &&
|
|
|
|
|
CheckTypeFields(fields32)) {
|
2012-02-29 05:30:22 +08:00
|
|
|
|
return "3.2";
|
|
|
|
|
}
|
|
|
|
|
|
2012-03-06 15:17:55 +08:00
|
|
|
|
/////////////////////////////////////////////////////////////////
|
|
|
|
|
/////////////////////////////////////////////////////////////////
|
|
|
|
|
/////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
if (decryptStringType.NestedTypes.Count == 1) {
|
|
|
|
|
var fields33 = new string[] {
|
|
|
|
|
"System.Collections.Generic.Dictionary`2<System.Int32,System.String>",
|
|
|
|
|
"System.IO.BinaryReader",
|
|
|
|
|
"System.Byte[]",
|
|
|
|
|
"System.Int16",
|
|
|
|
|
"System.Int32",
|
|
|
|
|
"System.Byte[]",
|
|
|
|
|
"System.Int32",
|
|
|
|
|
"System.Int32",
|
|
|
|
|
decryptStringType.NestedTypes[0].FullName,
|
|
|
|
|
};
|
2013-01-19 20:03:57 +08:00
|
|
|
|
var locals33 = CreateLocalsArray(
|
2012-03-06 15:17:55 +08:00
|
|
|
|
"System.Boolean",
|
|
|
|
|
"System.Byte",
|
|
|
|
|
"System.Byte[]",
|
|
|
|
|
"System.Char[]",
|
|
|
|
|
"System.Collections.Generic.Dictionary`2<System.Int32,System.String>",
|
|
|
|
|
"System.Diagnostics.StackFrame",
|
|
|
|
|
"System.Diagnostics.StackTrace",
|
|
|
|
|
"System.Int16",
|
|
|
|
|
"System.Int32",
|
|
|
|
|
"System.Int64",
|
|
|
|
|
"System.IO.Stream",
|
|
|
|
|
"System.Reflection.Assembly",
|
|
|
|
|
"System.Reflection.AssemblyName",
|
|
|
|
|
"System.Reflection.MethodBase",
|
|
|
|
|
"System.String",
|
2012-03-19 05:59:34 +08:00
|
|
|
|
"System.Type"
|
|
|
|
|
);
|
2013-01-19 20:03:57 +08:00
|
|
|
|
var olocals33 = CreateLocalsArray(
|
2012-03-19 05:59:34 +08:00
|
|
|
|
"System.Int32"
|
|
|
|
|
);
|
2012-03-06 15:17:55 +08:00
|
|
|
|
if (otherMethods.Count == 1 &&
|
|
|
|
|
decryptStringType.NestedTypes.Count == 1 &&
|
2013-01-19 20:03:57 +08:00
|
|
|
|
DotNetUtils.IsMethod(otherMethods[0], "System.Void", "(System.Byte[],System.Int32,System.Byte[])") &&
|
2012-03-06 15:17:55 +08:00
|
|
|
|
otherMethods[0].IsPrivate &&
|
|
|
|
|
otherMethods[0].IsStatic &&
|
2013-01-19 20:03:57 +08:00
|
|
|
|
new LocalTypes(otherMethods[0]).Exactly(olocals33) &&
|
2012-03-06 15:17:55 +08:00
|
|
|
|
hasConstantM2 &&
|
2012-11-18 08:09:07 +08:00
|
|
|
|
decryptStringMethod.IsNoInlining &&
|
2012-03-06 15:17:55 +08:00
|
|
|
|
decryptStringMethod.IsAssembly &&
|
|
|
|
|
!decryptStringMethod.IsSynchronized &&
|
2012-11-18 08:09:07 +08:00
|
|
|
|
decryptStringMethod.Body.MaxStack >= 1 &&
|
|
|
|
|
decryptStringMethod.Body.MaxStack <= 8 &&
|
2012-03-19 05:59:34 +08:00
|
|
|
|
(decryptStringMethod.Body.ExceptionHandlers.Count == 1 || decryptStringMethod.Body.ExceptionHandlers.Count == 2) &&
|
2013-01-19 20:03:57 +08:00
|
|
|
|
new LocalTypes(decryptStringMethod).Exactly(locals33) &&
|
|
|
|
|
CheckTypeFields(fields33)) {
|
2012-03-06 15:17:55 +08:00
|
|
|
|
return "3.3.29 - 3.3.57 (BETA)";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////
|
|
|
|
|
/////////////////////////////////////////////////////////////////
|
|
|
|
|
/////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
if (decryptStringType.NestedTypes.Count == 3) {
|
|
|
|
|
var fields33 = new string[] {
|
2013-01-19 20:03:57 +08:00
|
|
|
|
GetNestedTypeName(0),
|
|
|
|
|
GetNestedTypeName(1),
|
2012-03-06 15:17:55 +08:00
|
|
|
|
"System.Byte[]",
|
|
|
|
|
"System.Int16",
|
|
|
|
|
"System.Int32",
|
|
|
|
|
"System.Byte[]",
|
|
|
|
|
"System.Int32",
|
|
|
|
|
"System.Int32",
|
2013-01-19 20:03:57 +08:00
|
|
|
|
GetNestedTypeName(2),
|
2012-03-06 15:17:55 +08:00
|
|
|
|
};
|
2013-01-19 20:03:57 +08:00
|
|
|
|
var locals33 = CreateLocalsArray(
|
2012-03-06 15:17:55 +08:00
|
|
|
|
"System.Boolean",
|
|
|
|
|
"System.Byte",
|
|
|
|
|
"System.Byte[]",
|
|
|
|
|
"System.Char[]",
|
2013-01-19 20:03:57 +08:00
|
|
|
|
GetNestedTypeName(0),
|
2012-03-06 15:17:55 +08:00
|
|
|
|
"System.Diagnostics.StackFrame",
|
|
|
|
|
"System.Diagnostics.StackTrace",
|
|
|
|
|
"System.Int16",
|
|
|
|
|
"System.Int32",
|
|
|
|
|
"System.Int64",
|
|
|
|
|
"System.IO.Stream",
|
|
|
|
|
"System.Reflection.Assembly",
|
|
|
|
|
"System.Reflection.AssemblyName",
|
|
|
|
|
"System.Reflection.MethodBase",
|
|
|
|
|
"System.String",
|
2012-03-19 05:59:34 +08:00
|
|
|
|
"System.Type"
|
|
|
|
|
);
|
2013-01-19 20:03:57 +08:00
|
|
|
|
var olocals33 = CreateLocalsArray(
|
2012-03-19 05:59:34 +08:00
|
|
|
|
"System.Int32"
|
|
|
|
|
);
|
2012-03-06 15:17:55 +08:00
|
|
|
|
if (otherMethods.Count == 1 &&
|
|
|
|
|
decryptStringType.NestedTypes.Count == 3 &&
|
2013-01-19 20:03:57 +08:00
|
|
|
|
DotNetUtils.IsMethod(otherMethods[0], "System.Void", "(System.Byte[],System.Int32,System.Byte[])") &&
|
2012-03-06 15:17:55 +08:00
|
|
|
|
otherMethods[0].IsPrivate &&
|
|
|
|
|
otherMethods[0].IsStatic &&
|
2013-01-19 20:03:57 +08:00
|
|
|
|
new LocalTypes(otherMethods[0]).Exactly(olocals33) &&
|
2012-11-18 08:09:07 +08:00
|
|
|
|
decryptStringMethod.IsNoInlining &&
|
2012-03-06 15:17:55 +08:00
|
|
|
|
decryptStringMethod.IsAssembly &&
|
|
|
|
|
!decryptStringMethod.IsSynchronized &&
|
2012-11-18 08:09:07 +08:00
|
|
|
|
decryptStringMethod.Body.MaxStack >= 1 &&
|
|
|
|
|
decryptStringMethod.Body.MaxStack <= 8 &&
|
2012-03-19 05:59:34 +08:00
|
|
|
|
(decryptStringMethod.Body.ExceptionHandlers.Count == 1 || decryptStringMethod.Body.ExceptionHandlers.Count == 2) &&
|
2013-01-19 20:03:57 +08:00
|
|
|
|
new LocalTypes(decryptStringMethod).Exactly(locals33) &&
|
|
|
|
|
CheckTypeFields(fields33)) {
|
2012-03-06 15:17:55 +08:00
|
|
|
|
return "3.3";
|
|
|
|
|
}
|
2012-04-10 09:52:18 +08:00
|
|
|
|
|
2012-12-11 04:42:14 +08:00
|
|
|
|
/////////////////////////////////////////////////////////////////
|
|
|
|
|
/////////////////////////////////////////////////////////////////
|
|
|
|
|
/////////////////////////////////////////////////////////////////
|
|
|
|
|
|
2012-04-10 09:52:18 +08:00
|
|
|
|
var fields33_149 = new string[] {
|
2013-01-19 20:03:57 +08:00
|
|
|
|
GetNestedTypeName(0),
|
|
|
|
|
GetNestedTypeName(1),
|
2012-04-10 09:52:18 +08:00
|
|
|
|
"System.Byte[]",
|
|
|
|
|
"System.Int16",
|
|
|
|
|
"System.Int32",
|
|
|
|
|
"System.Byte[]",
|
|
|
|
|
"System.Int32",
|
|
|
|
|
"System.Int32",
|
2013-01-19 20:03:57 +08:00
|
|
|
|
GetNestedTypeName(2),
|
2012-04-10 09:52:18 +08:00
|
|
|
|
};
|
2013-01-19 20:03:57 +08:00
|
|
|
|
var locals33_149 = CreateLocalsArray(
|
2012-04-10 09:52:18 +08:00
|
|
|
|
"System.Boolean",
|
|
|
|
|
"System.Byte",
|
|
|
|
|
"System.Byte[]",
|
|
|
|
|
"System.Char[]",
|
2013-01-19 20:03:57 +08:00
|
|
|
|
GetNestedTypeName(0),
|
2012-04-10 09:52:18 +08:00
|
|
|
|
"System.Diagnostics.StackFrame",
|
|
|
|
|
"System.Diagnostics.StackTrace",
|
|
|
|
|
"System.Int16",
|
|
|
|
|
"System.Int32",
|
|
|
|
|
"System.Int64",
|
|
|
|
|
"System.IO.Stream",
|
|
|
|
|
"System.Reflection.Assembly",
|
|
|
|
|
"System.Reflection.AssemblyName",
|
|
|
|
|
"System.Reflection.MethodBase",
|
|
|
|
|
"System.String",
|
|
|
|
|
"System.Text.StringBuilder",
|
|
|
|
|
"System.Type"
|
|
|
|
|
);
|
2013-01-19 20:03:57 +08:00
|
|
|
|
var olocals33_149 = CreateLocalsArray(
|
2012-04-10 09:52:18 +08:00
|
|
|
|
"System.Int32"
|
|
|
|
|
);
|
|
|
|
|
if (otherMethods.Count == 1 &&
|
|
|
|
|
decryptStringType.NestedTypes.Count == 3 &&
|
2013-01-19 20:03:57 +08:00
|
|
|
|
DotNetUtils.IsMethod(otherMethods[0], "System.Void", "(System.Byte[],System.Int32,System.Byte[])") &&
|
2012-04-10 09:52:18 +08:00
|
|
|
|
otherMethods[0].IsPrivate &&
|
|
|
|
|
otherMethods[0].IsStatic &&
|
2013-01-19 20:03:57 +08:00
|
|
|
|
new LocalTypes(otherMethods[0]).Exactly(olocals33_149) &&
|
2012-11-18 08:09:07 +08:00
|
|
|
|
decryptStringMethod.IsNoInlining &&
|
2012-04-10 09:52:18 +08:00
|
|
|
|
decryptStringMethod.IsAssembly &&
|
|
|
|
|
!decryptStringMethod.IsSynchronized &&
|
2012-11-18 08:09:07 +08:00
|
|
|
|
decryptStringMethod.Body.MaxStack >= 1 &&
|
|
|
|
|
decryptStringMethod.Body.MaxStack <= 8 &&
|
2012-04-10 09:52:18 +08:00
|
|
|
|
(decryptStringMethod.Body.ExceptionHandlers.Count == 1 || decryptStringMethod.Body.ExceptionHandlers.Count == 2) &&
|
2013-01-19 20:03:57 +08:00
|
|
|
|
new LocalTypes(decryptStringMethod).Exactly(locals33_149) &&
|
|
|
|
|
CheckTypeFields2(fields33_149)) {
|
2012-12-11 04:42:14 +08:00
|
|
|
|
return "3.3.149 - 3.4"; // 3.3.149+ (but not SL or CF)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////
|
|
|
|
|
/////////////////////////////////////////////////////////////////
|
|
|
|
|
/////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
var fields35 = new string[] {
|
2013-01-19 20:03:57 +08:00
|
|
|
|
GetNestedTypeName(0),
|
|
|
|
|
GetNestedTypeName(1),
|
2012-12-11 04:42:14 +08:00
|
|
|
|
"System.Byte[]",
|
|
|
|
|
"System.Int16",
|
|
|
|
|
"System.Int32",
|
|
|
|
|
"System.Byte[]",
|
|
|
|
|
"System.Int32",
|
|
|
|
|
"System.Int32",
|
2013-01-19 20:03:57 +08:00
|
|
|
|
GetNestedTypeName(2),
|
2012-12-11 04:42:14 +08:00
|
|
|
|
};
|
2013-01-19 20:03:57 +08:00
|
|
|
|
var locals35 = CreateLocalsArray(
|
2012-12-11 04:42:14 +08:00
|
|
|
|
"System.Boolean",
|
|
|
|
|
"System.Byte",
|
|
|
|
|
"System.Byte[]",
|
|
|
|
|
"System.Char[]",
|
|
|
|
|
"System.Collections.Generic.IEnumerator`1<System.Int32>",
|
2013-01-19 20:03:57 +08:00
|
|
|
|
GetNestedTypeName(0),
|
2012-12-11 04:42:14 +08:00
|
|
|
|
"System.Diagnostics.StackFrame",
|
|
|
|
|
"System.Diagnostics.StackTrace",
|
|
|
|
|
"System.Int16",
|
|
|
|
|
"System.Int32",
|
|
|
|
|
"System.Int64",
|
|
|
|
|
"System.IO.Stream",
|
|
|
|
|
"System.Reflection.Assembly",
|
|
|
|
|
"System.Reflection.AssemblyName",
|
|
|
|
|
"System.Reflection.MethodBase",
|
|
|
|
|
"System.String",
|
|
|
|
|
"System.Text.StringBuilder",
|
|
|
|
|
"System.Type"
|
|
|
|
|
);
|
2013-01-19 20:03:57 +08:00
|
|
|
|
var olocals35 = CreateLocalsArray(
|
2012-12-11 04:42:14 +08:00
|
|
|
|
"System.Int32"
|
|
|
|
|
);
|
|
|
|
|
if (otherMethods.Count == 1 &&
|
|
|
|
|
decryptStringType.NestedTypes.Count == 3 &&
|
2013-01-19 20:03:57 +08:00
|
|
|
|
DotNetUtils.IsMethod(otherMethods[0], "System.Void", "(System.Byte[],System.Int32,System.Byte[])") &&
|
2012-12-11 04:42:14 +08:00
|
|
|
|
otherMethods[0].IsPrivate &&
|
|
|
|
|
otherMethods[0].IsStatic &&
|
2013-01-19 20:03:57 +08:00
|
|
|
|
new LocalTypes(otherMethods[0]).Exactly(olocals35) &&
|
2012-12-11 04:42:14 +08:00
|
|
|
|
decryptStringMethod.IsNoInlining &&
|
|
|
|
|
decryptStringMethod.IsAssembly &&
|
|
|
|
|
!decryptStringMethod.IsSynchronized &&
|
|
|
|
|
decryptStringMethod.Body.MaxStack >= 1 &&
|
|
|
|
|
decryptStringMethod.Body.MaxStack <= 8 &&
|
|
|
|
|
decryptStringMethod.Body.ExceptionHandlers.Count >= 2 &&
|
2013-01-19 20:03:57 +08:00
|
|
|
|
new LocalTypes(decryptStringMethod).All(locals35) &&
|
|
|
|
|
CheckTypeFields2(fields35)) {
|
2014-03-23 14:39:55 +08:00
|
|
|
|
return "3.5 - 4.2";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////
|
|
|
|
|
/////////////////////////////////////////////////////////////////
|
|
|
|
|
/////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
var fields43 = new string[] {
|
|
|
|
|
GetNestedTypeName(0),
|
|
|
|
|
GetNestedTypeName(1),
|
|
|
|
|
"System.Byte[]",
|
|
|
|
|
"System.Int16",
|
|
|
|
|
"System.Int32",
|
|
|
|
|
"System.Byte[]",
|
|
|
|
|
"System.Int32",
|
|
|
|
|
"System.Int32",
|
|
|
|
|
GetNestedTypeName(2),
|
|
|
|
|
};
|
|
|
|
|
var locals43 = CreateLocalsArray(
|
|
|
|
|
"System.Boolean",
|
|
|
|
|
"System.Byte",
|
|
|
|
|
"System.Byte[]",
|
|
|
|
|
"System.Char[]",
|
|
|
|
|
FindEnumeratorName(decryptStringMethod),
|
|
|
|
|
GetNestedTypeName(0),
|
|
|
|
|
"System.Diagnostics.StackFrame",
|
|
|
|
|
"System.Diagnostics.StackTrace",
|
|
|
|
|
"System.Int16",
|
|
|
|
|
"System.Int32",
|
|
|
|
|
"System.Int64",
|
|
|
|
|
"System.IO.Stream",
|
|
|
|
|
"System.Reflection.Assembly",
|
|
|
|
|
"System.Reflection.AssemblyName",
|
|
|
|
|
"System.Reflection.MethodBase",
|
|
|
|
|
"System.String",
|
|
|
|
|
"System.Text.StringBuilder",
|
|
|
|
|
"System.Type"
|
|
|
|
|
);
|
|
|
|
|
var olocals43 = CreateLocalsArray(
|
|
|
|
|
"System.Int32"
|
|
|
|
|
);
|
|
|
|
|
if (otherMethods.Count == 1 &&
|
|
|
|
|
decryptStringType.NestedTypes.Count == 3 &&
|
|
|
|
|
DotNetUtils.IsMethod(otherMethods[0], "System.Void", "(System.Byte[],System.Int32,System.Byte[])") &&
|
|
|
|
|
otherMethods[0].IsPrivate &&
|
|
|
|
|
otherMethods[0].IsStatic &&
|
|
|
|
|
new LocalTypes(otherMethods[0]).Exactly(olocals43) &&
|
|
|
|
|
decryptStringMethod.IsNoInlining &&
|
|
|
|
|
decryptStringMethod.IsAssembly &&
|
|
|
|
|
!decryptStringMethod.IsSynchronized &&
|
|
|
|
|
decryptStringMethod.Body.MaxStack >= 1 &&
|
|
|
|
|
decryptStringMethod.Body.MaxStack <= 8 &&
|
|
|
|
|
decryptStringMethod.Body.ExceptionHandlers.Count >= 2 &&
|
|
|
|
|
new LocalTypes(decryptStringMethod).All(locals43) &&
|
|
|
|
|
CheckTypeFields2(fields43)) {
|
2015-08-05 06:52:02 +08:00
|
|
|
|
return "4.3 - 4.9";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/////////////////////////////////////////////////////////////////
|
|
|
|
|
/////////////////////////////////////////////////////////////////
|
|
|
|
|
/////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
var fields50 = new string[] {
|
|
|
|
|
GetNestedTypeName(0),
|
|
|
|
|
GetNestedTypeName(1),
|
|
|
|
|
"System.Byte[]",
|
|
|
|
|
"System.Int16",
|
|
|
|
|
"System.Int32",
|
|
|
|
|
"System.Byte[]",
|
|
|
|
|
"System.Int32",
|
|
|
|
|
"System.Int32",
|
|
|
|
|
GetNestedTypeName(2),
|
|
|
|
|
};
|
|
|
|
|
var locals50 = CreateLocalsArray(
|
|
|
|
|
// GetNestedTypeName(2) // One of the nested types is the first local (non-enum type)
|
|
|
|
|
"System.String",
|
|
|
|
|
"System.String"
|
|
|
|
|
);
|
|
|
|
|
var otherMethod50 = otherMethods.Find((m) => {
|
|
|
|
|
return DotNetUtils.IsMethod(m, "System.Void", "(System.Byte[],System.Int32,System.Byte[])");
|
|
|
|
|
});
|
|
|
|
|
decryptStringMethod = stringDecrypter.RealMethod;
|
|
|
|
|
if (stringDecrypter.HasRealMethod &&
|
|
|
|
|
otherMethods.Count == 2 &&
|
|
|
|
|
otherMethod50 != null &&
|
|
|
|
|
decryptStringType.NestedTypes.Count == 3 &&
|
|
|
|
|
otherMethod50.IsPrivate &&
|
|
|
|
|
otherMethod50.IsStatic &&
|
|
|
|
|
decryptStringMethod.IsNoInlining &&
|
|
|
|
|
decryptStringMethod.IsAssembly &&
|
|
|
|
|
!decryptStringMethod.IsSynchronized &&
|
|
|
|
|
decryptStringMethod.Body.MaxStack >= 1 &&
|
|
|
|
|
decryptStringMethod.Body.MaxStack <= 8 &&
|
|
|
|
|
decryptStringMethod.Body.ExceptionHandlers.Count == 1 &&
|
|
|
|
|
new LocalTypes(decryptStringMethod).All(locals50) &&
|
|
|
|
|
CheckTypeFields2(fields50)) {
|
|
|
|
|
return "5.0";
|
2012-04-10 09:52:18 +08:00
|
|
|
|
}
|
2012-03-06 15:17:55 +08:00
|
|
|
|
}
|
|
|
|
|
|
2012-02-29 05:30:22 +08:00
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
2014-03-23 14:39:55 +08:00
|
|
|
|
static string FindEnumeratorName(MethodDef method) {
|
|
|
|
|
foreach (var local in method.Body.Variables) {
|
|
|
|
|
var gis = local.Type as GenericInstSig;
|
|
|
|
|
if (gis == null)
|
|
|
|
|
continue;
|
|
|
|
|
if (gis.FullName == "System.Collections.Generic.IEnumerator`1<System.Int32>")
|
|
|
|
|
continue;
|
|
|
|
|
if (gis.GenericArguments.Count != 1)
|
|
|
|
|
continue;
|
|
|
|
|
if (gis.GenericArguments[0].GetFullName() != "System.Int32")
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
return gis.FullName;
|
|
|
|
|
}
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
2013-01-19 20:03:57 +08:00
|
|
|
|
TypeDef GetNestedType(int n) {
|
2012-04-10 09:52:18 +08:00
|
|
|
|
var type = stringDecrypter.Type;
|
|
|
|
|
|
2012-12-11 04:42:14 +08:00
|
|
|
|
if (n == 0) {
|
|
|
|
|
foreach (var nested in type.NestedTypes) {
|
|
|
|
|
if (nested.NestedTypes.Count == 1)
|
|
|
|
|
return nested;
|
|
|
|
|
}
|
2012-04-10 09:52:18 +08:00
|
|
|
|
}
|
2012-12-11 04:42:14 +08:00
|
|
|
|
else if (n == 1) {
|
|
|
|
|
foreach (var nested in type.NestedTypes) {
|
|
|
|
|
if (nested.IsEnum)
|
|
|
|
|
continue;
|
|
|
|
|
if (nested.NestedTypes.Count != 0)
|
|
|
|
|
continue;
|
|
|
|
|
return nested;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (n == 2) {
|
|
|
|
|
foreach (var nested in type.NestedTypes) {
|
|
|
|
|
if (nested.IsEnum)
|
|
|
|
|
return nested;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return null;
|
2012-04-10 09:52:18 +08:00
|
|
|
|
}
|
|
|
|
|
|
2013-01-19 20:03:57 +08:00
|
|
|
|
string GetNestedTypeName(int n) {
|
|
|
|
|
var nestedType = GetNestedType(n);
|
2012-04-10 09:52:18 +08:00
|
|
|
|
return nestedType == null ? null : nestedType.FullName;
|
|
|
|
|
}
|
|
|
|
|
|
2013-01-19 20:03:57 +08:00
|
|
|
|
bool CheckTypeFields(string[] fieldTypes) {
|
2012-02-29 05:30:22 +08:00
|
|
|
|
if (fieldTypes.Length != stringDecrypter.Type.Fields.Count)
|
|
|
|
|
return false;
|
|
|
|
|
for (int i = 0; i < fieldTypes.Length; i++) {
|
|
|
|
|
if (fieldTypes[i] != stringDecrypter.Type.Fields[i].FieldType.FullName)
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
2012-03-19 05:59:34 +08:00
|
|
|
|
|
2013-01-19 20:03:57 +08:00
|
|
|
|
bool CheckTypeFields2(string[] fieldTypes) {
|
2012-12-11 04:42:14 +08:00
|
|
|
|
if (fieldTypes.Length != stringDecrypter.Type.Fields.Count)
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
var fieldTypes1 = new List<string>(fieldTypes);
|
|
|
|
|
fieldTypes1.Sort();
|
|
|
|
|
|
|
|
|
|
var fieldTypes2 = new List<string>();
|
|
|
|
|
foreach (var f in stringDecrypter.Type.Fields)
|
|
|
|
|
fieldTypes2.Add(f.FieldType.FullName);
|
|
|
|
|
fieldTypes2.Sort();
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < fieldTypes1.Count; i++) {
|
|
|
|
|
if (fieldTypes1[i] != fieldTypes2[i])
|
|
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2012-03-19 05:59:34 +08:00
|
|
|
|
static Dictionary<string, bool> removeLocals_cf = new Dictionary<string, bool>(StringComparer.Ordinal) {
|
|
|
|
|
{ "System.Diagnostics.StackFrame", true },
|
|
|
|
|
{ "System.Diagnostics.StackTrace", true },
|
|
|
|
|
};
|
2013-01-19 20:03:57 +08:00
|
|
|
|
string[] CreateLocalsArray(params string[] locals) {
|
2012-03-19 05:59:34 +08:00
|
|
|
|
Dictionary<string, bool> removeLocals = null;
|
|
|
|
|
switch (frameworkType) {
|
|
|
|
|
case FrameworkType.CompactFramework:
|
|
|
|
|
removeLocals = removeLocals_cf;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
if (removeLocals == null)
|
|
|
|
|
return locals;
|
|
|
|
|
|
|
|
|
|
var list = new List<string>(locals.Length);
|
|
|
|
|
foreach (var s in locals) {
|
|
|
|
|
if (!removeLocals.ContainsKey(s))
|
|
|
|
|
list.Add(s);
|
|
|
|
|
}
|
|
|
|
|
return list.ToArray();
|
|
|
|
|
}
|
2012-02-29 05:30:22 +08:00
|
|
|
|
}
|
|
|
|
|
}
|