void initDecrypters() { assemblyResolverInfo = new AssemblyResolverInfo(module, DeobfuscatedFile, this); assemblyResolverInfo.findTypes(); resourceDecrypterInfo = new ResourceDecrypterInfo(module, assemblyResolverInfo.SimpleZipType, DeobfuscatedFile); resourceResolverInfo = new ResourceResolverInfo(module, DeobfuscatedFile, this, assemblyResolverInfo); resourceResolverInfo.findTypes(); resourceDecrypter = new ResourceDecrypter(resourceDecrypterInfo); assemblyResolver = new AssemblyResolver(resourceDecrypter, assemblyResolverInfo); resourceResolver = new ResourceResolver(module, assemblyResolver, resourceResolverInfo); initStringDecrypterInfos(); assemblyResolverInfo.findTypes(); resourceResolverInfo.findTypes(); addModuleCctorInitCallToBeRemoved(assemblyResolverInfo.CallResolverMethod); addModuleCctorInitCallToBeRemoved(resourceResolverInfo.CallResolverMethod); resourceDecrypterInfo.setSimpleZipType(getGlobalSimpleZipType(), DeobfuscatedFile); if (!decryptResources()) throw new ApplicationException("Could not decrypt resources"); dumpEmbeddedAssemblies(); }
public bool init(IDeobfuscator deob, ISimpleDeobfuscator simpleDeobfuscator) { var cctor = DotNetUtils.getMethod(stringsEncodingClass, ".cctor"); if (cctor == null) throw new ApplicationException("Could not find .cctor"); simpleDeobfuscator.deobfuscate(cctor); stringsResource = findStringResource(cctor); if (stringsResource == null) { simpleDeobfuscator.decryptStrings(cctor, deob); stringsResource = findStringResource(cctor); if (stringsResource == null) return false; } var offsetVal = findOffsetValue(cctor); if (offsetVal == null) throw new ApplicationException("Could not find string offset"); stringOffset = offsetVal.Value; if (!findDecrypterMethod()) throw new ApplicationException("Could not find string decrypter method"); simpleZipType = findSimpleZipType(cctor); if (simpleZipType != null) resourceDecrypter = new ResourceDecrypter(new ResourceDecrypterInfo(module, simpleZipType, simpleDeobfuscator)); return true; }
public AssemblyResolver(ResourceDecrypter resourceDecrypter, AssemblyResolverInfo assemblyResolverInfo) { this.resourceDecrypter = resourceDecrypter; this.assemblyResolverInfo = assemblyResolverInfo; }