public static int main(string[] args) { try { if (Console.OutputEncoding.IsSingleByte) Console.OutputEncoding = new UTF8Encoding(false); Log.n(""); Log.n("de4dot v{0} Copyright (C) 2011-2012 [email protected]", System.Reflection.Assembly.GetExecutingAssembly().GetName().Version); Log.n("Latest version and source code: https://github.com/0xd4d/de4dot"); Log.n(""); var options = new FilesDeobfuscator.Options(); parseCommandLine(args, options); new FilesDeobfuscator(options).doIt(); } catch (UserException ex) { Log.e("ERROR: {0}", ex.Message); } catch (Exception ex) { printStackTrace(ex); Log.e("\nTry the latest version before reporting this problem!"); return 1; } return 0; }
public static int Main(string[] args) { int exitCode = 0; const string showAllMessagesEnvName = "SHOWALLMESSAGES"; try { if (Console.OutputEncoding.IsSingleByte) Console.OutputEncoding = new UTF8Encoding(false); Logger.Instance.CanIgnoreMessages = !HasEnv(showAllMessagesEnvName); Logger.n(""); Logger.n("de4dot v{0} Copyright (C) 2011-2014 [email protected]", System.Reflection.Assembly.GetExecutingAssembly().GetName().Version); Logger.n("Latest version and source code: https://github.com/0xd4d/de4dot"); Logger.n(""); var options = new FilesDeobfuscator.Options(); ParseCommandLine(args, options); new FilesDeobfuscator(options).DoIt(); } catch (ExitException ex) { exitCode = ex.code; } catch (UserException ex) { Logger.Instance.LogErrorDontIgnore("{0}", ex.Message); exitCode = 1; } catch (Exception ex) { if (PrintFullStackTrace()) { PrintStackTrace(ex); Logger.Instance.LogErrorDontIgnore("\nTry the latest version before reporting this problem!"); } else { Logger.Instance.LogErrorDontIgnore("\n\n"); Logger.Instance.LogErrorDontIgnore("Hmmmm... something didn't work. Try the latest version."); } Logger.Instance.LogErrorDontIgnore("Email me all files / installer: [email protected]"); exitCode = 1; } if (Logger.Instance.NumIgnoredMessages > 0) { if (Logger.Instance.NumIgnoredMessages == 1) Logger.n("Ignored {0} warning/error", Logger.Instance.NumIgnoredMessages); else Logger.n("Ignored {0} warnings/errors", Logger.Instance.NumIgnoredMessages); Logger.n("Use -v/-vv option or set environment variable {0}=1 to see all messages", showAllMessagesEnvName); } if (IsN00bUser()) { Console.Error.WriteLine("\n\nPress any key to exit...\n"); try { Console.ReadKey(true); } catch (InvalidOperationException) { } } return exitCode; }
public CommandLineParser(IList<IDeobfuscatorInfo> deobfuscatorInfos, FilesDeobfuscator.Options filesOptions) { this.deobfuscatorInfos = deobfuscatorInfos; this.filesOptions = filesOptions; this.filesOptions.DeobfuscatorInfos = deobfuscatorInfos; this.filesOptions.AssemblyClientFactory = new NewAppDomainAssemblyClientFactory(); addAllOptions(); }
public CommandLineParser(IList <IDeobfuscatorInfo> deobfuscatorInfos, FilesDeobfuscator.Options filesOptions) { this.deobfuscatorInfos = deobfuscatorInfos; this.filesOptions = filesOptions; this.filesOptions.DeobfuscatorInfos = deobfuscatorInfos; this.filesOptions.AssemblyClientFactory = new NewAppDomainAssemblyClientFactory(); AddAllOptions(); }
public static int main(string[] args) { int exitCode = 0; try { if (Console.OutputEncoding.IsSingleByte) { Console.OutputEncoding = new UTF8Encoding(false); } Log.n(""); Log.n("de4dot v{0} Copyright (C) 2011-2012 [email protected]", System.Reflection.Assembly.GetExecutingAssembly().GetName().Version); Log.n("Latest version and source code: https://github.com/0xd4d/de4dot"); Log.n(""); var options = new FilesDeobfuscator.Options(); parseCommandLine(args, options); new FilesDeobfuscator(options).doIt(); } catch (ExitException ex) { exitCode = ex.code; } catch (UserException ex) { Log.e("ERROR: {0}", ex.Message); exitCode = 1; } catch (Exception ex) { if (printFullStackTrace()) { printStackTrace(ex); Log.e("\nTry the latest version before reporting this problem!"); Log.e("Send bug reports to [email protected] or go to https://github.com/0xd4d/de4dot/issues"); } else { Log.e("\n\n"); Log.e("Hmmmm... something didn't work. Try the latest version."); Log.e(" EX: {0} : message: {1}", ex.GetType(), ex.Message); Log.e("If it's a supported obfuscator, it could be a bug or a new obfuscator version."); Log.e("If it's an unsupported obfuscator, make sure the methods are decrypted!"); Log.e("Send bug reports to [email protected] or go to https://github.com/0xd4d/de4dot/issues"); } exitCode = 1; } if (isN00bUser()) { Console.Error.WriteLine("\n\nPress any key to exit...\n"); try { Console.ReadKey(true); } catch (InvalidOperationException) { } } return(exitCode); }
static void ParseCommandLine(string[] args, FilesDeobfuscator.Options options) { new CommandLineParser(deobfuscatorInfos, options).Parse(args); Logger.vv("Args:"); Logger.Instance.Indent(); foreach (var arg in args) { Logger.vv("{0}", Utils.ToCsharpString(arg)); } Logger.Instance.DeIndent(); }
static void parseCommandLine(string[] args, FilesDeobfuscator.Options options) { new CommandLineParser(deobfuscatorInfos, options).parse(args); Log.vv("Args:"); Log.indent(); foreach (var arg in args) { Log.vv("{0}", Utils.toCsharpString(arg)); } Log.deIndent(); }
public static int main(string[] args) { int exitCode = 0; try { if (Console.OutputEncoding.IsSingleByte) Console.OutputEncoding = new UTF8Encoding(false); Log.n(""); Log.n("de4dot v{0} Copyright (C) 2011-2012 [email protected]", System.Reflection.Assembly.GetExecutingAssembly().GetName().Version); Log.n("Latest version and source code: https://github.com/0xd4d/de4dot"); Log.n(""); var options = new FilesDeobfuscator.Options(); parseCommandLine(args, options); new FilesDeobfuscator(options).doIt(); } catch (ExitException ex) { exitCode = ex.code; } catch (UserException ex) { Log.e("ERROR: {0}", ex.Message); exitCode = 1; } catch (Exception ex) { if (printFullStackTrace()) { printStackTrace(ex); Log.e("\nTry the latest version before reporting this problem!"); Log.e("Send bug reports to [email protected] or go to https://github.com/0xd4d/de4dot/issues"); } else { Log.e("\n\n"); Log.e("Hmmmm... something didn't work. Try the latest version."); Log.e(" EX: {0} : message: {1}", ex.GetType(), ex.Message); Log.e("If it's a supported obfuscator, it could be a bug or a new obfuscator version."); Log.e("If it's an unsupported obfuscator, make sure the methods are decrypted!"); Log.e("Send bug reports to [email protected] or go to https://github.com/0xd4d/de4dot/issues"); } exitCode = 1; } if (isN00bUser()) { Console.Error.WriteLine("\n\nPress any key to exit...\n"); try { Console.ReadKey(true); } catch (InvalidOperationException) { } } return exitCode; }
public override void Process() { IList<IObfuscatedFile> files = new List<IObfuscatedFile>(); var filesOptions = new FilesDeobfuscator.Options(); filesOptions.DeobfuscatorInfos = deobfuscatorInfos; filesOptions.AssemblyClientFactory = new NewAppDomainAssemblyClientFactory(); filesOptions.RenameSymbols = true; filesOptions.ControlFlowDeobfuscation = true; filesOptions.KeepObfuscatorTypes = false; filesOptions.MetaDataFlags = MetaDataFlags.PreserveAll; filesOptions.Files = files; var newFileOptions = new ObfuscatedFile.Options { Filename = DeobfuscatorContext.Filename, NewFilename = "XPADDING", ControlFlowDeobfuscation = filesOptions.ControlFlowDeobfuscation, RenamerFlags = filesOptions.RenamerFlags, KeepObfuscatorTypes = filesOptions.KeepObfuscatorTypes, MetaDataFlags = filesOptions.MetaDataFlags, PreserveTokens = true }; using (var asm = new MemoryStream()) { DeobfuscatorContext.Assembly.Write(asm, new ModuleWriterOptions() { Logger = DummyLogger.NoThrowInstance }); files.Add(new ObfuscatedFile(newFileOptions, filesOptions.ModuleContext, filesOptions.AssemblyClientFactory, asm)); using (var ms = new MemoryStream()) { new FilesDeobfuscator(filesOptions).doIt(ms, Rename); // Better way to preserve these options? var cor20Ver = DeobfuscatorContext.Assembly.ManifestModule.Cor20HeaderRuntimeVersion; var clrVer = DeobfuscatorContext.Assembly.ManifestModule.RuntimeVersion; var clrFlags = DeobfuscatorContext.Assembly.ManifestModule.Cor20HeaderFlags; DeobfuscatorContext.Assembly = AssemblyDef.Load(ms); DeobfuscatorContext.Assembly.ManifestModule.Cor20HeaderRuntimeVersion = cor20Ver; DeobfuscatorContext.Assembly.ManifestModule.RuntimeVersion = clrVer; DeobfuscatorContext.Assembly.ManifestModule.Cor20HeaderFlags = clrFlags; } } }
public static int main(string[] args) { int exitCode = 0; try { if (Console.OutputEncoding.IsSingleByte) Console.OutputEncoding = new UTF8Encoding(false); Log.n(""); Log.n("de4dot v{0} Copyright (C) 2011-2012 [email protected]", System.Reflection.Assembly.GetExecutingAssembly().GetName().Version); Log.n("Latest version and source code: https://github.com/0xd4d/de4dot"); Log.n(""); var options = new FilesDeobfuscator.Options(); parseCommandLine(args, options); new FilesDeobfuscator(options).doIt(); } catch (ExitException ex) { exitCode = ex.code; } catch (UserException ex) { Log.e("ERROR: {0}", ex.Message); exitCode = 1; } catch (Exception ex) { printStackTrace(ex); Log.e("\nTry the latest version before reporting this problem!"); exitCode = 1; } if (isN00bUser()) { Console.Error.WriteLine("\n\nPress any key to exit...\n"); try { Console.ReadKey(true); } catch (InvalidOperationException) { } } return exitCode; }
public static int Main(string[] args) { int exitCode = 0; const string showAllMessagesEnvName = "SHOWALLMESSAGES"; try { if (Console.OutputEncoding.IsSingleByte) { Console.OutputEncoding = new UTF8Encoding(false); } Logger.Instance.CanIgnoreMessages = !HasEnv(showAllMessagesEnvName); Logger.n(""); Logger.n("de4dot v{0} Copyright (C) 2011-2014 [email protected]", System.Reflection.Assembly.GetExecutingAssembly().GetName().Version); Logger.n("Latest version and source code: https://github.com/0xd4d/de4dot"); Logger.n("{0} deobfuscator modules loaded!", deobfuscatorInfos.Count); Logger.n(""); var options = new FilesDeobfuscator.Options(); ParseCommandLine(args, options); new FilesDeobfuscator(options).DoIt(); } catch (ExitException ex) { exitCode = ex.code; } catch (UserException ex) { Logger.Instance.LogErrorDontIgnore("{0}", ex.Message); exitCode = 1; } catch (Exception ex) { if (PrintFullStackTrace()) { PrintStackTrace(ex); Logger.Instance.LogErrorDontIgnore("\nTry the latest version!"); } else { Logger.Instance.LogErrorDontIgnore("\n\n"); Logger.Instance.LogErrorDontIgnore("Hmmmm... something didn't work. Try the latest version."); } exitCode = 1; } if (Logger.Instance.NumIgnoredMessages > 0) { if (Logger.Instance.NumIgnoredMessages == 1) { Logger.n("Ignored {0} warning/error", Logger.Instance.NumIgnoredMessages); } else { Logger.n("Ignored {0} warnings/errors", Logger.Instance.NumIgnoredMessages); } Logger.n("Use -v/-vv option or set environment variable {0}=1 to see all messages", showAllMessagesEnvName); } if (IsN00bUser()) { Console.Error.WriteLine("\n\nPress any key to exit...\n"); try { Console.ReadKey(true); } catch (InvalidOperationException) { } } return(exitCode); }
public static int Main(string[] args) { Console.Title = "DeObfuscator For DotNet | By RCE-TH"; int exitCode = 0; const string showAllMessagesEnvName = "SHOWALLMESSAGES"; try { if (Console.OutputEncoding.IsSingleByte) { Console.OutputEncoding = new UTF8Encoding(false); } Console.ForegroundColor = ConsoleColor.White; Logger.Instance.CanIgnoreMessages = !HasEnv(showAllMessagesEnvName); Logger.n(""); Logger.n("de4dot v{0} Copyright (C) 2011-2019 [email protected]", System.Reflection.Assembly.GetExecutingAssembly().GetName().Version); //Logger.n("Latest version and source code: https://github.com/0xd4d/de4dot"); Console.ForegroundColor = ConsoleColor.Green; Logger.n(@" _____ _____ ______ _______ _ _ "); Logger.n(@" | __ \ / ____| | ____| |__ __| | | | |"); Logger.n(@" | |__) | | | | |__ ______ | | | |__| |"); Logger.n(@" | _ / | | | __| |______| | | | __ |"); Logger.n(@" | | \ \ | |____ | |____ | | | | | |"); Logger.n(@" |_| \_\ \_____| |______| |_| |_| |_|"); Logger.n(@""); Console.ForegroundColor = ConsoleColor.DarkYellow; Logger.n("Modified By RCE-TH | FB Group: " + "https://www.facebook.com/groups/2332629343428268/"); Logger.n(""); Console.ForegroundColor = ConsoleColor.White; Console.ForegroundColor = ConsoleColor.Gray; var options = new FilesDeobfuscator.Options(); ParseCommandLine(args, options); new FilesDeobfuscator(options).DoIt(); } catch (ExitException ex) { exitCode = ex.code; } catch (UserException ex) { Logger.Instance.LogErrorDontIgnore("{0}", ex.Message); exitCode = 1; } catch (Exception ex) { if (PrintFullStackTrace()) { PrintStackTrace(ex); Logger.Instance.LogErrorDontIgnore("\nTry the latest version!"); } else { Logger.Instance.LogErrorDontIgnore("\n\n"); Logger.Instance.LogErrorDontIgnore("Hmmmm... something didn't work. Try the latest version."); } exitCode = 1; } if (Logger.Instance.NumIgnoredMessages > 0) { if (Logger.Instance.NumIgnoredMessages == 1) { Logger.n("Ignored {0} warning/error", Logger.Instance.NumIgnoredMessages); } else { Logger.n("Ignored {0} warnings/errors", Logger.Instance.NumIgnoredMessages); } Logger.n("Use -v/-vv option or set environment variable {0}=1 to see all messages", showAllMessagesEnvName); } if (IsN00bUser()) { Console.Error.WriteLine("\n\nPress any key to exit...\n"); try { Console.ReadKey(true); } catch (InvalidOperationException) { } } return(exitCode); }
public static int Main(string[] args) { int exitCode = 0; string target = Path.GetFileName(args[0]); Logger.Instance.logFilePath = target + ".cs.res.txt"; using (var stream = File.Open(Logger.Instance.logFilePath, FileMode.Create)) { } const string showAllMessagesEnvName = "SHOWALLMESSAGES"; try { if (Console.OutputEncoding.IsSingleByte || Console.OutputEncoding.CodePage == 437) { Console.OutputEncoding = new UTF8Encoding(false); } Logger.Instance.CanIgnoreMessages = !HasEnv(showAllMessagesEnvName); var options = new FilesDeobfuscator.Options(); ParseCommandLine(args, options); new FilesDeobfuscator(options).DoIt(); } catch (ExitException ex) { exitCode = ex.code; } catch (UserException ex) { Logger.Instance.LogErrorDontIgnore("{0}", ex.Message); exitCode = 1; } catch (Exception ex) { if (PrintFullStackTrace()) { PrintStackTrace(ex); Logger.Instance.LogErrorDontIgnore("\nTry the latest version!"); } else { Logger.Instance.LogErrorDontIgnore("\n\n"); Logger.Instance.LogErrorDontIgnore("Hmmmm... something didn't work. Try the latest version."); } exitCode = 1; } if (Logger.Instance.NumIgnoredMessages > 0) { if (Logger.Instance.NumIgnoredMessages == 1) { Logger.n("Ignored {0} warning/error", Logger.Instance.NumIgnoredMessages); } else { Logger.n("Ignored {0} warnings/errors", Logger.Instance.NumIgnoredMessages); } Logger.n("Use -v/-vv option or set environment variable {0}=1 to see all messages", showAllMessagesEnvName); } if (IsN00bUser()) { Console.Error.WriteLine("\n\nPress any key to exit...\n"); try { Console.ReadKey(true); } catch (InvalidOperationException) { } } return(exitCode); }