| count = 0 | |
| start = None | |
| # Iterate over the basic blocks in the entry function | |
| for block in entry.low_level_il: | |
| # Iterate over the basic blocks getting il instructions | |
| for il in block: | |
| # We only care about calls | |
| if il.operation != binaryninja.core.LLIL_CALL: | |
| continue | |
| # The second call is the call to start | |
| count += 1 | |
| if count == 2: | |
| start = bv.get_functions_at(il.operands[0].value)[0] | |
| break | |
| print "start: {0}".format(start) | |
| # Do the same thing with main, it's the first call in start | |
| main = None | |
| for block in start.low_level_il: | |
| for il in block: | |
| if il.operation != binaryninja.core.LLIL_CALL: | |
| continue | |
| main = bv.get_functions_at(il.operands[0].value)[0] | |
| print "main: {0}".format(main) |