suricata_check.utils.checker_typing

The suricata_check.typing module contains all types used by the suricata-check package.

Exceptions

InvalidRuleError

Raised when an invalid rule is detected.

Classes

Issue

The Issue dataclass represents a single issue found in a rule.

OutputReport

The OutputSummary dataclass represent the suricata_check, consisting of rule reports and summaries.

OutputSummary

The OutputSummary dataclass represent a collection of summaries on the output of suricata_check.

RuleReport

The RuleReport dataclass represents a rule, together with information on its location and detected issues.

Functions

get_all_subclasses(→ collections.abc.Iterable[type[Cls]])

Returns all class types that subclass the provided type.

Module Contents

exception suricata_check.utils.checker_typing.InvalidRuleError(message: str)[source]

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

class suricata_check.utils.checker_typing.Issue[source]

The Issue dataclass represents a single issue found in a rule.

__repr__() str[source]

Returns the Issue represented as a string.

to_dict() dict[str, str][source]

Returns the Issue represented as a dictionary.

property hash: int

Returns a unique hash that can be used as a fingerprint for the issue.

class suricata_check.utils.checker_typing.OutputReport(rules: RULE_REPORTS_TYPE = [], summary: OutputSummary | None = None)[source]

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.

add_rule(rule_report: RuleReport) None[source]

Adds an rule to the report.

property rules: RULE_REPORTS_TYPE

List of rules contained in the report.

class suricata_check.utils.checker_typing.OutputSummary[source]

The OutputSummary dataclass represent a collection of summaries on the output of suricata_check.

class suricata_check.utils.checker_typing.RuleReport[source]

The RuleReport dataclass represents a rule, together with information on its location and detected issues.

__repr__() str[source]

Returns the RuleReport represented as a string.

add_issue(issue: Issue) None[source]

Adds an issue to the report.

add_issues(issues: ISSUES_TYPE) None[source]

Adds an issue to the report.

to_dict() dict[str, str][source]

Returns the RuleReport represented as a dictionary.

property issues: ISSUES_TYPE

List of issues found in the rule.

suricata_check.utils.checker_typing.get_all_subclasses(cls: type[Cls]) collections.abc.Iterable[type[Cls]][source]

Returns all class types that subclass the provided type.