Ejemplo n.º 1
0
        protected override void scanForObfuscator()
        {
            foreach (var type in module.Types)
            {
                if (type.FullName == "CryptoObfuscator.ProtectedWithCryptoObfuscatorAttribute")
                {
                    foundCryptoObfuscatorAttribute = true;
                    addAttributeToBeRemoved(type, "Obfuscator attribute");
                    initializeVersion(type);
                }
            }
            if (checkCryptoObfuscator())
            {
                foundObfuscatedSymbols = true;
            }

            methodsDecrypter = new MethodsDecrypter(module);
            methodsDecrypter.find();
            proxyCallFixer = new ProxyCallFixer(module);
            proxyCallFixer.findDelegateCreator();
            stringDecrypter = new StringDecrypter(module);
            stringDecrypter.find();
            tamperDetection = new TamperDetection(module);
            tamperDetection.find();
            constantsDecrypter = new ConstantsDecrypter(module);
            constantsDecrypter.find();
            foundObfuscatorUserString = Utils.StartsWith(module.GetUserString(0x70000001), "\u0011\"3D9B94A98B-76A8-4810-B1A0-4BE7C4F9C98D", StringComparison.Ordinal);
        }
Ejemplo n.º 2
0
        protected override void scanForObfuscator()
        {
            foreach (var type in module.Types) {
                if (type.FullName == "CryptoObfuscator.ProtectedWithCryptoObfuscatorAttribute") {
                    foundCryptoObfuscatorAttribute = true;
                    addAttributeToBeRemoved(type, "Obfuscator attribute");
                    initializeVersion(type);
                }
            }
            if (checkCryptoObfuscator())
                foundObfuscatedSymbols = true;

            methodsDecrypter = new MethodsDecrypter(module);
            methodsDecrypter.find();
            proxyCallFixer = new ProxyCallFixer(module);
            proxyCallFixer.findDelegateCreator();
            stringDecrypter = new StringDecrypter(module);
            stringDecrypter.find();
            tamperDetection = new TamperDetection(module);
            tamperDetection.find();
            constantsDecrypter = new ConstantsDecrypter(module);
            constantsDecrypter.find();
            foundObfuscatorUserString = Utils.StartsWith(module.ReadUserString(0x70000001), "\u0011\"3D9B94A98B-76A8-4810-B1A0-4BE7C4F9C98D", StringComparison.Ordinal);
        }
Ejemplo n.º 3
0
        protected override void scanForObfuscator()
        {
            foreach (var type in module.Types) {
                if (type.FullName == "CryptoObfuscator.ProtectedWithCryptoObfuscatorAttribute") {
                    foundCryptoObfuscatorAttribute = true;
                    addAttributeToBeRemoved(type, "Obfuscator attribute");
                    initializeVersion(type);
                }
            }
            if (checkCryptoObfuscator())
                foundObfuscatedSymbols = true;

            proxyDelegateFinder = new ProxyDelegateFinder(module);
            proxyDelegateFinder.findDelegateCreator();
            stringDecrypter = new StringDecrypter(module);
            stringDecrypter.find();
            tamperDetection = new TamperDetection(module);
            tamperDetection.find();
        }
Ejemplo n.º 4
0
        public override void deobfuscateBegin()
        {
            base.deobfuscateBegin();

            resourceDecrypter = new ResourceDecrypter(module, DeobfuscatedFile);
            resourceResolver  = new ResourceResolver(module, resourceDecrypter);
            assemblyResolver  = new AssemblyResolver(module);
            resourceResolver.find();
            assemblyResolver.find();

            decryptResources();
            stringDecrypter.init(resourceDecrypter);
            if (stringDecrypter.Method != null)
            {
                staticStringInliner.add(stringDecrypter.Method, (method, gim, args) => {
                    return(stringDecrypter.decrypt((int)args[0]));
                });
                DeobfuscatedFile.stringDecryptersAdded();
            }

            methodsDecrypter.decrypt(resourceDecrypter);

            if (methodsDecrypter.Detected)
            {
                if (!assemblyResolver.Detected)
                {
                    assemblyResolver.find();
                }
                if (!tamperDetection.Detected)
                {
                    tamperDetection.find();
                }
            }
            antiDebugger = new AntiDebugger(module, DeobfuscatedFile, this);
            antiDebugger.find();

            if (options.DecryptConstants)
            {
                constantsDecrypter.init(resourceDecrypter);
                int32ValueInliner = new Int32ValueInliner();
                int32ValueInliner.add(constantsDecrypter.Int32Decrypter, (method, gim, args) => constantsDecrypter.decryptInt32((int)args[0]));
                int64ValueInliner = new Int64ValueInliner();
                int64ValueInliner.add(constantsDecrypter.Int64Decrypter, (method, gim, args) => constantsDecrypter.decryptInt64((int)args[0]));
                singleValueInliner = new SingleValueInliner();
                singleValueInliner.add(constantsDecrypter.SingleDecrypter, (method, gim, args) => constantsDecrypter.decryptSingle((int)args[0]));
                doubleValueInliner = new DoubleValueInliner();
                doubleValueInliner.add(constantsDecrypter.DoubleDecrypter, (method, gim, args) => constantsDecrypter.decryptDouble((int)args[0]));
                addTypeToBeRemoved(constantsDecrypter.Type, "Constants decrypter type");
                addResourceToBeRemoved(constantsDecrypter.Resource, "Encrypted constants");
            }

            addModuleCctorInitCallToBeRemoved(resourceResolver.Method);
            addModuleCctorInitCallToBeRemoved(assemblyResolver.Method);
            addCallToBeRemoved(module.EntryPoint, tamperDetection.Method);
            addModuleCctorInitCallToBeRemoved(tamperDetection.Method);
            addCallToBeRemoved(module.EntryPoint, antiDebugger.Method);
            addModuleCctorInitCallToBeRemoved(antiDebugger.Method);
            addTypeToBeRemoved(resourceResolver.Type, "Resource resolver type");
            addTypeToBeRemoved(assemblyResolver.Type, "Assembly resolver type");
            addTypeToBeRemoved(tamperDetection.Type, "Tamper detection type");
            addTypeToBeRemoved(antiDebugger.Type, "Anti-debugger type");
            addTypeToBeRemoved(methodsDecrypter.Type, "Methods decrypter type");
            addTypesToBeRemoved(methodsDecrypter.DelegateTypes, "Methods decrypter delegate type");
            addResourceToBeRemoved(methodsDecrypter.Resource, "Encrypted methods");

            proxyCallFixer.find();

            dumpEmbeddedAssemblies();
        }