本文整理汇总了C#中ISimpleDeobfuscator.MethodModified方法的典型用法代码示例。如果您正苦于以下问题:C# ISimpleDeobfuscator.MethodModified方法的具体用法?C# ISimpleDeobfuscator.MethodModified怎么用?C# ISimpleDeobfuscator.MethodModified使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ISimpleDeobfuscator
的用法示例。
在下文中一共展示了ISimpleDeobfuscator.MethodModified方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RestoreMethodBodies
void RestoreMethodBodies(ISimpleDeobfuscator simpleDeobfuscator) {
var methodToOrigMethods = new MethodDefAndDeclaringTypeDict<List<MethodDef>>();
foreach (var t in module.Types) {
var types = new List<TypeDef>(AllTypesHelper.Types(new List<TypeDef> { t }));
foreach (var type in types) {
if (methodsTypes.Find(type))
continue;
foreach (var method in type.Methods) {
if (method.Name == ".ctor" || method.Name == ".cctor")
continue;
MethodDef calledMethod;
if (!CheckRestoreBody(method, out calledMethod))
continue;
if (!CheckSameMethods(method, calledMethod))
continue;
if (!methodsTypes.Find(calledMethod.DeclaringType))
continue;
if (types.IndexOf(calledMethod.DeclaringType) < 0)
continue;
var list = methodToOrigMethods.Find(calledMethod);
if (list == null)
methodToOrigMethods.Add(calledMethod, list = new List<MethodDef>());
list.Add(method);
}
}
}
foreach (var calledMethod in methodToOrigMethods.GetKeys()) {
var list = methodToOrigMethods.Find(calledMethod);
var method = list[0];
Logger.v("Restored method body {0:X8} from method {1:X8}",
method.MDToken.ToInt32(),
calledMethod.MDToken.ToInt32());
DotNetUtils.CopyBodyFromTo(calledMethod, method);
classMethods.Add(calledMethod, method);
simpleDeobfuscator.MethodModified(method);
}
}
示例2: Decrypt
void Decrypt(IBinaryReader reader, int delegateTypeToken, ISimpleDeobfuscator simpleDeobfuscator) {
var delegateType = module.ResolveToken(delegateTypeToken) as TypeDef;
if (delegateType == null)
throw new ApplicationException("Couldn't find delegate type");
int delToken, encMethToken, encDeclToken;
if (!GetTokens(delegateType, out delToken, out encMethToken, out encDeclToken))
throw new ApplicationException("Could not find encrypted method tokens");
if (delToken != delegateTypeToken)
throw new ApplicationException("Invalid delegate type token");
var encType = module.ResolveToken(encDeclToken) as ITypeDefOrRef;
if (encType == null)
throw new ApplicationException("Invalid declaring type token");
var encMethod = module.ResolveToken(encMethToken) as MethodDef;
if (encMethod == null)
throw new ApplicationException("Invalid encrypted method token");
var bodyReader = new MethodBodyReader(module, reader);
bodyReader.Read(encMethod);
bodyReader.RestoreMethod(encMethod);
Logger.v("Restored method {0} ({1:X8}). Instrs:{2}, Locals:{3}, Exceptions:{4}",
Utils.RemoveNewlines(encMethod.FullName),
encMethod.MDToken.ToInt32(),
encMethod.Body.Instructions.Count,
encMethod.Body.Variables.Count,
encMethod.Body.ExceptionHandlers.Count);
delegateTypes.Add(delegateType);
simpleDeobfuscator.MethodModified(encMethod);
}