Esempio n. 1
0
    def show_subtree(self, insn_token):
        """
        TODO
        """
        graph = MicroSubtreeView(insn_token.insn)
        graph.show()

        import ida_graph
        gv = ida_graph.get_graph_viewer(graph.GetWidget())
        ida_graph.viewer_set_titlebar_height(gv, 15)
Esempio n. 2
0
    def show_subtree(self, insn_token):
        """
        Show the sub-instruction graph for the given instruction token.
        """
        graph = MicroSubtreeView(insn_token.insn)
        graph.show()

        # TODO/HACK: this is dumb, but moving it breaks my centering code so
        # i'll figure it out later...
        gv = ida_graph.get_graph_viewer(graph.GetWidget())
        ida_graph.viewer_set_titlebar_height(gv, 15)
Esempio n. 3
0
 def activate(self, ctx):
     try:
         sel = ctx.graph_selection
     except:
         sel = ida_graph.screen_graph_selection_t()
         gv = ida_graph.get_graph_viewer(self.graph.GetWidget())
         ida_graph.viewer_get_selection(gv, sel)
     if sel:
         for s in sel:
             if s.is_node:
                 print(f'[{NAME}] selected node {s.node}')
             else:
                 print(
                     f'[{NAME}] selected edge {str(s.elp.e.src)} -> {str(s.elp.e.dst)}'
                 )
     return 1
 def activate(self, ctx):
     try:
         sel = ctx.graph_selection
     except:
         # IDA < 7.4 doesn't provide graph selection as part of
         # the action_activation_ctx_t; it needs to be queried.
         sel = ida_graph.screen_graph_selection_t()
         gv = ida_graph.get_graph_viewer(self.graph.GetWidget())
         ida_graph.viewer_get_selection(gv, sel)
     if sel:
         for s in sel:
             if s.is_node:
                 print("Selected node %d" % s.node)
             else:
                 print("Selected edge %d -> %d" % (s.elp.e.src, s.elp.e.dst))
     return 1
Esempio n. 5
0
 def activate(self, ctx):
     try:
         sel = ctx.graph_selection
     except:
         sel = ida_graph.screen_graph_selection_t()
         gv = ida_graph.get_graph_viewer(self.graph.GetWidget())
         ida_graph.viewer_get_selection(gv, sel)
     if sel:
         if DEBUG:
             for s in sel:
                 if s.is_node:
                     print('[{}] selected node {}'.format(NAME, s.node))
                 else:
                     # yapf: disable
                     print('[{}] selected edge {} -> {}'.format(NAME, str(s.elp.e.src), str(s.elp.e.dst)))
     return 1
Esempio n. 6
0
    def _center_graph(self):
        """
        Center the sub-tree graph, and set an appropriate zoom level.
        """
        widget = self.GetWidget()
        gv = ida_graph.get_graph_viewer(widget)
        g = ida_graph.get_viewer_graph(gv)

        ida_graph.viewer_fit_window(gv)
        ida_graph.refresh_viewer(gv)

        gli = ida_moves.graph_location_info_t()
        ida_graph.viewer_get_gli(gli, gv, ida_graph.GLICTL_CENTER) 
        if gli.zoom > 1.5:
            gli.zoom = 1.5
        else:
            gli.zoom = gli.zoom * 0.9

        ida_graph.viewer_set_gli(gv, gli, ida_graph.GLICTL_CENTER)