I am trying to get all the library function calls that a binary performs in a preorder-DFT traversal of the CFG. I'm able to get the CFG like:
import sys, angr
import networkx as nx
proj = angr.Project(sys.argv[1],auto_load_libs=False)
cfg = proj.analyses.CFG().graph
I was able to get the CFG and I can even traverse it like this (Suppose I'm getting the correct main function's node):
s = nx.dfs_preorder_nodes(cfg,mainFuncNode)
nodes = []
try:
while True:
nodes.append(ns.next())
except:
pass
However I don't know how to get the function calls from the nodes (if they are actually doing it). I read some documentation and all I could come up with was:
for n in nodes:
if n.is_simprocedure:
print n.to_codenode().function
The output is all None and I'm sure that's wrong because the binary Is doing some I/O operations. So I expect to see something like:
libc_puts
libc_gets
- ...
I would appreciate if you could give me some better pointers.