Module ida_graph
[frames] | no frames]

Module ida_graph

IDA Plugin SDK API wrapper: graph

Classes
  node_layout_t
Proxy of C++ qvector<(rect_t)> class
  pointvec_t
Proxy of C++ qvector<(point_t)> class
  node_info_t
Proxy of C++ node_info_t class
  node_ordering_t
Proxy of C++ node_ordering_t class
  edge_t
Proxy of C++ edge_t class
  graph_node_visitor_t
Proxy of C++ graph_node_visitor_t class
  graph_path_visitor_t
Proxy of C++ graph_path_visitor_t class
  point_t
Proxy of C++ point_t class
  pointseq_t
Proxy of C++ pointseq_t class
  rect_t
Proxy of C++ rect_t class
  TPointDouble
Proxy of C++ TPointDouble class
  edge_info_t
Proxy of C++ edge_info_t class
  edge_layout_point_t
Proxy of C++ edge_layout_point_t class
  selection_item_t
Proxy of C++ selection_item_t class
  screen_graph_selection_t
Proxy of C++ screen_graph_selection_t class
  edge_segment_t
Proxy of C++ edge_segment_t class
  graph_item_t
Proxy of C++ graph_item_t class
  interval_t
Proxy of C++ interval_t class
  row_info_t
Proxy of C++ row_info_t class
  edge_infos_wrapper_t
Proxy of C++ edge_infos_wrapper_t class
  mutable_graph_t
Proxy of C++ mutable_graph_t class
  graph_visitor_t
Proxy of C++ graph_visitor_t class
  group_crinfo_t
Proxy of C++ group_crinfo_t class
  user_graph_place_t
Proxy of C++ user_graph_place_t class
  GraphViewer
Functions
bool
get_node_info(out, gid, node)
Get node info.
 
set_node_info(gid, node, ni, flags)
Set node info.
 
del_node_info(gid, node)
Delete the 'node_info_t' for the given node.
 
clr_node_info(gid, node, flags)
Clear node info for the given node.
double
calc_dist(p, q)
Calculate distance between p and q.
graph_viewer_t *
create_graph_viewer(title, id, callback, ud, title_height, parent=None)
Create a custom graph viewer.
graph_viewer_t *
get_graph_viewer(parent)
Get custom graph viewer for given form.
mutable_graph_t
create_mutable_graph(id)
Create a new empty graph with given id.
mutable_graph_t
create_disasm_graph(ea)
create_disasm_graph(ranges) -> mutable_graph_t
mutable_graph_t
get_viewer_graph(gv)
Get graph object for given custom graph viewer.
 
set_viewer_graph(gv, g)
Set the underlying graph object for the given viewer.
 
refresh_viewer(gv)
Redraw the graph in the given view.
 
viewer_fit_window(gv)
Fit graph viewer to its parent form.
int
viewer_get_curnode(gv)
Get number of currently selected node (-1 if none)
 
viewer_center_on(gv, node)
Center the graph view on the given node.
 
viewer_set_gli(gv, gli, flags=0)
Set location info for given graph view If flags contains GLICTL_CENTER, then the gli will be set to be the center of the view.
bool
viewer_get_gli(out, gv, flags=0)
Get location info for given graph view If flags contains GLICTL_CENTER, then the gli that will be retrieved, will be the one at the center of the view.
 
viewer_set_node_info(gv, n, ni, flags)
Set node info for node in given viewer (see 'set_node_info()' )
bool
viewer_get_node_info(gv, out, n)
Get node info for node in given viewer (see 'get_node_info()' )
 
viewer_del_node_info(gv, n)
Delete node info for node in given viewer (see 'del_node_info()' )
bool
viewer_create_groups(gv, out_group_nodes, gi)
This will perform an operation similar to what happens when a user manually selects a set of nodes, right-clicks and selects "Create group".
bool
viewer_delete_groups(gv, groups, new_current=-1)
Wrapper around mutable_graph_t::delete_group.
bool
viewer_set_groups_visibility(gv, groups, expand, new_current=-1)
Wrapper around mutable_graph_t::change_visibility.
bool
viewer_attach_menu_item(g, name)
Attach a previously-registered action to the view's context menu.
bool
viewer_get_selection(gv, sgs)
Get currently selected items for graph viewer.
int
viewer_set_titlebar_height(gv, height)
Set height of node title bars ( 'grcode_set_titlebar_height' )
 
