当前位置: 首页>>代码示例>>C#>>正文


C# DotNet.ModuleDefMD类代码示例

本文整理汇总了C#中dnlib.DotNet.ModuleDefMD的典型用法代码示例。如果您正苦于以下问题:C# ModuleDefMD类的具体用法?C# ModuleDefMD怎么用?C# ModuleDefMD使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ModuleDefMD类属于dnlib.DotNet命名空间,在下文中一共展示了ModuleDefMD类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: create

        public static EmbeddedAssemblyInfo create(ModuleDefMD module, string encName, string rsrcName)
        {
            var info = new EmbeddedAssemblyInfo();

            try {
                if (encName == "" || Convert.ToBase64String(Convert.FromBase64String(encName)) != encName)
                    return null;
            }
            catch (FormatException) {
                return null;
            }

            if (rsrcName.Length > 0 && rsrcName[0] == '[') {
                int i = rsrcName.IndexOf(']');
                if (i < 0)
                    return null;
                info.flags = rsrcName.Substring(1, i - 1);
                info.isTempFile = info.flags.IndexOf('t') >= 0;
                info.isCompressed = info.flags.IndexOf('z') >= 0;
                rsrcName = rsrcName.Substring(i + 1);
            }
            if (rsrcName == "")
                return null;

            info.assemblyName = Encoding.UTF8.GetString(Convert.FromBase64String(encName));
            info.resourceName = rsrcName;
            info.resource = DotNetUtils.getResource(module, rsrcName) as EmbeddedResource;
            info.simpleName = Utils.getAssemblySimpleName(info.assemblyName);

            return info;
        }
开发者ID:GodLesZ,项目名称:ConfuserDeobfuscator,代码行数:31,代码来源:AssemblyResolverInfo.cs

示例2: AssemblyResolver

 public AssemblyResolver(ModuleDefMD module, DecrypterType decrypterType)
 {
     this.module = module;
     this.frameworkType = DotNetUtils.getFrameworkType(module);
     this.decrypterType = decrypterType;
     this.codeCompilerMethodCallRestorer = new CodeCompilerMethodCallRestorer(module);
 }
开发者ID:GodLesZ,项目名称:ConfuserDeobfuscator,代码行数:7,代码来源:AssemblyResolver.cs

示例3: ReferenceFolderTreeNode

 public ReferenceFolderTreeNode(ModuleDefMD module, AssemblyTreeNode parentAssembly, AssemblyListTreeNode assemblyListTreeNode)
 {
     this.module = module;
     this.parentAssembly = parentAssembly;
     this.assemblyListTreeNode = assemblyListTreeNode;
     this.LazyLoading = true;
 }
开发者ID:gsong2014,项目名称:dnSpy,代码行数:7,代码来源:ReferenceFolderTreeNode.cs

示例4: ImageReader

 public ImageReader(IDeobfuscatorContext deobfuscatorContext, ModuleDefMD module, byte[] data)
 {
     this.deobfuscatorContext = deobfuscatorContext;
     this.module = module;
     this.reader = MemoryImageStream.Create(data);
     this.memberRefConverter = new MemberRefConverter(module);
 }
开发者ID:GodLesZ,项目名称:ConfuserDeobfuscator,代码行数:7,代码来源:ImageReader.cs

示例5: MethodsDecrypter

		public MethodsDecrypter(ModuleDefMD module, MethodsDecrypter oldOne) {
			this.module = module;
			this.encryptedResource = new EncryptedResource(module, oldOne.encryptedResource);
			this.tokenToNativeMethod = oldOne.tokenToNativeMethod;
			this.totalEncryptedNativeMethods = oldOne.totalEncryptedNativeMethods;
			this.xorKey = oldOne.xorKey;
		}
开发者ID:RafaelRMachado,项目名称:de4dot,代码行数:7,代码来源:MethodsDecrypter.cs

