credsweeper.ml_model.features package
Submodules
credsweeper.ml_model.features.char_set module
- class credsweeper.ml_model.features.char_set.CharSet(base: str)[source]
Bases:
FeatureFeature is true when all characters of the value are from a set.
- CHARS: Dict[Base, Set[str]] = {Base.ascii_lowercase: {'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'}, Base.ascii_uppercase: {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'}, Base.base16lower: {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'}, Base.base16upper: {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'}, Base.base32: {'2', '3', '4', '5', '6', '7', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'}, Base.base36: {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'}, Base.base64std: {'+', '/', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '=', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'}, Base.base64url: {'-', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '=', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', '_', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'}, Base.digits: {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'}}
credsweeper.ml_model.features.feature module
credsweeper.ml_model.features.file_extension module
credsweeper.ml_model.features.hartley_entropy module
- class credsweeper.ml_model.features.hartley_entropy.HartleyEntropy(base: str, norm: bool = False)[source]
Bases:
RenyiEntropyHartley entropy feature.
credsweeper.ml_model.features.has_html_tag module
credsweeper.ml_model.features.is_secret_numeric module
credsweeper.ml_model.features.reny_entropy module
- class credsweeper.ml_model.features.reny_entropy.RenyiEntropy(base: str, alpha: float, norm=False)[source]
Bases:
FeatureRenyi entropy.
See next link for details: https://digitalassets.lib.berkeley.edu/math/ucb/text/math_s4_v1_article-27.pdf
- Parameters:
alpha – entropy parameter
norm – set True to normalize output probabilities
- CHARS: Dict[Base, Chars] = {Base.base32: Chars.BASE32_CHARS, Base.base36: Chars.BASE36_CHARS, Base.base64: Chars.BASE64_CHARS, Base.hex: Chars.HEX_CHARS}
- estimate_entropy(p_x: ndarray) float[source]
Calculate Renyi entropy of ‘p_x’ sequence.
Function is based on definition of Renyi entropy for arbitrary probability distribution. Please see next link for details: https://digitalassets.lib.berkeley.edu/math/ucb/text/math_s4_v1_article-27.pdf
credsweeper.ml_model.features.rule_name module
credsweeper.ml_model.features.search_in_attribute module
credsweeper.ml_model.features.shannon_entropy module
- class credsweeper.ml_model.features.shannon_entropy.ShannonEntropy(base: str, norm: bool = False)[source]
Bases:
RenyiEntropyShannon entropy feature.