def _set_user_func(self): while True: func_def = ask_text( 0, self.func_def, "Please define function (must return tuple(RR,GG,BB) format") if func_def is None: break res, s = self._compile(func_def) if res: break warning("%s" % s)
def add_tmp_func(self, info_only=False): """ 添加临时sink函数 info_only: 在添加函数信息的同时是否添加断点 """ input_str = ida_kernwin.ask_text( 0, '', "请输入任意函数名/函数地址,及各参数类型(none, int, str),可输入多行\n例如:\nstrcmp str str") try: rules = [x.strip() for x in input_str.strip().split('\n')] for rule in rules: tgt_t = rule.split(' ')[0].strip() args_rule = [x.strip() for x in rule.split(' ')[1:]] if not tgt_t in self.tmp_func_dict: if tgt_t.startswith('0x'): addr_t = int(tgt_t, 16) addr_hexstr = hexstr(addr_t) CUSTOM_FUNC[addr_hexstr] = {'args_rule': args_rule} self.tmp_func_dict[addr_hexstr] = [addr_t] if info_only == False: ida_dbg.add_bpt(addr_t, 0, idc.BPT_DEFAULT) else: for func_addr_t in idautils.Functions(): func_name_t = ida_funcs.get_func_name(func_addr_t) if func_name_t == tgt_t: CUSTOM_FUNC[func_name_t] = { 'args_rule': args_rule } self.tmp_func_dict[func_name_t] = [] for xref_addr_t in idautils.CodeRefsTo( func_addr_t, 0): self.tmp_func_dict[func_name_t].append( xref_addr_t) if info_only == False: ida_dbg.add_bpt( xref_addr_t, 0, idc.BPT_DEFAULT) else: continue break else: continue else: CUSTOM_FUNC[tgt_t] = {'args_rule': args_rule} for xref_addr_t in self.tmp_func_dict[tgt_t]: if info_only == False: ida_dbg.add_bpt(xref_addr_t, 0, idc.BPT_DEFAULT) else: continue FELogger.info("已添加断点:%s" % rule) except Exception as e: FELogger.info("输入信息有误:%s" % e)
def run(self, arg): print("run") input_str = ida_kernwin.ask_text(100, '', 'Input Target Address') input_str_list = input_str.split(';') addr_list = [] for addr_str in input_str_list: if addr_str == '': continue addr_list.append(int(addr_str, 16)) DoAnalyze = AnalyzExecution(addr_list) DoAnalyze.start_analyze()
def OnViewKeydown(self, key, state): c = chr(key & 0xFF) if c == 'C': s = ida_kernwin.ask_text(0, self.cur_palette, "Edit colors in place or copy-paste palette from color-hex.com") if s: try: self.apply_colors(s) except: pass return True
def OnViewKeydown(self, key, state): c = chr(key & 0xFF) if c == 'C': s = ida_kernwin.ask_text( 0, self.cur_palette, "Edit colors in place or copy-paste palette from color-hex.com" ) if s: try: self.apply_colors(s) except: pass elif c == 'S': self.center_node = not self.center_node print( "%s: sync %sabled" % (HRDevHelper.wanted_name, "en" if self.center_node else "dis")) return True
_set.add(fn_entry) if fn_entry not in entrypoints and fn_entry not in processed: queue.append(fn_entry) processed.add(fn_entry) # else: # print("Entrypoint detected as calling function") # print("%s : %08x(%s) -> %08x -> %08x" % # (fn_name, fn_entry, fn_entry, xref.frm, xref.to)) return _set print("========== LCA function scan ==========") if interactive: fname = ida_kernwin.ask_text(0, "", "Give the name of the first function call") fname2 = ida_kernwin.ask_text(0, "", "Give the name of the second function call") # Create a set containing all entry points to the binary, # we need to stop recursive processing when we encounter them entrypoints = set() for e in Entries(): entrypoints.add(e[2]) # Traverse references to entrypoints set1 = traverse(fname) set2 = traverse(fname2)