Пример #1
0
    def _on_node_selected(self, source, node):
        pen = QtGui.QPen(QtCore.Qt.transparent)

        if node is self.node:
            pen.setColor(QtCore.Qt.red)
            pen.setWidth(4)

            AnalysisController.getInstance().signals.ENSURE_ITEM_VISIBLE.fire(self, self)

        self.setPen(pen)
Пример #2
0
    def _on_node_display_info(self, source, node_info):
        if self.node_info_widget:
            self.node_info_widget.setVisible(False)
            self.node_info_widget = None

        if node_info.node is self.node:
            self.node_info_widget = CFGNodeInfo(node_info.format(),
                                                scene = self.scene,
                                                parent = self)

            AnalysisController.getInstance().signals.ENSURE_ITEM_VISIBLE.fire(self, self)
Пример #3
0
    def __init__(self):
        super(MainWindow, self).__init__()
        self.loadUi()

        self.analysis_controller = AnalysisController.getInstance()
        self.source_text_edit = None

        self.worklist = []
        self.pending_worklist = []
        self.processing_item = None

        self.next_analysis_step = None
        self._set_next_analysis_step(NextAnalysisStep.IN)

        self._connectSignals()
        self._configureWidgets()
Пример #4
0
    def __init__(self):
        super(MainWindow, self).__init__()
        self.loadUi()

        self.analysis_controller = AnalysisController.getInstance()
        self.source_text_edit = None


        self.worklist = []
        self.pending_worklist = []
        self.processing_item = None

        self.next_analysis_step = None
        self._set_next_analysis_step(NextAnalysisStep.IN)

        self._connectSignals()
        self._configureWidgets()
Пример #5
0
    def __init__(self, node, bounds, scene):
        super(CFGNodeProxy, self).__init__(bounds)

        self.node = node

        # Use a transparent pen, so we don't re-draw the border from the graph
        pen = QtGui.QPen(QtCore.Qt.transparent)
        self.setPen(pen)

        # Add ourselves into the graphics scene
        self.scene = scene
        scene.addItem(self)

        # Listen for signals from the analysis controller
        controller = AnalysisController.getInstance()
        controller.signals.CFG_NODE_SELECTED.register(self._on_node_selected)
        controller.signals.CFG_NODE_DISPLAY_INFO.register(self._on_node_display_info)

        self.node_info_widget = None
Пример #6
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)
Пример #7
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)
Пример #8
0
    def __init__(self, arguments):
        self.arguments = arguments
        self.worklist = []

        self.analysis_controller = AnalysisController.getInstance()
        self._register_signals()
Пример #9
0
    def __init__(self, arguments):
        self.arguments = arguments
        self.worklist = []

        self.analysis_controller = AnalysisController.getInstance()
        self._register_signals()
Пример #10
0
 def mousePressEvent(self, event):
     '''Capture mouse clicks on this element.'''
     controller = AnalysisController.getInstance()
     controller.signals.CFG_NODE_SELECTED.fire(self, self.node)
     controller.signals.CFG_NODE_REQUEST_INFO.fire(self, str(self.node), NodeInfo.Direction.BOTH, NodeInfo.Encoding.UNICODE)