delete_mutable_graph(g)
Delete graph object.use this only if you are dealing with 'mutable_graph_t' instances that have not been used together with a 'graph_viewer_t' .
user_graph_place_t
create_user_graph_place(node, lnnum)
Get a copy of a 'user_graph_place_t' (returns a pointer to static storage)
 
pyg_close(self)
 
pyg_select_node(self, nid)
bool
pyg_show(self)
Variables
  NIF_BG_COLOR = 1
'node_info_t::bg_color'
  NIF_FRAME_COLOR = 2
'node_info_t::frame_color'
  NIF_EA = 4
'node_info_t::ea'
  NIF_TEXT = 8
'node_info_t::text'
  NIF_FLAGS = 16
'node_info_t::flags'
  NIF_ALL = 31
  GLICTL_CENTER = 1
the gli should be set/get as center
  NIFF_SHOW_CONTENTS = 1
  edge_error = 0
  edge_tree = 1
  edge_forward = 2
  edge_back = 3
  edge_cross = 4
  edge_subgraph = 5
  cvar = _ida_graph.cvar
  layout_none = 0
  layout_digraph = 1
  layout_tree = 2
  layout_circle = 3
  layout_polar_tree = 4
  layout_orthogonal = 5
  layout_radial_tree = 6
  git_none = 0
  git_edge = 1
  git_node = 2
  git_tool = 3
  git_text = 4
  git_elp = 5
  ygap = 30
  xgap = 10
  arrow_height = 10
  arrow_width = 8
  MTG_GROUP_NODE = 1
is group node?
  MTG_DOT_NODE = 2
is dot node?
  MTG_NON_DISPLAYABLE_NODE = 8
for disassembly graphs - non-displayable nodes have a visible area that is too large to generate disassembly lines for without IDA slowing down significantly (see MAX_VISIBLE_NODE_AREA)
  COLLAPSED_NODE = -2147483648
  grcode_calculating_layout = 0
  grcode_layout_calculated = 1
  grcode_changed_graph = 2
  grcode_changed_current = 3
  grcode_clicked = 4
  grcode_dblclicked = 5
  grcode_creating_group = 6
  grcode_deleting_group = 7
  grcode_group_visibility = 8
  grcode_gotfocus = 9
  grcode_lostfocus = 10
  grcode_user_refresh = 11
  grcode_user_gentext = 12
  grcode_user_text = 13
  grcode_user_size = 14
  grcode_user_title = 15
  grcode_user_draw = 16
  grcode_user_hint = 17
  grcode_destroyed = 18
  grcode_create_graph_viewer = 256
  grcode_get_graph_viewer = 257
  grcode_get_viewer_graph = 258
  grcode_create_mutable_graph = 259
  grcode_set_viewer_graph = 260
  grcode_refresh_viewer = 261
  grcode_fit_window = 262
  grcode_get_curnode = 263
  grcode_center_on = 264
  grcode_get_selection = 265
  grcode_del_custom_layout = 266
  grcode_set_custom_layout = 267
  grcode_set_graph_groups = 268
  grcode_clear = 269
  grcode_create_digraph_layout = 270
  grcode_create_tree_layout = 271
  grcode_create_circle_layout = 272
  grcode_get_node_representative = 273
  grcode_find_subgraph_node = 274
  grcode_create_group = 275
  grcode_get_custom_layout = 276
  grcode_get_graph_groups = 277
  grcode_empty = 278
  grcode_is_visible_node = 279
  grcode_delete_group = 280
  grcode_change_group_visibility = 281
  grcode_set_edge = 282
  grcode_node_qty = 283
  grcode_nrect = 284
  grcode_set_titlebar_height = 285
  grcode_create_user_graph_place = 286
  grcode_create_disasm_graph1 = 287
  grcode_create_disasm_graph2 = 288
  grcode_set_node_info = 289
  grcode_get_node_info = 290
  grcode_del_node_info = 291
  grcode_viewer_create_groups = 292
  grcode_viewer_delete_groups = 293
  grcode_viewer_groups_visibility = 294
  grcode_viewer_create_groups_vec = 295
  grcode_viewer_delete_groups_vec = 296
  grcode_viewer_groups_visibility_vec = 297
  grcode_delete_mutable_graph = 298
  grcode_edge_infos_wrapper_copy = 299
  grcode_edge_infos_wrapper_clear = 300
  grcode_attach_menu_item = 301
  grcode_set_gli = 302
  grcode_get_gli = 303
  __package__ = None
