credsweeper.rules package
Submodules
credsweeper.rules.rule module
- class credsweeper.rules.rule.Rule(config: Config, rule_dict: Dict)[source]
Bases:
objectRegular expression to detect some credential type.
- Class contains regular expression to detect some credential type, credential name, assumed severity
and details on how detection should be processed
- Parameters:
rule_name – Name displayed if rule
rule_type – RuleType used for this rule
severity – critical/high/medium/low
filters – List of Filter OR _one_ filter Group that can be used to filters False detections based on rules
patterns – Regular expressions that can be used for detection
use_ml – Should ML work on this credential or not. If not prediction based on regular expression and filter only
validations – List of Validation objects that can check this credential using external API
required_substrings – Optional list of substrings. Scanner would only apply this rule if line contain at least one of this substrings
min_line_len – Optional minimal line length. Scanner would only apply this rule if line is equal or longer
usage_list – List of analyze types. There are 2 different analyze type now (“src”, “doc”)
- CONFIDENCE = 'confidence'
- FILTER_TYPE = 'filter_type'
- MIN_LINE_LEN = 'min_line_len'
- NAME = 'name'
- REQUIRED_REGEX = 'required_regex'
- REQUIRED_SUBSTRINGS = 'required_substrings'
- SEVERITY = 'severity'
- TARGET = 'target'
- TYPE = 'type'
- USE_ML = 'use_ml'
- VALUES = 'values'
- all_fields = {'confidence', 'filter_type', 'min_line_len', 'name', 'required_regex', 'required_substrings', 'severity', 'target', 'type', 'use_ml', 'values'}
- property confidence: Confidence
confidence getter
- mandatory_fields = {'confidence', 'min_line_len', 'name', 'severity', 'target', 'type', 'values'}