def do_search(self, line):
        results = self.search(line)
        for result, args in results:
            flattened_args = {}
            for search_type in ('plain', 'regex'):
                for k, v in args[search_type].iteritems():
                    flattened_args[k] = v
            result = copy(result)
            for field_name, search_vals in self.highlighted_fields_map.iteritems():
                for search_val in search_vals:
                    if search_val in flattened_args:
                        pattern = flattened_args[search_val]
                        result[field_name] = re.sub(
                            pattern if (field_name in args['regex']) else re.escape(pattern),
                            lambda matchobj: '\033[1;33m' + matchobj.group(0) + '\033[0m',
                            result[field_name],
                            flags=re.I
                        )
            result_str = "[%s] %s - %s" % (result['id'], result['description'], result['file'])
            print result_str
        print ''
search - search database for exploits
dataset/ETHPy150Open Gioyik/getExploit/getExploit.py/ExploitSearch.do_search