static void Main(string[] args) { string strr = @" __ __ _____ _ _ | \/ | | __ \ (_) | | | \ / | ___ _ __ ___ ___| | | | _____ ___ _ __| |_ | |\/| |/ _ \ '_ ` _ \ / _ \ | | |/ _ \ \ / / | '__| __| | | | | __/ | | | | | __/ |__| | __/\ V /| | | | |_ |_| |_|\___|_| |_| |_|\___|_____/ \___| \_/ |_|_| \__|"; Console.WriteLine(strr); Console.WriteLine(" - by MindSystem \n"); try { module = ModuleDefMD.Load(args[0]); } catch (Exception ex) { Console.WriteLine("Load a virtualized assembly into this exe"); Console.ReadLine(); return; } asmRefAdder(); List <MethodDef> Virtualized = FindVirtualizedMethod(module); Dictionary <MethodDef, int> MethodIndex; MethodIndex = FindMethodIndex(Virtualized); foreach (MethodDef meth in MethodIndex.Keys) { Console.WriteLine("Find Virtualized method : {0} with index {1}", meth.Name, MethodIndex[meth]);; } Stream str = null; foreach (EmbeddedResource res in module.Resources) { if (res.Name == " ") { DataReader red = res.CreateReader(); str = red.AsStream(); break; } } Decompress(str); foreach (MethodDef method in MethodIndex.Keys) { RecoverMethod(method, MethodIndex[method]); // method.Body.SimplifyMacros(method.Parameters); } string SavingPath = module.Kind == ModuleKind.Dll ? args[0].Replace(".dll", "-Obfuscated.dll") : args[0].Replace(".exe", "-Obfuscated.exe"); if (module.IsILOnly) { var opts = new ModuleWriterOptions(module); opts.MetadataOptions.Flags = MetadataFlags.PreserveAll; opts.MetadataOptions.Flags = MetadataFlags.KeepOldMaxStack; // opts.Logger = DummyLogger.NoThrowInstance; module.Write(SavingPath, opts); } else { var opts = new NativeModuleWriterOptions(module, false); opts.MetadataOptions.Flags = MetadataFlags.PreserveAll; // opts.Logger = DummyLogger.NoThrowInstance; module.NativeWrite(SavingPath, opts); } }