custom_graph_with_actions

summary: draw custom graphs

description:

Showing custom graphs, using ida_graph.GraphViewer. In addition, show how to write actions that can be performed on those.

keywords: graph, actions

level: advanced

Attributes

g

Classes

GraphCloser

ColorChanger

SelectionPrinter

MyGraph

Functions

show_graph()

Module Contents

class custom_graph_with_actions.GraphCloser(graph)

Bases: _base_graph_action_handler_t

activate(ctx)

Activate an action. This function implements the core behavior of an action. It is called when the action is triggered, from a menu, from a popup menu, from the toolbar, or programmatically.

Returns:

non-zero: all IDA windows will be refreshed

class custom_graph_with_actions.ColorChanger(graph)

Bases: _base_graph_action_handler_t

activate(ctx)

Activate an action. This function implements the core behavior of an action. It is called when the action is triggered, from a menu, from a popup menu, from the toolbar, or programmatically.

Returns:

non-zero: all IDA windows will be refreshed

class custom_graph_with_actions.SelectionPrinter(graph)

Bases: _base_graph_action_handler_t

activate(ctx)

Activate an action. This function implements the core behavior of an action. It is called when the action is triggered, from a menu, from a popup menu, from the toolbar, or programmatically.

Returns:

non-zero: all IDA windows will be refreshed

class custom_graph_with_actions.MyGraph(funcname, result)

Bases: ida_graph.GraphViewer

title
funcname
result
color = 16711935
my_view_hooks
OnRefresh()

Event called when the graph is refreshed or first created. From this event you are supposed to create nodes and edges. This callback is mandatory.

NOTE: *It is important to clear previous nodes before adding nodes.*

Returns:

Returning True tells the graph viewer to use the items. Otherwise old items will be used.

OnGetText(node_id)
OnPopup(widget, popup_handle)
custom_graph_with_actions.show_graph()
custom_graph_with_actions.g = None