Decrypt encrypted strings resource before initializing string decrypter

This commit is contained in:
de4dot 2012-07-31 10:09:45 +02:00
parent f370824a46
commit 4b2da13972
2 changed files with 6 additions and 5 deletions

View File

@ -285,7 +285,8 @@ namespace de4dot.code.deobfuscators.Confuser {
return;
hasInitializedStringDecrypter = true;
if (stringDecrypter != null) {
if (stringDecrypter != null && stringDecrypter.Detected) {
decryptResources();
stringDecrypter.initialize();
staticStringInliner.add(stringDecrypter.Method, (method, gim, args) => stringDecrypter.decrypt(staticStringInliner.Method, (int)args[0]));
}

View File

@ -301,9 +301,6 @@ namespace de4dot.code.deobfuscators.Confuser {
simpleDeobfuscator.deobfuscate(method);
var tmpResource = findResource(method);
if (tmpResource == null)
continue;
if (!findMagic1(method, out magic1))
continue;
if (!findMagic2(method, out magic2))
@ -318,7 +315,6 @@ namespace de4dot.code.deobfuscators.Confuser {
else
continue;
resource = tmpResource;
decryptMethod = method;
break;
}
@ -384,6 +380,10 @@ namespace de4dot.code.deobfuscators.Confuser {
public void initialize() {
if (decryptMethod == null)
return;
resource = findResource(decryptMethod);
if (resource == null)
throw new ApplicationException("Could not find encrypted strings resource");
reader = new BinaryReader(new MemoryStream(DeobUtils.inflate(resource.GetResourceData(), true)));
switch (version) {