From 427ea385957ec817738375a8382fc1cf99c7a4c2 Mon Sep 17 00:00:00 2001 From: de4dot Date: Wed, 7 Nov 2012 01:52:15 +0100 Subject: [PATCH] Port MPRESS unpacker --- blocks/DotNetUtils.cs | 4 ++-- de4dot.code/de4dot.code.csproj | 4 ++-- de4dot.code/deobfuscators/MPRESS/Deobfuscator.cs | 5 ++--- de4dot.cui/Program.cs | 2 +- dot10 | 2 +- 5 files changed, 8 insertions(+), 9 deletions(-) diff --git a/blocks/DotNetUtils.cs b/blocks/DotNetUtils.cs index 789ecfcb..96f066fa 100644 --- a/blocks/DotNetUtils.cs +++ b/blocks/DotNetUtils.cs @@ -322,15 +322,15 @@ namespace de4dot.blocks { return (MethodDef)method; return getMethod(getType(module, declaringType), method); } +#endif - public static MethodDef getMethod(TypeDefinition type, string returnType, string parameters) { + public static MethodDef getMethod(TypeDef type, string returnType, string parameters) { foreach (var method in type.Methods) { if (isMethod(method, returnType, parameters)) return method; } return null; } -#endif public static MethodDef getMethod2(ModuleDef module, IMethod method) { if (method == null) diff --git a/de4dot.code/de4dot.code.csproj b/de4dot.code/de4dot.code.csproj index ba134565..a5f5fc42 100644 --- a/de4dot.code/de4dot.code.csproj +++ b/de4dot.code/de4dot.code.csproj @@ -223,8 +223,8 @@ - - + + diff --git a/de4dot.code/deobfuscators/MPRESS/Deobfuscator.cs b/de4dot.code/deobfuscators/MPRESS/Deobfuscator.cs index 5b74c37f..9fd808d0 100644 --- a/de4dot.code/deobfuscators/MPRESS/Deobfuscator.cs +++ b/de4dot.code/deobfuscators/MPRESS/Deobfuscator.cs @@ -22,7 +22,6 @@ using System.Collections.Generic; using System.Security.Cryptography; using System.Text; using dot10.DotNet; -using Mono.MyStuff; using de4dot.PE; using de4dot.blocks; @@ -140,7 +139,7 @@ namespace de4dot.code.deobfuscators.MPRESS { new MethodInfo("System.Int32", "(System.String[])"), }; Version detectVersion() { - var ep = module.EntryPoint; + var ep = module.EntryPoint as MethodDef; if (ep == null || ep.Body == null) return Version.Unknown; var type = ep.DeclaringType; @@ -232,7 +231,7 @@ namespace de4dot.code.deobfuscators.MPRESS { return true; } - public override IDeobfuscator moduleReloaded(ModuleDefinition module) { + public override IDeobfuscator moduleReloaded(ModuleDefMD module) { var newOne = new Deobfuscator(options); newOne.setModule(module); return newOne; diff --git a/de4dot.cui/Program.cs b/de4dot.cui/Program.cs index ac8d77de..1f8340a5 100644 --- a/de4dot.cui/Program.cs +++ b/de4dot.cui/Program.cs @@ -54,8 +54,8 @@ namespace de4dot.cui { new de4dot.code.deobfuscators.Goliath_NET.DeobfuscatorInfo(), new de4dot.code.deobfuscators.ILProtector.DeobfuscatorInfo(), new de4dot.code.deobfuscators.MaxtoCode.DeobfuscatorInfo(), - new de4dot.code.deobfuscators.MPRESS.DeobfuscatorInfo(), #endif + new de4dot.code.deobfuscators.MPRESS.DeobfuscatorInfo(), new de4dot.code.deobfuscators.Rummage.DeobfuscatorInfo(), new de4dot.code.deobfuscators.Skater_NET.DeobfuscatorInfo(), #if PORT diff --git a/dot10 b/dot10 index 467c01e8..71e94c79 160000 --- a/dot10 +++ b/dot10 @@ -1 +1 @@ -Subproject commit 467c01e824587bb5c09608c58adac718c465a356 +Subproject commit 71e94c79a8271bbd0abb614ac8b79d31e98674b4