Python idaapi.GraphViewer() Examples

The following are 12 code examples of idaapi.GraphViewer(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module idaapi , or try the search function .
Example #1
Source File: lca.py    From Sark with MIT License 6 votes vote down vote up
def __init__(self, title):
        self._title = title
        idaapi.GraphViewer.__init__(self, self._title)

        self._targets = set()
        self._sources = set()

        # This might take a while...
        self._idb_graph = sark.graph.get_idb_graph()

        self._lca_graph = nx.DiGraph()

        self._handlers = [add_function_handler(self),
                          add_address_handler(self)]

        self._current_node_id = 0

        self._disabled_sources = set()

        self._remove_target_handler = remove_target_handler(self)
        self._enable_source_handler = enable_source_handler(self)
        self._disable_source_handler = disable_source_handler(self)

        self._node_ids = {} 
Example #2
Source File: ida_utils.py    From idasec with GNU Lesser General Public License v2.1 5 votes vote down vote up
def __init__(self, flow_graph, title):
        idaapi.GraphViewer.__init__(self, title)
        self.flow_graph = flow_graph
        self.result = None
        self.names = {} 
Example #3
Source File: ida_utils.py    From idasec with GNU Lesser General Public License v2.1 5 votes vote down vote up
def Show(self):
        if not idaapi.GraphViewer.Show(self):
            return False
        self.cmd_test = self.AddCommand("Test", "F2")
        if self.cmd_test == 0:
            print "Failed to add popup menu item!"
        return True 
Example #4
Source File: bingraph.py    From heap-viewer with GNU General Public License v3.0 5 votes vote down vote up
def __init__(self, parent, info, close_open=True):   
        self.cur_arena  = parent.cur_arena
        self.heap       = parent.heap
        self.info       = info
        self.bin_type   = info['type']
        self.SetCurrentRendererType(idaapi.TCCRT_GRAPH)
        idaapi.GraphViewer.__init__(self, self.title, close_open) 
Example #5
Source File: bingraph.py    From heap-viewer with GNU General Public License v3.0 5 votes vote down vote up
def Show(self):
        if not idaapi.GraphViewer.Show(self):
            return False

        self.cmd_refresh = self.AddCommand("Refresh", "Ctrl+R")
        return True


# -------------------------------------------------------------------------- 
Example #6
Source File: IDAMagicStrings.py    From idamagicstrings with GNU Affero General Public License v3.0 5 votes vote down vote up
def __init__(self, title, classes, final_list):
    idaapi.GraphViewer.__init__(self, title)
    self.selected = None
    self.classes = classes
    self.final_list = final_list
    self.nodes = {}
    self.nodes_ea = {}
    self.graph = {}

    self.last_cmd = 0

    dones = set()
    for ea, tokens in self.classes:
      refs = DataRefsTo(ea)
      refs_funcs = set()
      for ref in refs:
        func = idaapi.get_func(ref)
        if func is not None:
          refs_funcs.add(func.start_ea)

      if len(refs_funcs) == 1:
        func_ea = list(refs_funcs)[0]
        if func_ea in dones:
          continue
        dones.add(func_ea)

        func_name = get_func_name(func_ea)
        tmp = demangle_name(func_name, INF_SHORT_DN)
        if tmp is not None:
          func_name = tmp

        element = [func_ea, func_name, "::".join(tokens), [get_string(ea)]]
        self.final_list.append(element) 
Example #7
Source File: IDAMagicStrings.py    From idamagicstrings with GNU Affero General Public License v3.0 5 votes vote down vote up
def Show(self):
    if not idaapi.GraphViewer.Show(self):
      return False
    return True

#------------------------------------------------------------------------------- 
Example #8
Source File: ui.py    From Sark with MIT License 5 votes vote down vote up
def __init__(self, graph, title="GraphViewer", handler=None, padding=PADDING):
        """Initialize the graph viewer.

        To avoid bizarre IDA errors (crashing when creating 2 graphs with the same title,)
        a counter is appended to the title (similar to "Hex View-1".)

        Args:
            graph: A NetworkX graph to display.
            title: The graph title.
            handler: The default node handler to use when accessing node data.
        """
        title = self._make_unique_title(title)

        idaapi.GraphViewer.__init__(self, title)

        self._graph = graph

        if handler is None:
            handler = self.DEFAULT_HANDLER

        # Here we make sure the handler is an instance of `BasicNodeHandler` or inherited
        # types. While generally being bad Python practice, we still need it here as an
        # invalid handler can cause IDA to crash.
        if not isinstance(handler, BasicNodeHandler):
            raise TypeError("Node handler must inherit from `BasicNodeHandler`.")

        self._default_handler = handler
        self._padding = padding 
Example #9
Source File: ui.py    From Sark with MIT License 5 votes vote down vote up
def Show(self):
        if not idaapi.GraphViewer.Show(self):
            return False

        return True 
Example #10
Source File: lca.py    From Sark with MIT License 5 votes vote down vote up
def Show(self):
        if not idaapi.GraphViewer.Show(self):
            return False

        self._register_handlers()
        self.color_nodes()
        return True 
Example #11
Source File: graph_ir.py    From miasm with GNU General Public License v2.0 5 votes vote down vote up
def __init__(self, ircfg, title, result):
        idaapi.GraphViewer.__init__(self, title)
        self.ircfg = ircfg
        self.result = result
        self.names = {} 
Example #12
Source File: graph_ir.py    From miasm with GNU General Public License v2.0 5 votes vote down vote up
def Show(self):
        if not idaapi.GraphViewer.Show(self):
            return False
        return True