示例6: findEmbeddedResource

 public static EmbeddedResource findEmbeddedResource(ModuleDefMD module, TypeDef decrypterType, ISimpleDeobfuscator simpleDeobfuscator, IDeobfuscator deob)
 {
     return findEmbeddedResource(module, decrypterType, (method) => {
         simpleDeobfuscator.deobfuscate(method);
         simpleDeobfuscator.decryptStrings(method, deob);
     });
 }
开发者ID:GodLesZ,项目名称:ConfuserDeobfuscator,代码行数:7,代码来源:BabelUtils.cs

示例7: SetModule

		ModuleDefMD SetModule(ModuleDefMD newModule) {
			module = newModule;
			TheAssemblyResolver.Instance.AddModule(module);
			module.EnableTypeDefFindCache = true;
			module.Location = filename;
			return module;
		}
开发者ID:RafaelRMachado,项目名称:de4dot,代码行数:7,代码来源:AssemblyModule.cs

示例8: CreateField

 private static FieldDef CreateField(ModuleDefMD module)
 {
     FieldAttributes attrb = FieldAttributes.Public | FieldAttributes.Static | FieldAttributes.HasFieldRVA | FieldAttributes.CompilerControlled;
     FieldDef field = new FieldDefUser("", new FieldSig(module.CorLibTypes.String), attrb);
     RenameTask.Rename(field);
     return field;
 }
开发者ID:M3rcurio,项目名称:denvlib,代码行数:7,代码来源:StringEncodingTaskTest.cs

示例9: Analyze

        public BamlDocument Analyze(ModuleDefMD module, string bamlName, byte[] data)
        {
            this.module = module;
            this.bamlName = bamlName;
            if (module.IsClr40) {
                things = thingsv4 ?? (thingsv4 = new KnownThingsv4(context, module));
            }
            else {
                things = thingsv3 ?? (thingsv3 = new KnownThingsv3(context, module));
            }

            Debug.Assert(BitConverter.ToInt32(data, 0) == data.Length - 4);

            BamlDocument document = BamlReader.ReadDocument(new MemoryStream(data, 4, data.Length - 4));

            // Remove debug infos
            document.RemoveWhere(rec => rec is LineNumberAndPositionRecord || rec is LinePositionRecord);

            // Populate references
            PopulateReferences(document);

            // Process elements
            BamlElement rootElem = BamlElement.Read(document);
            BamlElement trueRoot = rootElem.Children.Single();
            var stack = new Stack<BamlElement>();
            stack.Push(rootElem);
            while (stack.Count > 0) {
                BamlElement elem = stack.Pop();
                ProcessBAMLElement(trueRoot, elem);
                foreach (BamlElement child in elem.Children)
                    stack.Push(child);
            }

            return document;
        }
开发者ID:2sic4you,项目名称:ConfuserEx,代码行数:35,代码来源:BAMLAnalyzer.cs

示例10: DecryptStringsInMethod

        /// <summary>
        /// 
        /// </summary>
        /// <param name="module">The .NET protected ModuleDefMD</param>
        /// <param name="Methoddecryption">The method which decrypt the strings</param>
        public static void DecryptStringsInMethod(ModuleDefMD module, MethodDef Methoddecryption)
        {
            foreach (TypeDef type in module.Types)
            {
                foreach (MethodDef method in type.Methods)
                {
                    if (!method.HasBody)
                        break;
                    for (int i = 0; i < method.Body.Instructions.Count; i++)
                    {
                        if (method.Body.Instructions[i].OpCode == OpCodes.Call)
                        {
                            if (method.Body.Instructions[i].Operand.ToString().ToLower().Contains(Typedecryption.Name.ToLower()))
                            {
                                Type2Remove.Add(Typedecryption);
                                var CalledDecMethod = (MethodDef)method.Body.Instructions[i].Operand;
                                var decryptedstring = ExtractStringFromMethod(CalledDecMethod);
                                if (decryptedstring == "[DEObfuscar] Error")
                                {
                                    //
                                }
                                else
                                {
                                    CilBody body = method.Body;
                                    body.Instructions[i].OpCode = OpCodes.Ldstr;
                                    body.Instructions[i].Operand = decryptedstring;
                                    DeobedStringNumber = DeobedStringNumber + 1;
                                }
                            }

                        }
                    }
                }
            }
        }
