suricata_check.utils.checker_typing

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

Attributes

EXTENSIVE_SUMMARY_TYPE

Type representing a dictionary-like object mapping a string to a SIMPLE_SUMMARY_TYPE.

ISSUES_TYPE

Type representing a sequence of multiple Issue instances.

RULE_REPORTS_TYPE

Type representing a sequence of multiple RuleReport instances.

RULE_SUMMARY_TYPE

Type representing a dictionary-like object mapping a string to a number of issues.

SIMPLE_SUMMARY_TYPE

Type representing a dictionary-like object mapping a string to a number of issues.

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.

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.

checker: str | None = None
code: str
property hash: int

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

message: str
severity: int | None = None
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.

summary: OutputSummary | None = None
class suricata_check.utils.checker_typing.OutputSummary[source]

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

issues_by_group: SIMPLE_SUMMARY_TYPE
issues_by_type: EXTENSIVE_SUMMARY_TYPE
overall_summary: SIMPLE_SUMMARY_TYPE
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.

line_begin: int | None = None
line_end: int | None = None
rule: suricata_check.utils.rule.Rule
summary: RULE_SUMMARY_TYPE | None = None
suricata_check.utils.checker_typing.EXTENSIVE_SUMMARY_TYPE

Type representing a dictionary-like object mapping a string to a SIMPLE_SUMMARY_TYPE.

suricata_check.utils.checker_typing.ISSUES_TYPE

Type representing a sequence of multiple Issue instances.

suricata_check.utils.checker_typing.RULE_REPORTS_TYPE

Type representing a sequence of multiple RuleReport instances.

suricata_check.utils.checker_typing.RULE_SUMMARY_TYPE

Type representing a dictionary-like object mapping a string to a number of issues.

suricata_check.utils.checker_typing.SIMPLE_SUMMARY_TYPE

Type representing a dictionary-like object mapping a string to a number of issues.