credsweeper.ml_model.features package¶
Submodules¶
credsweeper.ml_model.features.char_set module¶
- class credsweeper.ml_model.features.char_set.CharSet(base)[source]¶
Bases:
FeatureFeature is true when all characters of the value are from a set.
-
CHARS:
Dict[Base,Set[str]] = {<Base.digits: 'digits'>: {'2', '4', '9', '7', '8', '0', '6', '1', '3', '5'}, <Base.ascii_uppercase: 'ascii_uppercase'>: {'G', 'S', 'W', 'L', 'U', 'O', 'I', 'P', 'D', 'N', 'Q', 'Y', 'F', 'H', 'V', 'E', 'C', 'J', 'T', 'M', 'X', 'A', 'B', 'R', 'K', 'Z'}, <Base.ascii_lowercase: 'ascii_lowercase'>: {'q', 'a', 'u', 'k', 'o', 'z', 'v', 'n', 'd', 'p', 'r', 't', 'm', 'i', 's', 'l', 'x', 'j', 'y', 'w', 'h', 'e', 'b', 'f', 'c', 'g'}, <Base.base16upper: 'base16upper'>: {'2', '4', '9', 'F', '7', 'D', 'A', '8', 'B', 'E', 'C', '0', '6', '1', '3', '5'}, <Base.base16lower: 'base16lower'>: {'2', 'f', '4', '9', 'c', '7', 'e', '8', 'a', '0', '6', '1', '3', 'd', 'b', '5'}, <Base.base32: 'base32'>: {'G', 'S', 'W', 'L', 'U', 'O', 'I', 'P', '7', 'D', 'N', 'Q', '6', 'Y', '4', 'F', 'H', 'V', 'E', 'C', 'J', 'T', '3', 'M', '2', 'X', 'A', 'B', 'R', 'K', 'Z', '5'}, <Base.base36: 'base36'>: {'q', 'a', 'u', 'k', 'o', 'z', '0', 'v', 'n', 'd', '5', 'p', '9', 'r', '7', 't', 'm', '6', 'i', 's', 'l', 'x', 'j', 'y', 'w', '4', 'h', '1', 'e', '3', 'b', 'f', '2', 'c', '8', 'g'}, <Base.base64std: 'base64std'>: {'G', 'S', 'W', 'q', 'a', 'u', 'k', 'o', 'z', '0', 'L', 'U', 'v', 'O', 'd', 'n', 'I', '5', 'p', '9', 'P', 'r', '7', 'D', 't', 'm', 'N', 'Q', '6', 'Y', '+', 'i', 'l', 's', 'x', '/', 'j', 'y', 'F', 'w', '4', 'H', 'V', 'h', 'E', 'C', '=', 'J', '1', 'T', 'e', '3', 'M', 'b', 'f', '2', 'c', 'X', 'A', 'B', '8', 'R', 'K', 'Z', 'g'}, <Base.base64url: 'base64url'>: {'G', 'S', 'W', 'q', 'a', 'u', 'k', 'o', 'z', '0', 'L', 'U', 'v', 'O', 'd', 'n', 'I', '5', 'p', '9', 'P', 'r', '7', 'D', 't', 'm', 'N', 'Q', '6', 'Y', 'i', 'l', 's', 'x', 'j', 'y', 'F', 'w', '4', 'H', 'V', 'h', '-', 'E', 'C', '_', '=', 'J', '1', 'T', 'e', '3', 'M', 'b', 'f', '2', 'c', 'X', 'A', 'B', '8', 'R', 'K', 'Z', 'g'}}¶
-
CHARS:
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, norm=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.search_in_attribute module¶
credsweeper.ml_model.features.reny_entropy module¶
- class credsweeper.ml_model.features.reny_entropy.RenyiEntropy(base, alpha, 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 (
float) – entropy parameternorm – set True to normalize output probabilities
-
CHARS:
Dict[Base,Chars] = {<Base.base32: 'base32'>: <Chars.BASE32_CHARS: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567'>, <Base.base36: 'base36'>: <Chars.BASE36_CHARS: 'abcdefghijklmnopqrstuvwxyz1234567890'>, <Base.base64: 'base64'>: <Chars.BASE64_CHARS: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='>, <Base.hex: 'hex'>: <Chars.HEX_CHARS: '0123456789ABCDEFabcdef'>}¶
- estimate_entropy(p_x)[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
- Return type:
credsweeper.ml_model.features.rule_name module¶
credsweeper.ml_model.features.shannon_entropy module¶
- class credsweeper.ml_model.features.shannon_entropy.ShannonEntropy(base, norm=False)[source]¶
Bases:
RenyiEntropyShannon entropy feature.
- base: Base¶