suricata_check.utils.checker_typing =================================== .. py:module:: suricata_check.utils.checker_typing .. autoapi-nested-parse:: The `suricata_check.typing` module contains all types used by the `suricata-check` package. Attributes ---------- .. autoapisummary:: suricata_check.utils.checker_typing.EXTENSIVE_SUMMARY_TYPE suricata_check.utils.checker_typing.ISSUES_TYPE suricata_check.utils.checker_typing.RULE_REPORTS_TYPE suricata_check.utils.checker_typing.RULE_SUMMARY_TYPE suricata_check.utils.checker_typing.SIMPLE_SUMMARY_TYPE Exceptions ---------- .. autoapisummary:: suricata_check.utils.checker_typing.InvalidRuleError Classes ------- .. autoapisummary:: suricata_check.utils.checker_typing.Issue suricata_check.utils.checker_typing.OutputReport suricata_check.utils.checker_typing.OutputSummary suricata_check.utils.checker_typing.RuleReport Module Contents --------------- .. py:exception:: InvalidRuleError(message: str) Bases: :py:obj:`RuntimeError` Raised when an invalid rule is detected. Note that some rules may be invalid due to not following the Suricata rule syntax. Rules following the syntax, but considered invalid by Suricata due to missing options need not raise this error. Rules for which this error is not raised are not neccessarily syntactically correct but can be processed by suricata-check. Initializes the `InvalidRuleError` with the raw rule as message. .. py:class:: Issue The `Issue` dataclass represents a single issue found in a rule. .. py:method:: __repr__() -> str Returns the Issue represented as a string. .. py:method:: to_dict() -> dict[str, str] Returns the Issue represented as a dictionary. .. py:attribute:: checker :type: Optional[str] :value: None .. py:attribute:: code :type: str .. py:property:: hash :type: int Returns a unique hash that can be used as a fingerprint for the issue. .. py:attribute:: message :type: str .. py:attribute:: severity :type: Optional[int] :value: None .. py:class:: OutputReport(rules: RULE_REPORTS_TYPE = [], summary: Optional[OutputSummary] = None) The `OutputSummary` dataclass represent the `suricata_check`, consisting of rule reports and summaries. Initialized the `OutputReport`, optionally with a list of rules and/or a summary. .. py:method:: add_rule(rule_report: RuleReport) -> None Adds an rule to the report. .. py:property:: rules :type: RULE_REPORTS_TYPE List of rules contained in the report. .. py:attribute:: summary :type: Optional[OutputSummary] :value: None .. py:class:: OutputSummary The `OutputSummary` dataclass represent a collection of summaries on the output of `suricata_check`. .. py:attribute:: issues_by_group :type: SIMPLE_SUMMARY_TYPE .. py:attribute:: issues_by_type :type: EXTENSIVE_SUMMARY_TYPE .. py:attribute:: overall_summary :type: SIMPLE_SUMMARY_TYPE .. py:class:: RuleReport The `RuleReport` dataclass represents a rule, together with information on its location and detected issues. .. py:method:: __repr__() -> str Returns the RuleReport represented as a string. .. py:method:: add_issue(issue: Issue) -> None Adds an issue to the report. .. py:method:: add_issues(issues: ISSUES_TYPE) -> None Adds an issue to the report. .. py:method:: to_dict() -> dict[str, str] Returns the RuleReport represented as a dictionary. .. py:property:: issues :type: ISSUES_TYPE List of issues found in the rule. .. py:attribute:: line_begin :type: Optional[int] :value: None .. py:attribute:: line_end :type: Optional[int] :value: None .. py:attribute:: rule :type: suricata_check.utils.rule.Rule .. py:attribute:: summary :type: Optional[RULE_SUMMARY_TYPE] :value: None .. py:data:: EXTENSIVE_SUMMARY_TYPE Type representing a dictionary-like object mapping a string to a `SIMPLE_SUMMARY_TYPE`. .. py:data:: ISSUES_TYPE Type representing a sequence of multiple `Issue` instances. .. py:data:: RULE_REPORTS_TYPE Type representing a sequence of multiple `RuleReport` instances. .. py:data:: RULE_SUMMARY_TYPE Type representing a dictionary-like object mapping a string to a number of issues. .. py:data:: SIMPLE_SUMMARY_TYPE Type representing a dictionary-like object mapping a string to a number of issues.