Exemplo n.º 1
0
 def add_fast_dict_from_all_vuln_func(self):
     mgr_t = FESinkFuncMgr()
     for func_name, xref_list in mgr_t.gen_sink_func_xref():
         if not func_name in self.vuln_func_fast_dict:
             tag = SINK_FUNC[func_name]['tag']
             print('func_name: ', func_name)
             print('xref_list: ', len(xref_list))
             if tag == FUNC_TAG['PRINTF']:
                 items = printf_func_analysis(func_name, xref_list)
                 self.add_fast_dict_from_items(items)
             elif tag == FUNC_TAG['STRING']:
                 items = str_func_analysis(func_name, xref_list)
                 self.add_fast_dict_from_items(items)
             elif tag == FUNC_TAG['SCANF']:
                 items = scanf_func_analysis(func_name, xref_list)
                 self.add_fast_dict_from_items(items)
             elif tag == FUNC_TAG['SYSTEM']:
                 items = system_func_analysis(func_name, xref_list)
                 self.add_fast_dict_from_items(items)
             elif tag == FUNC_TAG['MEMORY']:
                 items = mem_func_analysis(func_name, xref_list)
                 self.add_fast_dict_from_items(items)
             else:
                 FELogger.info("未支持函数%s" % func_name)
         else:
             continue
Exemplo n.º 2
0
    def btn_get_all_sink_func_xref(self, code=0):
        """
        查看所有危险函数调用地址
        """

        cols = [['', 0 | ida_kernwin.Choose.CHCOL_DEC],
                ['函数名', 10 | ida_kernwin.Choose.CHCOL_PLAIN],
                ['函数地址', 10 | ida_kernwin.Choose.CHCOL_HEX]]
        items = []

        mgr_t = FESinkFuncMgr()
        for func_name, xref_list in mgr_t.gen_sink_func_xref():
            tmp_list = []
            for xref_addr in xref_list:
                data = AnalysisChooseData(vuln=0, name=func_name, ea=xref_addr)
                items.append(data)
                tmp_list.append(xref_addr)
            self.sink_func_xref_dict[func_name] = tmp_list

        chooser = AnalysisChooser(title='危险函数调用地址', cols=cols, item=items)
        chooser.Show()
Exemplo n.º 3
0
    def add_or_del_all_xref_bpt(self, is_add):
        if is_add == True:
            action = idc.add_bpt
            act_info = '添加'
        else:
            action = idc.del_bpt
            act_info = '删除'

        if self.sink_func_xref_dict == {}:
            mgr_t = FESinkFuncMgr()
            for func_name, xref_list in mgr_t.gen_sink_func_xref():
                tmp_list = []
                for xref_addr_t in xref_list:
                    tmp_list.append(xref_addr_t)
                    action(xref_addr_t)
                self.sink_func_xref_dict[func_name] = tmp_list
        else:
            for xref_addr_t in reduce(lambda x, y: x + y,
                                      self.sink_func_xref_dict.values()):
                action(xref_addr_t)
        FELogger.info('已%s断点:危险函数调用地址(全部)' % act_info)