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 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:
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