def main(): if not idaapi.is_debugger_on(): idc.Warning("Please run the process first!") return if idaapi.get_process_state() != -1: idc.Warning("Please suspend the debugger first!") return # only avail from IdaPython r232 if hasattr(idaapi, "NearestName"): # get all debug names dn = idaapi.get_debug_names(idaapi.cvar.inf.minEA, idaapi.cvar.inf.maxEA) # initiate a nearest name search (using debug names) nn = idaapi.NearestName(dn) else: nn = None ret, callstack = CallStackWalk(nn) if ret: title = "Call stack walker (thread %X)" % (GetCurrentThreadId()) idaapi.close_chooser(title) c = CallStackWalkChoose(callstack, title) c.choose() else: idc.Warning("Failed to walk the stack:" + callstack)
def start(): process_is_suspended = False #check if process is suspended if idaapi.is_debugger_on(): if idaapi.get_process_state() == -1: process_is_suspended = True else: idaapi.warning("Please suspend the debugger!") else: idaapi.warning("Please run the process!") #then start a stack checking if process_is_suspended: is_success, call_list, call_addr_list = get_all_calls() if is_success and call_list is not None: curr_thread = ida_dbg.get_current_thread() title = "CallStack - thread: {}".format(curr_thread) idaapi.close_chooser(title) c = MyChoose(call_list, call_addr_list, title) c.Show() else: idaapi.warning( "Something wrong. There is no functions. Set DEBUG flag in the script and check what is going on" )
def find(s=None, x=False, asm_where=None): b, ret = FindInstructions(s, asm_where) if b: # executable segs only? if x: results = [] for ea in ret: seg = idaapi.getseg(ea) if (not seg) or (seg.perm & idaapi.SEGPERM_EXEC) == 0: continue results.append(SearchResult(ea)) else: results = [SearchResult(ea) for ea in ret] title = "Search result for: [%s]" % s idaapi.close_chooser(title) c = SearchResultChoose(results, title) c.choose() else: print ret