Skip to content

rules.py

Ruleset configuration objects for Suricata

To import...

from dynamite_nsm.services.base.config_objects.suricata import rules as suricata_config_rules

Rule

__init__(self, name, enabled=False) special

Represents a Suricata ruleset that can be enabled or disabled.

Parameters:

Name Type Description Default
name str

The name of the ruleset

required
enabled Optional[bool]

Whether or not the ruleset is enabled

False
Source code in dynamite_nsm/services/base/config_objects/suricata/rules.py
def __init__(self, name: str, enabled: Optional[bool] = False):
    """
    Represents a Suricata ruleset that can be enabled or disabled.
    Args:
        name: The name of the ruleset
        enabled: Whether or not the ruleset is enabled
    """
    self.value = None
    super().__init__(name, enabled)

Rules

__init__(self, rules=None) special

A collection of Suricata rulesets

Parameters:

Name Type Description Default
rules Optional[List[dynamite_nsm.services.base.config_objects.suricata.rules.Rule]]

A list of Rule objects

None
Source code in dynamite_nsm/services/base/config_objects/suricata/rules.py
def __init__(self, rules: Optional[List[Rule]] = None):
    """A collection of Suricata rulesets
    Args:
        rules: A list of Rule objects
    """
    super().__init__(rules)
    self.rules = self.analyzers

list_available_rule_names()

List the names of all available Suricata rules.

Returns:

Type Description
List[str]

A list of Suricata rule names that can be enabled

Source code in dynamite_nsm/services/base/config_objects/suricata/rules.py
def list_available_rule_names() -> List[str]:
    """List the names of all available Suricata rules.
    Returns:
        A list of Suricata rule names that can be enabled
    """
    return available_rules_names