scanner package

Subpackages

Submodules

scanner.scanner module

class credsweeper.scanner.scanner.Scanner(config, rule_path)[source]

Bases: object

Advanced Credential Scanner base class.

Parameters:
  • rules – list of rule objects to check

  • min_pattern_len – minimal length specified in all pattern rules

  • min_keyword_len – minimal possible length for a string to be matched by any keyword rule

  • min_len – Smallest between min_pattern_len and min_keyword_len

  • TargetGroup – Type for List[Tuple[AnalysisTarget, str, int]]

TargetGroup

alias of List[Tuple[AnalysisTarget, str, int]]

classmethod get_scanner(rule)[source]

Choose type of scanner base on rule affiliation.

Parameters:

rule (Rule) – rule object used to scanning

Return type:

Type[ScanType]

Returns:

depending on the rule type, returns the corresponding scanner class

static get_targets_to_check(keyword_targets, pattern_targets, pem_targets, rule)[source]

Choose target subset based on a rule.

Parameters:
Return type:

List[Tuple[AnalysisTarget, str, int]]

Returns:

depending on the rule type, returns one of the other arguments

scan(targets)[source]

Run scanning of list of target lines from ‘targets’ with set of rule from ‘self.rules’.

Parameters:

targets (List[AnalysisTarget]) – objects with data to analyse: line, line number, filepath and all lines in file

Return type:

List[Candidate]

Returns:

list of all detected credential candidates in analysed targets

Module contents