tessl install tessl/pypi-yara-python@3.11.0Python interface for YARA, a powerful malware identification and classification tool
Agent Success
Agent success rate when using this tile
85%
Improvement
Agent success rate improvement when using this tile compared to baseline
0.94x
Baseline
Agent success rate without this tile
90%
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