Skip to content

Instantly share code, notes, and snippets.

@withzombies
Created May 26, 2016 22:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save withzombies/39fa21fffe982053b4576f8d2514fbdd to your computer and use it in GitHub Desktop.
Save withzombies/39fa21fffe982053b4576f8d2514fbdd to your computer and use it in GitHub Desktop.
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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment