Skip to main content
3 of 5
added 307 characters in body
OneAndOnly
  • 518
  • 4
  • 15

Get a networkx graph from the the function call-graph of the file using IDApython?

Is there any easy way to get a function call graph of a binary program using IDApython then convert it to a networkx graph other than going through every function and constructing the call-graph ourselves? considering that IDA does has a nice way of generating call graph itself, the problem is i dont know how to interact with it using iDApython, for example saving it as a networkx graph or checking which nodes are library calls and which are local and such.

i remember IDA had a method to extract the call graph in a weird format and i couldn't convert it to networkx. its important for me to get a networkx graph because many python packages use this format.

i tried gen_simple_call_chart() but there are two big problems :

  1. there is no difference between library nodes and local nodes in the generated DOT file (no color or anything)

  2. CHART_IGNORE_LIB_FROM doesnt work, i dont want to include nodes that are called by library calls :(

For example all the nodes are black no matter library or local :

"205" [ label = "sub_40AF20", pencolor = black ];
"206" [ label = "__set_error_mode", pencolor = black ];
OneAndOnly
  • 518
  • 4
  • 15