diff options
-rw-r--r-- | SystemCalls.py | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/SystemCalls.py b/SystemCalls.py index d1388a3..55a7c92 100644 --- a/SystemCalls.py +++ b/SystemCalls.py @@ -17,24 +17,29 @@ try: except: guess_machine = None -from idaapi import * +import idaapi import idc import ida_bytes import ida_idp import ida_search import ida_segment +import time + from SystemCalls_constants import * -class SystemCallView(Choose2): +class SystemCallView(idaapi.Choose2): def __init__(self, systemCalls): self.systemCalls = systemCalls - Choose2.__init__(self, 'System call', [['Address', 13], ['Type', 10], [ - 'Number', 10], ['Name', 20], ['Pointer Size', 12]]) + idaapi.Choose2.__init__(self, 'System call', [['Address', 13], + ['Type', 10], + ['Number', 10], + ['Name', 20], + ['Pointer Size', 12]]) self.items = list() @@ -53,7 +58,7 @@ class SystemCallView(Choose2): self.systemCalls.searchSystemCalls() end = time.time() - print ('[*] It took {} seconds to discover the system calls.' % + print ('[*] It took %d seconds to discover the system calls.' % (end - start)) self.items = list() @@ -93,7 +98,7 @@ class SystemCallView(Choose2): call[1]], str(call[2]), '', '64bit']) end = time.time() - print ('[*] It took {} seconds to analyze the system calls.' % + print ('[*] It took %d seconds to analyze the system calls.' % (end - start)) self.items.sort(key=lambda tup: tup[0]) @@ -230,7 +235,7 @@ class SystemCall(): # Just proceed with depgraph if IDA detected a function and miasm had # been imported. - if not func.f or guess_machine is not None: + if not func.f or guess_machine is None: for call in func.calls: sol.append([call.addr, call.sctype, '']) return sol @@ -251,7 +256,8 @@ class SystemCall(): # Check if addr is in a basic block without an entry. if len(self.ir_arch.getby_offset(addr)) == 0: - fc = qflow_chart_t('', func.f, BADADDR, BADADDR, FC_PREDS) + fc = qflow_chart_t('', func.f, idaapi.BADADDR, + idaapi.BADADDR, idaapi.FC_PREDS) try: # Iterate through all basic blocks. @@ -291,7 +297,7 @@ class SystemCall(): return sol def __addCall(self, addr, sctype, arch): - f = get_func(addr) + f = idaapi.get_func(addr) if not f: faddr = 0 @@ -309,7 +315,7 @@ class SystemCall(): addr = ida_search.find_binary( seg.startEA, seg.endEA, sbytes, 16, ida_search.SEARCH_DOWN) - while addr != BADADDR: + while addr != idaapi.BADADDR: if (ida_bytes.get_item_head(addr) == addr and ida_bytes.get_item_size(addr) == slength): self.__addCall(addr, sctype, arch) |