Exemplo n.º 1
0
        void DetectObfuscator(IEnumerable <IDeobfuscator> deobfuscators)
        {
            // The deobfuscators may call methods to deobfuscate control flow and decrypt
            // strings (statically) in order to detect the obfuscator.
            if (!options.ControlFlowDeobfuscation || options.StringDecrypterType == DecrypterType.None)
            {
                savedMethodBodies = new SavedMethodBodies();
            }

            // It's not null if it unpacked a native file
            if (this.deob != null)
            {
                deob.Initialize(module);
                deob.DeobfuscatedFile = this;
                deob.Detect();
                return;
            }

            foreach (var deob in deobfuscators)
            {
                deob.Initialize(module);
                deob.DeobfuscatedFile = this;
            }

            if (options.ForcedObfuscatorType != null)
            {
                foreach (var deob in deobfuscators)
                {
                    if (string.Equals(options.ForcedObfuscatorType, deob.Type, StringComparison.OrdinalIgnoreCase))
                    {
                        this.deob = deob;
                        deob.Detect();
                        return;
                    }
                }
            }
            else
            {
                this.deob = DetectObfuscator2(deobfuscators);
            }
        }