MCPcopy Create free account
hub / github.com/NextronSystems/valhallaAPI / filter_search

Function filter_search

valhallaAPI/filters.py:192–205  ·  view source on GitHub ↗

Filter the rules object for rules that have a certain string in them :param rules: YARA rules JSON object :param query: string to search in rule name and description :return: list of filtered rules

(rules, query)

Source from the content-addressed store, hash-verified

190
191
192def filter_search(rules, query):
193 """
194 Filter the rules object for rules that have a certain string in them
195 :param rules: YARA rules JSON object
196 :param query: string to search in rule name and description
197 :return: list of filtered rules
198 """
199 filtered_rules = []
200 # Process the rules
201 for rule in rules:
202 if re.search(r'%s' % query, rule['description'], re.IGNORECASE) or \
203 re.search(r'%s' % query, rule['name'], re.IGNORECASE):
204 filtered_rules.append(rule)
205 return filtered_rules
206
207
208def get_product_templates():

Callers 1

get_rules_jsonMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected