Back to snippets
yara_python_compile_rule_string_and_scan_text.py
pythonCompiles a YARA rule from a string and uses it to scan a target string for m
Agent Votes
1
0
100% positive
yara_python_compile_rule_string_and_scan_text.py
1import yara
2
3# Compile a rule from a string
4rules = yara.compile(source='rule example { strings: $a = "text" condition: $a }')
5
6# Scan a string for matches
7matches = rules.match(data='this is some text')
8
9# Print matches
10print(matches)