Function Details

get_node_info(out, gid, node)

 

Get node info.

Parameters:
  • out - result (C++: node_info_t *)
  • gid - id of desired graph (C++: graph_id_t)
  • node - node number (C++: int)
Returns: bool
success

set_node_info(gid, node, ni, flags)

 

Set node info.

Parameters:
  • gid - id of desired graph (C++: graph_id_t)
  • node - node number (C++: int)
  • ni - node info to use (C++: const node_info_t &)
  • flags - combination of Node info flags , identifying which fields of 'ni' will be used (C++: uint32)

del_node_info(gid, node)

 

Delete the 'node_info_t' for the given node.

Parameters:
  • gid, (C++ - graph_id_t)
  • node, (C++ - int)

clr_node_info(gid, node, flags)

 

Clear node info for the given node.

Parameters:
  • gid - id of desired graph (C++: graph_id_t)
  • node - node number (C++: int)
  • flags - combination of Node info flags , identifying which fields of node_info_t will be cleared (C++: uint32)

calc_dist(p, q)

 

Calculate distance between p and q.

Parameters:
  • p, (C++ - point_t)
  • q, (C++ - point_t)
Returns: double

create_graph_viewer(title, id, callback, ud, title_height, parent=None)

 

Create a custom graph viewer.

Parameters:
  • title - the widget title (C++: const char *)
  • id - graph id (C++: uval_t)
  • callback - callback to handle graph notifications ( graph_notification_t ) (C++: hook_cb_t *)
  • ud - user data passed to callback (C++: void *)
  • title_height - node title height (C++: int)
  • parent, (C++ - TWidget *)
Returns: graph_viewer_t *
new viewer

get_graph_viewer(parent)

 

Get custom graph viewer for given form.

Parameters:
  • parent, (C++ - TWidget *)
Returns: graph_viewer_t *

create_mutable_graph(id)

 

Create a new empty graph with given id.

Parameters:
  • id, (C++ - uval_t)
Returns: mutable_graph_t

create_disasm_graph(ea)

 
  create_disasm_graph(ranges) -> mutable_graph_t


Create a graph for the function that contains 'ea'.


@param ea (C++: ea_t)
  

Returns: mutable_graph_t

get_viewer_graph(gv)

 

Get graph object for given custom graph viewer.

Parameters:
  • gv, (C++ - graph_viewer_t *)
Returns: mutable_graph_t

set_viewer_graph(gv, g)

 

Set the underlying graph object for the given viewer.

Parameters:
  • gv, (C++ - graph_viewer_t *)
  • g, (C++ - mutable_graph_t *)

refresh_viewer(gv)

 

Redraw the graph in the given view.

Parameters:
  • gv, (C++ - graph_viewer_t *)

viewer_fit_window(gv)

 

Fit graph viewer to its parent form.

Parameters:
  • gv, (C++ - graph_viewer_t *)

viewer_get_curnode(gv)

 

Get number of currently selected node (-1 if none)

Parameters:
  • gv, (C++ - graph_viewer_t *)
Returns: int

viewer_center_on(gv, node)

 

Center the graph view on the given node.

Parameters:
  • gv, (C++ - graph_viewer_t *)
  • node, (C++ - int)

viewer_set_gli(gv, gli, flags=0)

 

Set location info for given graph view If flags contains GLICTL_CENTER, then the gli will be set to be the center of the view. Otherwise it will be the top-left.

