suricata_check.rule =================== .. py:module:: suricata_check.rule .. autoapi-nested-parse:: Wrapper around idstools.rule.Rule for future removal of idstools dependency. Exceptions ---------- .. autoapisummary:: suricata_check.rule.ParsingError Classes ------- .. autoapisummary:: suricata_check.rule.Rule Functions --------- .. autoapisummary:: suricata_check.rule.parse Module Contents --------------- .. py:exception:: ParsingError(message: str) Bases: :py:obj:`RuntimeError` Raised when a rule cannot be parsed by suricata-check. Most likely, such a rule is also an invalid Suricata rule. Initializes the `ParsingError` with the raw rule as message. .. py:class:: Rule(inner: Optional[idstools.rule.Rule]) Wrapper around an `suricata_check.rule.Rule` in preparation for dropping the idstools dependency. Create a wrapper around an existing `suricata_check.rule.Rule`. Parameters ---------- inner: The parsed rule object from `suricata_check.rule.parse()` or None. .. py:method:: __contains__(key: str) -> bool Return True when the underlying rule contains *key*. .. py:method:: __getitem__(key: str) Forward mapping access to the underlying rule. Raises KeyError when no underlying rule is present. .. py:method:: __repr__() -> str Return representation of the wrapped rule (or 'None'). .. py:method:: get(key: str, default: Optional[object] = None) Return the value for *key* if present, otherwise *default*. .. py:property:: inner :type: Optional[idstools.rule.Rule] Return the underlying parsed rule object (or None). .. py:function:: parse(text: Optional[str]) -> Optional[Rule] Parse a rule string using the underlying `idstools` parser. Return a wrapped `Rule` instance. Returns None when the text could not be parsed as a rule.