Python interface for YARA, a powerful malware identification and classification tool
Overall
score
85%
Evaluation — 85%
↓ 0.94xAgent success when using this tile
Build a tool that compiles YARA rules and extracts metadata from them, with special handling for rules that contain duplicate metadata keys.
Your tool should:
@generates
def aggregate_metadata(rule_source: str, scan_data: bytes) -> list[dict]:
"""
Compile YARA rules from source, scan data, and extract metadata.
Args:
rule_source: YARA rule source code as a string
scan_data: Binary data to scan against the rules
Returns:
A list of dictionaries, one per matching rule, where each dictionary
contains:
- 'rule': the rule name (string)
- 'metadata': a dictionary mapping metadata keys to their values.
For duplicate keys, the value should be a list containing all values
in the order they appear in the rule.
Example:
Given a rule with:
meta:
author = "Alice"
author = "Bob"
version = "1.0"
The metadata dict should be:
{
"author": ["Alice", "Bob"],
"version": "1.0"
}
"""
passProvides pattern matching and rule compilation capabilities.
@satisfied-by
Install with Tessl CLI
npx tessl i tessl/pypi-yara-pythonevals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10