Parameters:
  • gv, (C++ - graph_viewer_t *)
  • gli, (C++ - const graph_location_info_t *)
  • flags, (C++ - uint32)

viewer_get_gli(out, gv, flags=0)

 

Get location info for given graph view If flags contains GLICTL_CENTER, then the gli that will be retrieved, will be the one at the center of the view. Otherwise it will be the top-left.

Parameters:
  • out, (C++ - graph_location_info_t *)
  • gv, (C++ - graph_viewer_t *)
  • flags, (C++ - uint32)
Returns: bool

viewer_set_node_info(gv, n, ni, flags)

 

Set node info for node in given viewer (see 'set_node_info()' )

Parameters:
  • gv, (C++ - graph_viewer_t *)
  • n, (C++ - int)
  • ni, (C++ - const node_info_t &)
  • flags, (C++ - uint32)

viewer_get_node_info(gv, out, n)

 

Get node info for node in given viewer (see 'get_node_info()' )

Parameters:
  • gv, (C++ - graph_viewer_t *)
  • out, (C++ - node_info_t *)
  • n, (C++ - int)
Returns: bool

viewer_del_node_info(gv, n)

 

Delete node info for node in given viewer (see 'del_node_info()' )

Parameters:
  • gv, (C++ - graph_viewer_t *)
  • n, (C++ - int)

viewer_create_groups(gv, out_group_nodes, gi)

 

This will perform an operation similar to what happens when a user manually selects a set of nodes, right-clicks and selects "Create group". This is a wrapper around mutable_graph_t::create_group that will, in essence:clone the current graphfor each 'group_crinfo_t' , attempt creating group in that new graphif all were successful, animate to that new graph.this accepts parameters that allow creating of multiple groups at once; which means only one graph animation will be triggered.

Parameters:
  • gv, (C++ - graph_viewer_t *)
  • out_group_nodes, (C++ - intvec_t *)
  • gi, (C++ - const groups_crinfos_t &)
Returns: bool

viewer_delete_groups(gv, groups, new_current=-1)

 

Wrapper around mutable_graph_t::delete_group. This function will:clone the current graphattempt deleting the groups in that new graphif successful, animate to that new graph.

Parameters:
  • gv, (C++ - graph_viewer_t *)
  • groups, (C++ - const intvec_t &)
  • new_current, (C++ - int)
Returns: bool

viewer_set_groups_visibility(gv, groups, expand, new_current=-1)

 

Wrapper around mutable_graph_t::change_visibility. This function will:clone the current graphattempt changing visibility of the groups in that new graphif successful, animate to that new graph.

Parameters:
  • gv, (C++ - graph_viewer_t *)
  • groups, (C++ - const intvec_t &)
  • expand, (C++ - bool)
  • new_current, (C++ - int)
Returns: bool

viewer_attach_menu_item(g, name)

 

Attach a previously-registered action to the view's context menu. See 'kernwin.hpp' for how to register actions.

Parameters:
  • g, (C++ - graph_viewer_t *)
  • name - action name (C++: const char *)
Returns: bool
success

viewer_get_selection(gv, sgs)

 

Get currently selected items for graph viewer.

Parameters:
  • gv, (C++ - graph_viewer_t *)
  • sgs, (C++ - screen_graph_selection_t *)
Returns: bool

viewer_set_titlebar_height(gv, height)

 

Set height of node title bars ( 'grcode_set_titlebar_height' )

Parameters:
  • gv, (C++ - graph_viewer_t *)
  • height, (C++ - int)
Returns: int

delete_mutable_graph(g)

 

Delete graph object.use this only if you are dealing with 'mutable_graph_t' instances that have not been used together with a 'graph_viewer_t' . If you have called 'set_viewer_graph()' with your graph, the graph's lifecycle will be managed by the viewer, and you shouldn't interfere with it

Parameters:
  • g, (C++ - mutable_graph_t *)

create_user_graph_place(node, lnnum)

 

Get a copy of a 'user_graph_place_t' (returns a pointer to static storage)

Parameters:
  • node, (C++ - int)
  • lnnum, (C++ - int)
Returns: user_graph_place_t