def prepare_debug_noui(): target_pid = -1 idaapi.msg("[%s] waiting...\n" % (PLUGNAME)) filename = ida_nalt.get_root_filename() pis = ida_idd.procinfo_vec_t() ida_dbg.get_processes(pis) for proc in pis: proc_name = proc.name.split(" ")[1] idx = proc_name.rfind("/") if idx != -1: proc_name = proc_name[idx + 1:] if filename == proc_name: target_pid = proc.pid break if target_pid != -1: idaapi.msg("[%s] start debug (PID: %d)\n" % (PLUGNAME, target_pid)) ida_dbg.attach_process(target_pid, -1) idc.GetDebuggerEvent(idc.WFNE_SUSP, -1) ida_dbg.continue_process() else: idaapi.msg("[%s] exit waiting\n" % (PLUGNAME))
def __call__(self): target_pid = -1 if idaapi.is_debugger_on(): idaapi.msg("[%s] the debugger is currently running\n" % PLUGNAME) return -1 if not self.times%5: idaapi.msg("[%s] waiting for the process (%ds left)...\n" % \ (PLUGNAME, self.times)) filename = ida_nalt.get_root_filename() pis = ida_idd.procinfo_vec_t() ida_dbg.get_processes(pis) for proc in pis: proc_name = proc.name.split(" ")[1] idx = proc_name.rfind("/") if idx != -1: proc_name = proc_name[idx+1:] if filename == proc_name: target_pid = proc.pid break if target_pid != -1: idaapi.msg("[%s] found. start debug (PID: %d)\n" % (PLUGNAME, target_pid)) ida_dbg.attach_process(target_pid, -1) ida_dbg.wait_for_next_event(ida_dbg.WFNE_SUSP, -1) ida_dbg.continue_process() return -1 self.times -= 1 return -1 if self.times == 0 else self.interval
def get_process_info(n, pi): pis = ida_idd.procinfo_vec_t() cnt = get_processes(pis) if n >= cnt: return ida_idd.NO_PROCESS pi.name = pis[n].name pi.pid = pis[n].pid return pi.pid
def get_processes_list(): self.pis = ida_idd.procinfo_vec_t() ida_dbg.get_processes(self.pis) return 1
def get_process_qty(): pis = ida_idd.procinfo_vec_t() return get_processes(pis)