From ce63c6edf4c54e317ce5de1bca972151c465b728 Mon Sep 17 00:00:00 2001 From: n0p <0x90@n0p.cc> Date: Wed, 7 Mar 2018 21:28:30 +0100 Subject: Fixed NOPing. --- SystemCalls.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/SystemCalls.py b/SystemCalls.py index 7136194..6f4a0c7 100644 --- a/SystemCalls.py +++ b/SystemCalls.py @@ -19,7 +19,9 @@ except: import idaapi import idc +import ida_idaapi import ida_bytes +import ida_gdl import ida_idp import ida_search import ida_segment @@ -109,12 +111,11 @@ class SystemCallView(idaapi.Choose2): def OnCommand(self, n, cmd_id): if cmd_id == self.cmd_nop: start_ea = int(self.items[n][0], 16) - end_ea = start_ea + ItemSize(start_ea) + end_ea = start_ea + idc.get_item_size(start_ea) self.nop_items.append(self.items[n][0]) - for i in xrange(start_ea, end_ea): - PatchByte(i, 0x90) + ida_bytes.patch_bytes(start_ea, (end_ea - start_ea) * '\x90') def OnGetIcon(self, n): if not len(self.items) > 0: @@ -256,8 +257,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, idaapi.BADADDR, - idaapi.BADADDR, idaapi.FC_PREDS) + fc = qflow_chart_t('', func.f, ida_idaapi.BADADDR, + ida_idaapi.BADADDR, ida_gdl.FC_PREDS) try: # Iterate through all basic blocks. @@ -315,7 +316,7 @@ class SystemCall(): addr = ida_search.find_binary( seg.startEA, seg.endEA, sbytes, 16, ida_search.SEARCH_DOWN) - while addr != idaapi.BADADDR: + while addr != ida_idaapi.BADADDR: if (ida_bytes.get_item_head(addr) == addr and ida_bytes.get_item_size(addr) == slength): self.__addCall(addr, sctype, arch) -- cgit v1.2.3