本文整理汇总了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;
}
示例2: AssemblyResolver
public AssemblyResolver(ModuleDefMD module, DecrypterType decrypterType)
{
this.module = module;
this.frameworkType = DotNetUtils.getFrameworkType(module);
this.decrypterType = decrypterType;
this.codeCompilerMethodCallRestorer = new CodeCompilerMethodCallRestorer(module);
}
示例3: ReferenceFolderTreeNode
public ReferenceFolderTreeNode(ModuleDefMD module, AssemblyTreeNode parentAssembly, AssemblyListTreeNode assemblyListTreeNode)
{
this.module = module;
this.parentAssembly = parentAssembly;
this.assemblyListTreeNode = assemblyListTreeNode;
this.LazyLoading = true;
}
示例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);
}
示例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;
}
示例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);
});
}
示例7: SetModule
ModuleDefMD SetModule(ModuleDefMD newModule) {
module = newModule;
TheAssemblyResolver.Instance.AddModule(module);
module.EnableTypeDefFindCache = true;
module.Location = filename;
return module;
}
示例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;
}
示例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;
}
示例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;
}
}
}
}
}
}
}
示例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;
}
示例12: ResolverBase
public ResolverBase(ModuleDefMD module, ISimpleDeobfuscator simpleDeobfuscator, IDeobfuscator deob)
{
this.module = module;
this.frameworkType = DotNetUtils.getFrameworkType(module);
this.simpleDeobfuscator = simpleDeobfuscator;
this.deob = deob;
}
示例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;
}
示例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);
}
示例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();
}