file_handler package¶
Submodules¶
file_handler.analysis_target module¶
file_handler.content_provider module¶
- class credsweeper.file_handler.content_provider.ContentProvider(_file_path)[source]¶
Bases:
ABC
Base class to provide access to analysis targets for scanned object.
- abstract get_analysis_target()[source]¶
Load and preprocess file diff data to scan.
- Return type:
- Returns:
row objects to analysing
file_handler.diff_content_provider module¶
- class credsweeper.file_handler.diff_content_provider.DiffContentProvider(file_path, change_type, diff)[source]¶
Bases:
ContentProvider
Provide data from a single .patch file.
- Parameters:
- get_analysis_target()[source]¶
Preprocess file diff data to scan.
- Return type:
- Returns:
list of analysis targets of every row of file diff corresponding to change type “self.change_type”
file_handler.file_path_extractor module¶
- class credsweeper.file_handler.file_path_extractor.FilePathExtractor[source]¶
Bases:
object
Util class to browse files in directories
- classmethod get_file_paths(config, path)[source]¶
Get all files in the directory. Automatically exclude files non-code or data files (such as .jpg).
file_handler.files_provider module¶
- class credsweeper.file_handler.files_provider.FilesProvider(paths, change_type=None, skip_ignored=None)[source]¶
Bases:
ABC
Base class for all files provider objects.
- Parameters:
file_handler.patch_provider module¶
- class credsweeper.file_handler.patch_provider.PatchProvider(paths, change_type=None, skip_ignored=None)[source]¶
Bases:
FilesProvider
Provide data from a list of .patch files.
Allows to scan for data that has changed between git commits, rather than the entire project.
- Parameters:
paths (
List
[str
]) – file paths list to scan. All files should be in .patch formatchange_type (
Optional
[str
]) – string, type of analyses changes in patch (added or deleted)skip_ignored (
Optional
[bool
]) – boolean variable, Checking the directory to the list of ignored directories from the gitignore file
file_handler.text_content_provider module¶
- class credsweeper.file_handler.text_content_provider.TextContentProvider(file_path, change_type=None, diff=None)[source]¶
Bases:
ContentProvider
Provide access to analysis targets for full-text file scanning.
- Parameters:
file_path (
str
) – string, path to file
file_handler.text_provider module¶
- class credsweeper.file_handler.text_provider.TextProvider(paths, change_type=None, skip_ignored=None)[source]¶
Bases:
FilesProvider
Provider of full text files analysing.
- Parameters:
- get_files_sequence(file_paths)[source]¶
Get list of paths and returns list of TextContentProviders
- Parameters:
- Return type:
- Returns:
list of files providers
Module contents¶
- class credsweeper.file_handler.ByteContentProvider(content, file_path=None)[source]¶
Bases:
ContentProvider
Allow to scan byte sequence.
- Parameters:
- class credsweeper.file_handler.ContentProvider(_file_path)[source]¶
Bases:
ABC
Base class to provide access to analysis targets for scanned object.
- abstract get_analysis_target()[source]¶
Load and preprocess file diff data to scan.
- Return type:
- Returns:
row objects to analysing
- class credsweeper.file_handler.DataContentProvider(data, file_path=None)[source]¶
Bases:
ContentProvider
Dummy raw provider to keep bytes
- Parameters:
- class credsweeper.file_handler.DiffContentProvider(file_path, change_type, diff)[source]¶
Bases:
ContentProvider
Provide data from a single .patch file.
- Parameters:
- get_analysis_target()[source]¶
Preprocess file diff data to scan.
- Return type:
- Returns:
list of analysis targets of every row of file diff corresponding to change type “self.change_type”
- class credsweeper.file_handler.StringContentProvider(lines, file_path=None)[source]¶
Bases:
ContentProvider
Allow to scan array of lines.
- Parameters:
- class credsweeper.file_handler.TextContentProvider(file_path, change_type=None, diff=None)[source]¶
Bases:
ContentProvider
Provide access to analysis targets for full-text file scanning.
- Parameters:
file_path (
str
) – string, path to file