Exemple #1
0
        private void Decompile(Dictionary <string, object> pArgs)
        {
            object loader;

            pArgs.TryGetValue("--loader", out loader);
            try
            {
                decompiler.Load((string)pArgs["filename"], (string)loader);
                if (pArgs.TryGetValue("heuristics", out var oHeur))
                {
                    decompiler.Project.Programs[0].User.Heuristics = ((string[])oHeur).ToSortedSet();
                }
                if (pArgs.TryGetValue("metadata", out var oMetadata))
                {
                    decompiler.Project.MetadataFiles.Add(new MetadataFile
                    {
                        Filename = (string)oMetadata
                    });
                }
                decompiler.ScanPrograms();
                decompiler.AnalyzeDataFlow();
                decompiler.ReconstructTypes();
                decompiler.StructureProgram();
                decompiler.WriteDecompilerProducts();
            }
            catch (Exception ex)
            {
                diagnosticSvc.Error(ex, "An error occurred during decompilation.");
            }
        }
Exemple #2
0
        private void Decompile(Dictionary <string, object> pArgs)
        {
            pArgs.TryGetValue("--loader", out object loader);
            try
            {
                var fileName = (string)pArgs["filename"];
                var filePath = Path.GetFullPath(fileName);
                if (!decompiler.Load(filePath, (string)loader))
                {
                    return;
                }

                decompiler.Project.Programs[0].User.ExtractResources =
                    !pArgs.TryGetValue("extract-resources", out var oExtractResources) ||
                    ((string)oExtractResources != "no" && (string)oExtractResources != "false");

                if (pArgs.TryGetValue("heuristics", out var oHeur))
                {
                    decompiler.Project.Programs[0].User.Heuristics = ((string[])oHeur).ToSortedSet();
                }
                if (pArgs.TryGetValue("metadata", out var oMetadata))
                {
                    decompiler.Project.MetadataFiles.Add(new MetadataFile
                    {
                        Filename = (string)oMetadata
                    });
                }
                if (pArgs.ContainsKey("dasm-address"))
                {
                    decompiler.Project.Programs[0].User.ShowAddressesInDisassembly = true;
                }
                if (pArgs.ContainsKey("dasm-bytes"))
                {
                    decompiler.Project.Programs[0].User.ShowBytesInDisassembly = true;
                }
                decompiler.ExtractResources();
                decompiler.ScanPrograms();
                if (!pArgs.ContainsKey("scan-only"))
                {
                    decompiler.AnalyzeDataFlow();
                    decompiler.ReconstructTypes();
                    decompiler.StructureProgram();
                    decompiler.WriteDecompilerProducts();
                }
            }
            catch (Exception ex)
            {
                diagnosticSvc.Error(ex, "An error occurred during decompilation.");
            }
        }
Exemple #3
0
        private void Decompile(Dictionary <string, object> pArgs)
        {
            object loader;

            pArgs.TryGetValue("--loader", out loader);
            try
            {
                decompiler.Load((string)pArgs["filename"], (string)loader);
                decompiler.ScanPrograms();
                decompiler.AnalyzeDataFlow();
                decompiler.ReconstructTypes();
                decompiler.StructureProgram();
                decompiler.WriteDecompilerProducts();
            }
            catch (Exception ex)
            {
                diagnosticSvc.Error(ex, "An error occurred during decompilation.");
            }
        }
Exemple #4
0
        private void Decompile(Dictionary <string, object> pArgs)
        {
            pArgs.TryGetValue("--loader", out object loader);
            try
            {
                var fileName = (string)pArgs["filename"];
                var filePath = Path.GetFullPath(fileName);
                if (!decompiler.Load(filePath, (string)loader))
                {
                    return;
                }

                decompiler.Project.Programs[0].User.ExtractResources =
                    !pArgs.TryGetValue("extract-resources", out var oExtractResources) ||
                    ((string)oExtractResources != "no" && (string)oExtractResources != "false");

                if (pArgs.TryGetValue("heuristics", out var oHeur))
                {
                    decompiler.Project.Programs[0].User.Heuristics = ((string[])oHeur).ToSortedSet();
                }
                if (pArgs.TryGetValue("metadata", out var oMetadata))
                {
                    decompiler.Project.MetadataFiles.Add(new MetadataFile
                    {
                        Filename = (string)oMetadata
                    });
                }
                if (pArgs.ContainsKey("dasm-address"))
                {
                    decompiler.Project.Programs[0].User.ShowAddressesInDisassembly = true;
                }
                if (pArgs.ContainsKey("dasm-bytes"))
                {
                    decompiler.Project.Programs[0].User.ShowBytesInDisassembly = true;
                }
                if (pArgs.TryGetValue("aggressive-branch-removal", out object oAggressiveBranchRemoval))
                {
                    decompiler.Project.Programs[0].User.AggressiveBranchRemoval =
                        oAggressiveBranchRemoval is bool flag && flag;
                }
                if (pArgs.TryGetValue("debug-types", out var oProcRange))
                {
                    decompiler.Project.Programs[0].DebugProcedureRange = ((int, int))oProcRange;
                }
                if (pArgs.TryGetValue("debug-trace-proc", out object oTraceProcs))
                {
                    decompiler.Project.Programs[0].User.DebugTraceProcedures =
                        (HashSet <string>)oTraceProcs;
                }
                decompiler.ExtractResources();
                decompiler.ScanPrograms();
                if (!pArgs.ContainsKey("scan-only"))
                {
                    decompiler.AnalyzeDataFlow();
                    decompiler.ReconstructTypes();
                    decompiler.StructureProgram();
                    decompiler.WriteDecompilerProducts();
                }
            }
            catch (Exception ex)
            {
                listener.Error(ex, "An error occurred during decompilation.");
            }
        }