SusPatterns¶
The SusPatterns
class manages suspicious patterns for security threat detection.
Class Definition¶
Class Methods¶
add_pattern¶
@classmethod
async def add_pattern(
cls,
pattern: str,
custom: bool = False
) -> None:
"""
Add a new pattern to the detection system.
"""
remove_pattern¶
@classmethod
async def remove_pattern(
cls,
pattern: str,
custom: bool = False
) -> None:
"""
Remove a pattern from the detection system.
"""
get_all_patterns¶
Pattern Synchronization¶
Custom patterns are stored in Redis when enabled:
# Add pattern to Redis
await SusPatterns.add_pattern(r"malicious.*", custom=True)
# Get patterns from Redis
patterns = await redis.get_key("patterns", "custom")