MCPcopy Create free account
hub / github.com/Vector35/binaryninja-api / print_syscalls

Function print_syscalls

python/examples/print_syscalls.py:32–46  ·  view source on GitHub ↗

Print Syscall numbers for a provided file

(fileName)

Source from the content-addressed store, hash-verified

30
31
32def print_syscalls(fileName):
33 """ Print Syscall numbers for a provided file """
34 bv = load(fileName)
35 calling_convention = bv.platform.system_call_convention
36 if calling_convention is None:
37 print('Error: No syscall convention available for {:s}'.format(bv.platform))
38 return
39
40 register = calling_convention.int_arg_regs[0]
41
42 for func in bv.functions:
43 syscalls = (il for il in chain.from_iterable(func.low_level_il) if il.operation == LowLevelILOperation.LLIL_SYSCALL)
44 for il in syscalls:
45 value = func.get_reg_value_at(il.address, register).value
46 print("System call address: {:#x} - {:d}".format(il.address, value))
47
48
49if __name__ == "__main__":

Callers 1

print_syscalls.pyFile · 0.85

Calls 3

get_reg_value_atMethod · 0.80
loadFunction · 0.50
formatMethod · 0.45

Tested by

no test coverage detected