Use the new lookup() method
This commit is contained in:
parent
4ecedb5b01
commit
a0509d2735
|
@ -46,19 +46,20 @@ namespace de4dot.deobfuscators.dotNET_Reactor {
|
|||
|
||||
public EncryptedResource(ModuleDefinition module, EncryptedResource oldOne) {
|
||||
this.module = module;
|
||||
if (oldOne.resourceDecrypterMethod != null)
|
||||
resourceDecrypterMethod = module.LookupToken(oldOne.resourceDecrypterMethod.MetadataToken.ToInt32()) as MethodDefinition;
|
||||
resourceDecrypterMethod = lookup(oldOne.resourceDecrypterMethod, "Could not find resource decrypter method");
|
||||
if (oldOne.encryptedDataResource != null)
|
||||
encryptedDataResource = DotNetUtils.getResource(module, oldOne.encryptedDataResource.Name) as EmbeddedResource;
|
||||
key = oldOne.key;
|
||||
iv = oldOne.iv;
|
||||
|
||||
if (resourceDecrypterMethod == null && oldOne.resourceDecrypterMethod != null)
|
||||
throw new ApplicationException("Could not initialize EncryptedResource");
|
||||
if (encryptedDataResource == null && oldOne.encryptedDataResource != null)
|
||||
throw new ApplicationException("Could not initialize EncryptedResource");
|
||||
}
|
||||
|
||||
T lookup<T>(T def, string errorMessage) where T : MemberReference {
|
||||
return DeobUtils.lookup(module, def, errorMessage);
|
||||
}
|
||||
|
||||
public bool couldBeResourceDecrypter(MethodDefinition method, IList<string> additionalTypes) {
|
||||
if (!method.IsStatic)
|
||||
return false;
|
||||
|
|
|
@ -80,16 +80,14 @@ namespace de4dot.deobfuscators.dotNET_Reactor {
|
|||
this.stringDecrypterVersion = oldOne.stringDecrypterVersion;
|
||||
this.encryptedResource = new EncryptedResource(module, oldOne.encryptedResource);
|
||||
foreach (var oldInfo in oldOne.decrypterInfos) {
|
||||
var method = module.LookupToken(oldInfo.method.MetadataToken.ToInt32()) as MethodDefinition;
|
||||
if (method == null)
|
||||
throw new ApplicationException("Could not find string decrypter method");
|
||||
var method = lookup(oldInfo.method, "Could not find string decrypter method");
|
||||
decrypterInfos.Add(new DecrypterInfo(method, oldInfo.key, oldInfo.iv));
|
||||
}
|
||||
if (oldOne.otherStringDecrypter != null) {
|
||||
otherStringDecrypter = module.LookupToken(oldOne.otherStringDecrypter.MetadataToken.ToInt32()) as MethodDefinition;
|
||||
if (otherStringDecrypter == null)
|
||||
throw new ApplicationException("Could not find string decrypter method");
|
||||
}
|
||||
otherStringDecrypter = lookup(oldOne.otherStringDecrypter, "Could not find string decrypter method");
|
||||
}
|
||||
|
||||
T lookup<T>(T def, string errorMessage) where T : MemberReference {
|
||||
return DeobUtils.lookup(module, def, errorMessage);
|
||||
}
|
||||
|
||||
public void find(ISimpleDeobfuscator simpleDeobfuscator) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user