From b2d72b153f2ec5bc14cc45da88e78f3ef455598a Mon Sep 17 00:00:00 2001 From: de4dot Date: Sun, 29 Jul 2012 18:12:29 +0200 Subject: [PATCH] Ignore exceptions when calling detect() Most likely invalid code and/or metadata, which usually means it's still encrypted. --- de4dot.code/ObfuscatedFile.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/de4dot.code/ObfuscatedFile.cs b/de4dot.code/ObfuscatedFile.cs index 182eb7a5..6707b492 100644 --- a/de4dot.code/ObfuscatedFile.cs +++ b/de4dot.code/ObfuscatedFile.cs @@ -302,7 +302,13 @@ namespace de4dot.code { int detectVal = 0; foreach (var deob in deobfuscators) { this.deob = deob; // So we can call deob.CanInlineMethods in deobfuscate() - int val = deob.detect(); + int val; + try { + val = deob.detect(); + } + catch { + val = deob.Type == "un" ? 1 : 0; + } Log.v("{0,3}: {1}", val, deob.TypeLong); if (val > 0 && deob.Type != "un") allDetected.Add(deob); @@ -731,7 +737,7 @@ namespace de4dot.code { DotNetUtils.restoreBody(method, allInstructions, allExceptionHandlers); } catch { - Log.w("Could not deobfuscate {0:X8}", method.MetadataToken.ToInt32()); + Log.v("Could not deobfuscate {0:X8}", method.MetadataToken.ToInt32()); } }