API Reference: Malware Triage with YARA
yara-python API
Match Object Attributes
| Attribute |
Type |
Description |
match.rule |
str |
Name of the matching rule |
match.namespace |
str |
Rule file namespace |
match.tags |
list |
Tags from the rule definition |
match.meta |
dict |
Meta fields (author, description, hash) |
match.strings |
list |
Matched strings: (offset, identifier, data) |
YARA CLI
| Command |
Description |
yara rules.yar sample.exe |
Scan file against rules |
yara -r rules.yar /dir/ |
Recursive directory scan |
yara -s rules.yar sample.exe |
Show matching strings |
yarac rules.yar compiled.yarc |
Compile rules for faster loading |
yara -C rules.yar |
Check rule syntax |
Python Libraries
| Library |
Version |
Purpose |
yara-python |
>=4.3 |
YARA rule compilation and scanning |
hashlib |
stdlib |
Sample hashing (SHA-256, MD5) |
References