suricata_check_design_principles.checkers.principle.ml ====================================================== .. py:module:: suricata_check_design_principles.checkers.principle.ml .. autoapi-nested-parse:: `PrincipleMLChecker`. Attributes ---------- .. autoapisummary:: suricata_check_design_principles.checkers.principle.ml.COUNT_COLUMNS suricata_check_design_principles.checkers.principle.ml.DROPDOWN_COLUMNS suricata_check_design_principles.checkers.principle.ml.GRIDSEARCHCV suricata_check_design_principles.checkers.principle.ml.IP_COLUMNS suricata_check_design_principles.checkers.principle.ml.IP_KEYWORDS suricata_check_design_principles.checkers.principle.ml.MSG_COLUMNS suricata_check_design_principles.checkers.principle.ml.MSG_KEYWORDS suricata_check_design_principles.checkers.principle.ml.NUMERICAL_COLUMNS suricata_check_design_principles.checkers.principle.ml.N_JOBS suricata_check_design_principles.checkers.principle.ml.PARAM_GRID suricata_check_design_principles.checkers.principle.ml.PIPELINE suricata_check_design_principles.checkers.principle.ml.PRECISION_WEIGHT suricata_check_design_principles.checkers.principle.ml.SCORER suricata_check_design_principles.checkers.principle.ml.SPLITTABLE_FEATURES suricata_check_design_principles.checkers.principle.ml.SPLITTER suricata_check_design_principles.checkers.principle.ml.STRING_COLUMNS Classes ------- .. autoapisummary:: suricata_check_design_principles.checkers.principle.ml.PrincipleMLChecker Module Contents --------------- .. py:class:: PrincipleMLChecker(include: Optional[collections.abc.Iterable[str]] = None) Bases: :py:obj:`suricata_check.checkers.interface.CheckerInterface` The `PrincipleChecker` contains several checks based on the Ruling the Unruly paper and target specificity and coverage. Codes Q000-Q009 report on non-adherence to rule design principles similar to Q000-Q009. Differently, they are the result of machine learning analysis of the rules. Initializes the checker given a list of issue codes to emit. .. py:method:: __getnewargs__() -> tuple Returns the arguments to be passed to the __new__ method when unpickling. .. py:method:: train(df: pandas.DataFrame, rule_col: str = 'rule.rule', principle_cols: dict[str, str] = {'Q000': 'labelled.no_proxy', 'Q001': 'labelled.success', 'Q002': 'labelled.thresholded', 'Q003': 'labelled.exceptions', 'Q004': 'labelled.generalized_match_content', 'Q005': 'labelled.generalized_match_location'}, reuse_models: bool = False) -> None Train several models for the checker to detect issues in rules. The checker class with trained models is stored in a pickle file (`_PICKLE_PATH`). .. py:attribute:: codes A Mapping of issue codes emitted by the checker to metadata for those issue types. The metadata is structured in the form of a Mapping from attribute name to attribute value. The one mandatory metadata attribute is severity, which must be one of the levels provided by the `logging` module .. py:attribute:: count_columns :value: ('flowbits.isset.count', 'flowbits.isntoset.count', 'flowint.isset.count',... .. py:attribute:: dropdown_columns :value: ('proto', 'threshold.type') .. py:attribute:: enabled_by_default :value: False A boolean indicating if the checker is enabled by default when discovered automatically. .. py:attribute:: ip_columns .. py:attribute:: ip_keywords :value: ('$HOME_NET', '$HTTP_SERVERS', '$EXTERNAL_NET', 'any') .. py:attribute:: msg_columns .. py:attribute:: msg_keywords :value: ('Suspicious', 'CVE', 'Vulnerability', 'Response') .. py:attribute:: numerical_columns :value: ('threshold.count',) .. py:attribute:: splittable_features :value: ('metadata', 'flow', 'threshold') .. py:attribute:: string_columns :value: () .. py:data:: COUNT_COLUMNS :value: ('flowbits.isset.count', 'flowbits.isntoset.count', 'flowint.isset.count',... .. py:data:: DROPDOWN_COLUMNS :value: ('proto', 'threshold.type') .. py:data:: GRIDSEARCHCV .. py:data:: IP_COLUMNS .. py:data:: IP_KEYWORDS :value: ('$HOME_NET', '$HTTP_SERVERS', '$EXTERNAL_NET', 'any') .. py:data:: MSG_COLUMNS .. py:data:: MSG_KEYWORDS :value: ('Suspicious', 'CVE', 'Vulnerability', 'Response') .. py:data:: NUMERICAL_COLUMNS :value: ('threshold.count',) .. py:data:: N_JOBS :value: 8 .. py:data:: PARAM_GRID :type: list[dict] .. py:data:: PIPELINE .. py:data:: PRECISION_WEIGHT :value: 10 .. py:data:: SCORER .. py:data:: SPLITTABLE_FEATURES :value: ('metadata', 'flow', 'threshold') .. py:data:: SPLITTER .. py:data:: STRING_COLUMNS :value: ()