private void button_protect_Click(object sender, EventArgs e) { try { Console.Clear(); Greeting greeting = new Greeting(); Console.ForegroundColor = ConsoleColor.DarkGreen; ModuleWriterOptions Options = null; if (checkBox_stringEncrypt.Checked) { Console.Write("String obfuscating... "); StringEncrypt stringEncrypt = new StringEncrypt(ref moduleDef); Console.Write("OK!\n"); } if (checkBox_Renamer.Checked && renamerForm.AssemblyName != String.Empty) { Console.Write("Renaming assembly..."); Renamer renamer = new Renamer(ref moduleDef, renamerForm.AssemblyName, renamerForm.ModuleName); Console.Write("OK!\n"); } if (checkBox_AntiDe4dot.Checked) { Console.Write("AntiDe4dot init..."); Anti_De4dot antiDe4dot = new Anti_De4dot(); Options = antiDe4dot.AntiDe4dotInit(ref moduleDef); Console.Write("OK!\n"); } if (checkbox_antiILSpy.Checked) { MethodDef[] userMethods = methodsListForm.listBox_selectedMethods.Items.Cast <MethodDef>().ToArray(); AntiILSpy antiIlSpy = new AntiILSpy(ref moduleDef, userMethods); } var writerOptions = new dnlib.DotNet.Writer.ModuleWriterOptions(moduleDef); writerOptions.Logger = DummyLogger.NoThrowInstance; Console.Write("Saving assembly..."); moduleDef.Write(Path.GetDirectoryName(textBox_filePath.Text) + "\\" + Path.GetFileNameWithoutExtension(textBox_filePath.Text) + "_MADNESS" + Path.GetExtension(textBox_filePath.Text), writerOptions); Console.Write("OK!\n"); methodsListForm.Close(); } catch (System.IO.IOException exception) { MessageBox.Show(exception.Message); } }
static void Main(string[] args) { #region Initialize Console.Title = "Rzy Protector V2 Unpacker - by illuZion#9999"; WriteTitle(); if (args.Length != 1) { Write("Please, drag 'n' drop the file to unpack!", Type.Error); Leave(); } string directory = args[0]; try { module = ModuleDefMD.Load(directory); assembly = AssemblyDef.Load(directory); filePath = directory; } catch { Write("Not a .NET Assembly...", Type.Error); Leave(); } #endregion Initialize #region Unpack Hide_Methods.Execute(module); Call_to_Calli.Execute(module); Empty_Types.Execute(module); Maths(module); Local_To_Field.Execute(module); Constants.Execute(module); Maths(module); String_Protection.Execute(module); Fake_Obfuscator.Execute(module); Anti_ILDasm.Execute(module); Anti_De4dot.Execute(module); Anti_Dnspy.Execute(module); Anti_VM.Execute(module); Anti_Debug.Execute(module); Anti_Dump.Execute(module); Remove_Nops.Execute(module); #endregion Unpack #region Save the file Write("Saving the unpacked file...", Type.Info); string text = Path.GetDirectoryName(directory); if (!text.EndsWith("\\")) { text += "\\"; } string filename = string.Format("{0}{1}-Unpacked{2}", text, Path.GetFileNameWithoutExtension(directory), Path.GetExtension(directory)); ModuleWriterOptions writerOptions = new ModuleWriterOptions(module); writerOptions.MetadataOptions.Flags |= MetadataFlags.PreserveAll; writerOptions.Logger = DummyLogger.NoThrowInstance; NativeModuleWriterOptions NativewriterOptions = new NativeModuleWriterOptions(module, true); NativewriterOptions.MetadataOptions.Flags |= MetadataFlags.PreserveAll; NativewriterOptions.Logger = DummyLogger.NoThrowInstance; if (module.IsILOnly) { module.Write(filename, writerOptions); } else { module.NativeWrite(filename, NativewriterOptions); } Write($"File saved at: {filename}", Type.Success); Leave(); #endregion Save the file }
// Token: 0x060000FE RID: 254 RVA: 0x00015024 File Offset: 0x00013224 private void metroButton2_Click(object sender, EventArgs e) { ModuleDef moduleDef = ModuleDefMD.Load(this.metroTextBox1.Text); bool numberToString = Settings.NumberToString; if (numberToString) { Constants__numbers_.ObfuscateNumbers(moduleDef); } bool stackUnderflow = Settings.StackUnderflow; if (stackUnderflow) { Stack_Underflow.StackUnderflow(moduleDef); } bool sizeOf = Settings.SizeOf; if (sizeOf) { SizeOf.Sizeof(moduleDef); } bool disConstants = Settings.DisConstants; if (disConstants) { Distant_Constants.DisConstants(moduleDef); } bool refProxy = Settings.RefProxy; if (refProxy) { Method_Wiper.Execute(moduleDef); } bool constants = Settings.Constants; if (constants) { Constants__numbers_.Inject(moduleDef); } bool localToFields = Settings.LocalToFields; if (localToFields) { LocalToFields.Protect(moduleDef); } bool renamer = Settings.Renamer; if (renamer) { Renamer.Execute(moduleDef); } bool controlFlow = Settings.ControlFlow; if (controlFlow) { Control_Flow.Encrypt(moduleDef); Constants__numbers_.Execute(moduleDef); } bool constant_Mutation = Settings.Constant_Mutation; if (constant_Mutation) { Constant_Mutation.Execute(moduleDef); } bool antiDe4dot = Settings.AntiDe4dot; if (antiDe4dot) { Anti_De4dot.RemoveDe4dot(moduleDef); } bool antiILdasm = Settings.AntiILdasm; if (antiILdasm) { Anti_ILDasm.Anti(moduleDef); } bool koiVMFakeSig = Settings.KoiVMFakeSig; if (koiVMFakeSig) { KoiVM_Fake_Watermark.Execute(moduleDef); } bool antiDump = Settings.AntiDump; if (antiDump) { AntiDump.Inject(moduleDef); } bool invalidMetadata = Settings.InvalidMetadata; if (invalidMetadata) { Invalid_Metadata.InvalidMD(moduleDef); } bool calli = Settings.Calli; if (calli) { Calli.Execute(moduleDef); } bool antiHTTPDebugger = Settings.AntiHTTPDebugger; if (antiHTTPDebugger) { Anti_Http_Debugger.Execute(moduleDef); } bool antiFiddler = Settings.AntiFiddler; if (antiFiddler) { Anti_Fiddler.Execute(moduleDef); } bool stringEncryption = Settings.StringEncryption; if (stringEncryption) { String_Encryption.Inject(moduleDef); } Watermark.Execute(moduleDef); ModuleDef manifestModule = moduleDef.Assembly.ManifestModule; moduleDef.EntryPoint.Name = "BlinkRE"; moduleDef.Mvid = new Guid?(Guid.NewGuid()); bool strong = Settings.Strong; if (strong) { Protection.Protect(moduleDef); Inject.ProtectValue(moduleDef); Inject.DoubleProtect(moduleDef); Inject.Triple(moduleDef); Inject.Triple(moduleDef); Method_Wiper.Execute(moduleDef); Assembly.MarkAssembly(moduleDef); Locals.Protect(moduleDef); } Directory.CreateDirectory(".\\AtomicProtected"); moduleDef.Write(".\\AtomicProtected\\" + Path.GetFileName(this.metroTextBox1.Text), new ModuleWriterOptions(moduleDef) { PEHeadersOptions = { NumberOfRvaAndSizes = new uint?(13U) }, MetaDataOptions = { TablesHeapOptions = { ExtraData = new uint?(4919U) } }, Logger = DummyLogger.NoThrowInstance }); Process.Start(".\\AtomicProtected"); MessageBox.Show("Obfuscation complete! Restart to obfuscate again"); Environment.Exit(0); }