credsweeper.ml_model package
Subpackages
- credsweeper.ml_model.features package
- Submodules
- credsweeper.ml_model.features.entropy_evaluation module
- credsweeper.ml_model.features.feature module
- credsweeper.ml_model.features.file_extension module
- credsweeper.ml_model.features.has_html_tag module
- credsweeper.ml_model.features.is_secret_numeric module
- credsweeper.ml_model.features.length_of_attribute module
- credsweeper.ml_model.features.morpheme_dense module
- credsweeper.ml_model.features.rule_name module
- credsweeper.ml_model.features.rule_severity module
- credsweeper.ml_model.features.search_in_attribute module
- credsweeper.ml_model.features.word_in module
- credsweeper.ml_model.features.word_in_path module
- credsweeper.ml_model.features.word_in_postamble module
- credsweeper.ml_model.features.word_in_preamble module
- credsweeper.ml_model.features.word_in_transition module
- credsweeper.ml_model.features.word_in_value module
- credsweeper.ml_model.features.word_in_variable module
- Module contents
Submodules
credsweeper.ml_model.ml_validator module
- class credsweeper.ml_model.ml_validator.MlValidator(threshold: float | ThresholdPreset, ml_config: None | str | Path = None, ml_model: None | str | Path = None, ml_providers: str | None = None)[source]
Bases:
objectML validation class
- FAKE_CHAR = '\x01'
- MAX_LEN = 128
- ZERO_CHAR = '\x00'
- extract_common_features(candidates: List[Candidate]) ndarray[source]
Extract features that are guaranteed to be the same for all candidates on the same line with same value.
- extract_features(candidates: List[Candidate]) ndarray[source]
extracts common and unique features from list of candidates
- extract_unique_features(candidates: List[Candidate]) ndarray[source]
Extract features that can be different between candidates. Join them with or operator.
- get_group_features(candidates: List[Candidate]) Tuple[ndarray, ndarray, ndarray, ndarray][source]
np.newaxis used to add new dimension if front, so input will be treated as a batch
- property session: InferenceSession
session getter to prevent pickle error
- validate_groups(group_list: List[Tuple[CandidateKey, List[Candidate]]], batch_size: int) Tuple[ndarray, ndarray][source]
Use ml model on list of candidate groups.
- Parameters:
group_list – List of tuples (value, group)
batch_size – ML model batch
- Returns:
Boolean numpy array with decision based on the threshold, and numpy array with probability predicted by the model