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 YARA rule scanner that monitors and logs runtime warnings during file scanning operations. Your system should track situations where YARA generates warnings (such as when too many string matches occur) and provide detailed reporting about which rules and strings trigger these warnings.
Implement a Python module that:
Your module should accept:
Your module should return:
Python interface for YARA pattern matching engine, used for malware detection and analysis.
File: test_warning_monitor.py
Description: Verify that warnings are captured when a rule generates too many matches.
Setup:
# Create a rule that will match many times in repetitive data
rule_source = '''
rule test_rule {
strings:
$a = "A"
condition:
$a
}
'''
# Create data with many occurrences to trigger warning
test_data = b"A" * 100000Expected Behavior:
File: test_warning_monitor.py
Description: Verify that the system handles scans with no warnings correctly.
Setup:
rule_source = '''
rule simple_rule {
strings:
$b = "rare_pattern_xyz"
condition:
$b
}
'''
test_data = b"some normal data without the pattern"Expected Behavior:
File: test_warning_monitor.py
Description: Verify that warnings from multiple rules are all captured.
Setup:
rule_source = '''
rule rule_one {
strings:
$x = "X"
condition:
$x
}
rule rule_two {
strings:
$y = "Y"
condition:
$y
}
'''
# Data that causes warnings for both rules
test_data = (b"X" * 50000) + (b"Y" * 50000)Expected Behavior: