def OnCommand(self, n, cmd): if cmd == self.show_all_toggle_cmd: if self.min_xrefs == self.MIN_XREFS: self.min_xrefs = 0 if self.min_xrefs != self.MIN_XREFS: self.min_xrefs = self.MIN_XREFS if self.must_have_loop == self.MUST_HAVE_LOOP: self.must_have_loop = False else: self.must_have_loop = self.MUST_HAVE_LOOP elif cmd == self.rename_cmd: response = ida_shims.ask_yn( 0, "Are you sure you want to rename all 'sub_XXXXXX' functions " "to 'leaf_XXXXXX'?") if response: for item in self.items: # Is this a leaf function? if item[-1] is True: current_name = item[0] if current_name.startswith('sub_'): new_name = current_name.replace('sub_', 'leaf_') ida_shims.set_name( ida_shims.get_name_ea_simple(current_name), new_name) self.populate_items() return 0
def __init__(self): if self.get_start_ea(self.DATA) == idc.BADADDR: if ida_shims.ask_yn( 0, "There are no data segments defined! This " "probably won't end well. Continue?") != 1: raise Exception("Action cancelled by user.")
def OnClose(self): if ida_shims.ask_yn(1, "Path nodes have been highlighted in the " "disassembly window. Undo highlighting?") == 1: self.unhighlight_all()