protected override void Execute(ConfuserContext context, ProtectionParameters parameters) { var marker = context.Registry.GetService <IMarkerService>(); var name = context.Registry.GetService <INameService>(); RandomGenerator random = context.Registry.GetService <IRandomService>().GetRandomGenerator(Parent.FullId); foreach (ModuleDef module in parameters.Targets.OfType <ModuleDef>()) { InterfaceImpl interfaceM = new InterfaceImplUser(module.GlobalType); TypeDef typeDef1 = new TypeDefUser("", name.RandomName(), module.CorLibTypes.GetTypeRef("System", "Attribute")); InterfaceImpl interface1 = new InterfaceImplUser(typeDef1); module.Types.Add(typeDef1); typeDef1.Interfaces.Add(interface1); typeDef1.Interfaces.Add(interfaceM); marker.Mark(typeDef1, Parent); name.SetCanRename(typeDef1, false); for (int i = 0; i < random.NextInt32(4, 15); i++) { TypeDef typeDef2 = new TypeDefUser("", name.RandomName(), module.CorLibTypes.GetTypeRef("System", "Attribute")); InterfaceImpl interface2 = new InterfaceImplUser(typeDef2); module.Types.Add(typeDef2); typeDef2.Interfaces.Add(interface2); typeDef2.Interfaces.Add(interfaceM); typeDef2.Interfaces.Add(interface1); marker.Mark(typeDef2, Parent); name.SetCanRename(typeDef2, false); } } }
public static void Run(ModuleDefMD module) { for (int i = 0; i < 150; i++) { var junkattribute = new TypeDefUser("ScoldProtect" + RandomString(Random.Next(10, 20), Ascii), module.CorLibTypes.Object.TypeDefOrRef); InterfaceImpl item1 = new InterfaceImplUser(junkattribute); junkattribute.Interfaces.Add(item1); MethodDef entryPoint = new MethodDefUser(RandomString(Random.Next(10, 20), Ascii2), MethodSig.CreateStatic(module.CorLibTypes.Int32, new SZArraySig(module.CorLibTypes.UIntPtr))); entryPoint.Attributes = MethodAttributes.Private | MethodAttributes.Static | MethodAttributes.HideBySig | MethodAttributes.ReuseSlot; entryPoint.ImplAttributes = MethodImplAttributes.IL | MethodImplAttributes.Managed; entryPoint.ParamDefs.Add(new ParamDefUser(RandomString(Random.Next(10, 20), Ascii2), 1)); junkattribute.Methods.Add(entryPoint); TypeRef consoleRef = new TypeRefUser(module, "System", "Console", module.CorLibTypes.AssemblyRef); MemberRef consoleWrite1 = new MemberRefUser(module, "WriteLine", MethodSig.CreateStatic(module.CorLibTypes.Void, module.CorLibTypes.String), consoleRef); CilBody epBody = new CilBody(); entryPoint.Body = epBody; epBody.Instructions.Add(OpCodes.Ldstr.ToInstruction(RandomString(Random.Next(10, 20), Ascii2))); epBody.Instructions.Add(OpCodes.Call.ToInstruction(consoleWrite1)); epBody.Instructions.Add(OpCodes.Ldc_I4_0.ToInstruction()); epBody.Instructions.Add(OpCodes.Ret.ToInstruction()); module.Types.Add(junkattribute); } }
InterfaceImpl Clone(InterfaceImpl source) { var result = new InterfaceImplUser(Importer.Import(source.Interface)); CopyCustomAttributes(source, result); CopyCustomDebugInfo(source, result); return(result); }
public static void AntiDe4dot(Context context, ref ModuleDef moduleDef) { InterfaceImpl interfaceMain = new InterfaceImplUser(moduleDef.GlobalType); for (int i = 100; i < 133; i++) { TypeDef typeDef = new TypeDefUser("M.VMF", $"VM_INSTRUCTIONS_BYTE{i.ToString()}", moduleDef.CorLibTypes.GetTypeRef("System", "Attribute")); InterfaceImpl interfaceSub = new InterfaceImplUser(typeDef); moduleDef.Types.Add(typeDef); typeDef.Interfaces.Add(interfaceSub); typeDef.Interfaces.Add(interfaceMain); } }
public void antiDe4Dot(ModuleDefMD module) { Random rnd = new Random(); InterfaceImpl Interface = new InterfaceImplUser(module.GlobalType); for (int i = 200; i < 300; i++) { TypeDef typedef = new TypeDefUser("", $"Form{i.ToString()}", module.CorLibTypes.GetTypeRef("System", "Attribute")); InterfaceImpl interface1 = new InterfaceImplUser(typedef); module.Types.Add(typedef); typedef.Interfaces.Add(interface1); typedef.Interfaces.Add(Interface); } }
public static void Execute(AssemblyDef mod) { foreach (var module in mod.Modules) { var interfaceM = new InterfaceImplUser(module.GlobalType); for (var i = 0; i < 1; i++) { var typeDef1 = new TypeDefUser(string.Empty, $"Form{i}", module.CorLibTypes.GetTypeRef("System", "Attribute")); var interface1 = new InterfaceImplUser(typeDef1); module.Types.Add(typeDef1); typeDef1.Interfaces.Add(interface1); typeDef1.Interfaces.Add(interfaceM); } } }
void IProtector.ProtectionPhase(Context krawk) { var ManifestModule = krawk.ManifestModule; TypeDef typeDef1 = new TypeDefUser("", "Form", ManifestModule.CorLibTypes.GetTypeRef("System", "Attribute")); InterfaceImpl item1 = new InterfaceImplUser(typeDef1); ManifestModule.Types.Add(typeDef1); typeDef1.Interfaces.Add(item1); TypeDef typeDef2 = new TypeDefUser("", "Program", ManifestModule.CorLibTypes.GetTypeRef("System", "Attribute")); InterfaceImpl item2 = new InterfaceImplUser(typeDef2); ManifestModule.Types.Add(typeDef2); typeDef2.Interfaces.Add(item2); }
public static void Yeboy(Context context) { Random rnd = new Random(); foreach (ModuleDef module in context.Assembly.Modules) { InterfaceImpl interfaceM = new InterfaceImplUser(module.GlobalType); for (int i = 100; i < 150; i++) { TypeDef typeDef1 = new TypeDefUser("", $"Form{i.ToString()}", module.CorLibTypes.GetTypeRef("System", "Attribute")); InterfaceImpl interface1 = new InterfaceImplUser(typeDef1); module.Types.Add(typeDef1); typeDef1.Interfaces.Add(interface1); typeDef1.Interfaces.Add(interfaceM); } } }
// Token: 0x06000047 RID: 71 RVA: 0x0000575C File Offset: 0x0000395C public static void RemoveDe4dot(ModuleDef md) { Anti_De4dot.publicmodule = md; for (int i = 1; i < 100; i++) { TypeDef typeDef = new TypeDefUser("", Renamer.Random(100) + Renamer.Random(100), md.CorLibTypes.GetTypeRef("System", "Attribute")); InterfaceImpl item = new InterfaceImplUser(typeDef); md.Types.Add(typeDef); typeDef.Interfaces.Add(item); } Anti_De4dot.xenocode(); Anti_De4dot.smartassembly(); Anti_De4dot.agile(); Anti_De4dot.goliath(); Anti_De4dot.yano(); Anti_De4dot.crypto(); Anti_De4dot.confuserex(); Anti_De4dot.babel(); Anti_De4dot.dotfuscator(); Anti_De4dot.ninerays(); Anti_De4dot.bithelmet(); Anti_De4dot.mango(); Anti_De4dot.dnguard(); }
protected override void Execute(ConfuserContext context, ProtectionParameters parameters) { foreach (ModuleDef moduleDef in parameters.Targets.OfType <ModuleDef>()) { var name = context.Registry.GetService <INameService>(); var marker = context.Registry.GetService <IMarkerService>(); RandomGenerator r = context.Registry.GetService <IRandomService>().GetRandomGenerator(Parent.FullId); foreach (ModuleDef module in parameters.Targets.OfType <ModuleDef>()) { InterfaceImpl moduleImpl = new InterfaceImplUser(module.GlobalType); for (int i = 0; i < r.NextInt32(20, 50); i++) { TypeDefUser type = new TypeDefUser(module.GlobalType.Namespace, name.RandomName(), module.CorLibTypes.GetTypeRef("System", "Attribute")) { Attributes = TypeAttributes.Public }; type.Interfaces.Add(moduleImpl); for (int j = 0; j < r.NextInt32(20, 25); j++) { MethodDefUser method = new MethodDefUser(name.RandomName(RenameMode.Unicode), MethodSig.CreateInstance(module.CorLibTypes.Void), MethodImplAttributes.Managed, MethodAttributes.Public | MethodAttributes.Static); method.Body = new CilBody(); method.Body.Instructions.Add(Instruction.Create(OpCodes.Ret)); type.Methods.Add(method); } module.Types.Add(type); marker.Mark(type, Parent); name.SetCanRename(type, false); foreach (MethodDef method in type.Methods) { marker.Mark(method, Parent); name.SetCanRename(method, false); } } } ModuleDefMD moduleDefMD = (ModuleDefMD)moduleDef; if (moduleDefMD.FullName.Contains(".exe")) { moduleDefMD.Name = ""; moduleDefMD.Assembly.Name = ""; int num = context.Modules.Count - 1; for (int i = 0; i <= num; i++) { for (int j = 0; j <= 50; j++) { Random rnd = new Random(); new TypeDefUser(Random(15) + "", Random(rnd.Next(1, 20)) + "<Module>", moduleDefMD.CorLibTypes.Object.TypeDefOrRef).Attributes = TypeAttributes.SpecialName; TypeDef item = new TypeDefUser(Random(rnd.Next(1, 25)) + "<Module>", Random(rnd.Next(1, 15)) + "", moduleDefMD.CorLibTypes.Object.TypeDefOrRef) { Attributes = TypeAttributes.ReservedMask }; TypeDef item2 = new TypeDefUser(Random(rnd.Next(1, 20)) + "", Random(rnd.Next(1, 15)) + "<Module>", moduleDefMD.CorLibTypes.Object.TypeDefOrRef) { Attributes = TypeAttributes.ReservedMask }; moduleDefMD.Types.Add(item); moduleDefMD.Types.Add(item2); } Random rnd1 = new Random(); moduleDefMD.EntryPoint.Name = Random(rnd1.Next(1, 10)) + "" + Random(300) + "" + Random(rnd1.Next(1, 10)); } } else { context.Logger.Warn("Junk Cannot be used on a dll"); } } }