Esempio n. 1
0
    def execute_analysis(self):
        source_file, analysis_module_path = self._get_analysis_files()

        if not (source_file and analysis_module_path):
            sys.exit(0)

        try:
            # Construct the main window
            from sleuth.evidence.gui.main_window import MainWindow
            self.main_window = MainWindow()

            # Prepare the analysis
            analysis_controller = AnalysisController.getInstance()
            analysis_controller.setup_analysis(source_file,
                                               analysis_module_path,
                                               self.arguments)

            # Render analysis details into the main window
            program_source = analysis_controller.get_program_source()
            self.main_window.render_source(program_source)

            edge_pairs = analysis_controller.get_cfg_edge_pairs()
            node_id_map = analysis_controller.get_node_id_map()
            self.main_window.render_graph(self.arguments.dot_executable,
                                          edge_pairs, node_id_map)

            # Display the main window
            self.main_window.show()

            # Enter the PyQt event loop
            return self.exec_()

        except AnalysisControllerException as e:
            self._exit_with_exception('Analysis Error', e)

        except Exception as e:
            self._exit_with_exception('Unhandled Exception', e)