Beispiel #1
0
        void deobfuscateMethods()
        {
            if (savedMethodBodies != null) {
                savedMethodBodies.restoreAll();
                savedMethodBodies = null;
            }
            deob.DeobfuscatedFile = null;

            Log.v("Deobfuscating methods");
            foreach (var method in allMethods) {
                Log.v("Deobfuscating {0} ({1:X8})", method, method.MetadataToken.ToUInt32());
                Log.indent();

                if (hasNonEmptyBody(method)) {
                    var blocks = new Blocks(method);

                    deob.deobfuscateMethodBegin(blocks);
                    if (options.ControlFlowDeobfuscation) {
                        int numDeadBlocks = blocks.deobfuscate();
                        if (numDeadBlocks > 0)
                            Log.v("Removed {0} dead block(s)", numDeadBlocks);
                    }
                    deobfuscateStrings(blocks);
                    deob.deobfuscateMethodEnd(blocks);
                    if (options.ControlFlowDeobfuscation)
                        blocks.deobfuscateLeaveObfuscation();

                    IList<Instruction> allInstructions;
                    IList<ExceptionHandler> allExceptionHandlers;
                    blocks.getCode(out allInstructions, out allExceptionHandlers);
                    DotNetUtils.restoreBody(method, allInstructions, allExceptionHandlers);
                }

                removeNoInliningAttribute(method);

                Log.deIndent();
            }
        }