From e3b767adcc4e21a1cbf13558cda1692eddc1616b Mon Sep 17 00:00:00 2001 From: de4dot Date: Wed, 2 Nov 2011 02:38:20 +0100 Subject: [PATCH] Don't create dest dirs if we're just detecting obfuscators --- de4dot.code/FilesDeobfuscator.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/de4dot.code/FilesDeobfuscator.cs b/de4dot.code/FilesDeobfuscator.cs index ec19c28b..7e525a1a 100644 --- a/de4dot.code/FilesDeobfuscator.cs +++ b/de4dot.code/FilesDeobfuscator.cs @@ -78,7 +78,7 @@ namespace de4dot { } void detectObfuscators() { - foreach (var file in loadAllFiles()) { + foreach (var file in loadAllFiles(true)) { removeModule(file.ModuleDefinition); } } @@ -114,7 +114,7 @@ namespace de4dot { saveAllFiles(allFiles); } - IEnumerable loadAllFiles() { + IEnumerable loadAllFiles(bool onlyScan = false) { var loader = new DotNetFileLoader(new DotNetFileLoader.Options { PossibleFiles = options.Files, SearchDirs = options.SearchDirs, @@ -125,6 +125,7 @@ namespace de4dot { RenameSymbols = options.RenameSymbols, ControlFlowDeobfuscation = options.ControlFlowDeobfuscation, KeepObfuscatorTypes = options.KeepObfuscatorTypes, + CreateDestinationDir = !onlyScan, }); return loader.load(); } @@ -144,6 +145,7 @@ namespace de4dot { public bool RenameSymbols { get; set; } public bool ControlFlowDeobfuscation { get; set; } public bool KeepObfuscatorTypes { get; set; } + public bool CreateDestinationDir { get; set; } } public DotNetFileLoader(Options options) { @@ -203,7 +205,8 @@ namespace de4dot { } else { Log.n("Detected {0} ({1})", deob.Name, file.Filename); - createDirectories(Path.GetDirectoryName(file.NewFilename)); + if (options.CreateDestinationDir) + createDirectories(Path.GetDirectoryName(file.NewFilename)); return true; } }