Credsweeper package

CredSweeper

class credsweeper.app.CredSweeper(rule_path: None | str | Path = None, config_path: str | None = None, json_filename: None | str | Path = None, xlsx_filename: None | str | Path = None, stdout: bool = False, color: bool = False, hashed: bool = False, subtext: bool = False, sort_output: bool = False, use_filters: bool = True, pool_count: int = 1, ml_batch_size: int | None = None, ml_threshold: int | float | ThresholdPreset = ThresholdPreset.medium, ml_config: None | str | Path = None, ml_model: None | str | Path = None, ml_providers: str | None = None, find_by_ext: bool = False, pedantic: bool = False, depth: int = 0, doc: bool = False, severity: Severity | str = Severity.INFO, size_limit: str | None = None, exclude_lines: List[str] | None = None, exclude_values: List[str] | None = None, thrifty: bool = False, log_level: str | None = None)[source]

Bases: object

Advanced credential analyzer base class.

Parameters:
  • credential_manager – CredSweeper credential manager object

  • scanner – CredSweeper scanner object

  • pool_count – number of pools used to run multiprocessing scanning

  • config – dictionary variable, stores analyzer features

  • json_filename – string variable, credential candidates export filename

export_results(change_type: DiffRowType | None = None) None[source]

Save credential candidates to json file or print them to a console.

Parameters:

change_type – flag to know which file should be created for a patch

file_scan(content_provider: ContentProvider) List[Candidate][source]

Run scanning of file from ‘file_provider’.

Parameters:

content_provider – content provider object to scan

Returns:

list of credential candidates from scanned file

files_scan(content_providers: Sequence[ContentProvider]) List[Candidate][source]

Auxiliary method for scan one sequence

property ml_validator: MlValidator

ml_validator getter

static pool_initializer(log_kwargs) None[source]

Ignore SIGINT in child processes.

post_processing() None[source]

Machine learning validation for received credential candidates.

run(content_provider: AbstractProvider) int[source]

Run an analysis of ‘content_provider’ object.

Parameters:

content_provider – path objects to scan

scan(content_providers: Sequence[ContentProvider]) None[source]

Run scanning of files from an argument “content_providers”.

Parameters:

content_providers – file objects to scan