开发者ID:XenocodeRCE,项目名称:DEObfuscar,代码行数:40,代码来源:Helper.cs

示例11: GetDecryptType

        public static MethodDef GetDecryptType(ModuleDefMD asmodule)
        {
            //
            var module_types = asmodule.Types;
            asm = asmodule;
            //
            foreach (TypeDef type in module_types)
            {
                if (type.Name == "<Module>") continue;
                foreach (MethodDef method in type.Methods)
                {
                    if (!method.HasBody) continue;
                    if (!method.IsConstructor) continue;
                    var instrsdec = method.Body.Instructions;
                    if (instrsdec.Count < 5) continue;
                    for (int i = 0; i < instrsdec.Count; i++)
                    {
                        if (method.Body.Instructions[0].OpCode == OpCodes.Ldstr && method.Body.Instructions[1].OpCode == OpCodes.Call
                            && method.Body.Instructions[2].OpCode == OpCodes.Stsfld)
                        {

                            return method;
                        }

                    }
                }
            }
            return null;
        }
开发者ID:XenocodeRCE,项目名称:UnSharper,代码行数:29,代码来源:Helper.cs

示例12: ResolverBase

 public ResolverBase(ModuleDefMD module, ISimpleDeobfuscator simpleDeobfuscator, IDeobfuscator deob)
 {
     this.module = module;
     this.frameworkType = DotNetUtils.getFrameworkType(module);
     this.simpleDeobfuscator = simpleDeobfuscator;
     this.deob = deob;
 }
开发者ID:n017,项目名称:ConfuserDeobfuscator,代码行数:7,代码来源:ResolverBase.cs

示例13: ResourceWriter

 ResourceWriter(ModuleDefMD module, Stream stream, ResourceElementSet resources)
 {
     this.module = module;
     this.typeCreator = new ResourceDataCreator(module);
     this.writer = new BinaryWriter(stream);
     this.resources = resources;
 }
开发者ID:GreenDamTan,项目名称:de4dot,代码行数:7,代码来源:ResourceWriter.cs

示例14: InitAssemblies

		// Following codes are auto-generated, do not modify.

		void InitAssemblies(ModuleDefMD initMod) {
			assemblies[0] = context.Resolver.ResolveThrow("PresentationFramework, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35", initMod);
			assemblies[1] = context.Resolver.ResolveThrow("PresentationCore, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35", initMod);
			assemblies[2] = context.Resolver.ResolveThrow("mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089", initMod);
			assemblies[3] = context.Resolver.ResolveThrow("System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089", initMod);
			assemblies[4] = context.Resolver.ResolveThrow("WindowsBase, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35", initMod);
			assemblies[5] = context.Resolver.ResolveThrow("System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089", initMod);
		}
开发者ID:EmilZhou,项目名称:ConfuserEx,代码行数:10,代码来源:KnownThingsv3.cs

示例15: GetInstrumentationMethods

 private static List<MethodDef> GetInstrumentationMethods(ModuleDefMD instrumentationAssembly, TypeDef instrumentedAttribute, ModuleDefMD sourceAssembly)
 {
     return instrumentationAssembly.Types
         .Where(x => x.FullName != instrumentedAttribute.FullName)
         .Where(x => FindSourceType(x.ToTypeSig(), sourceAssembly) != null)
         .SelectMany(x => x.Methods)
         .Where(y => y.CustomAttributes.Any(x => x.AttributeType == instrumentedAttribute)).ToList();
 }
开发者ID:AndrewSav,项目名称:AddInstrumentation,代码行数:8,代码来源:Program.cs


注:本文中的dnlib.DotNet.ModuleDefMD类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。