Print Syscall numbers for a provided file
(fileName)
| 30 | |
| 31 | |
| 32 | def 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 | |
| 49 | if __name__ == "__main__": |
no test coverage detected