credsweeper.common package

Submodules

credsweeper.common.constants module

class credsweeper.common.constants.Base(value)[source]

Bases: Enum

Stores types of character sets in lower case

base36 = 'base36'
base64 = 'base64'
hex = 'hex'
class credsweeper.common.constants.Chars(value)[source]

Bases: Enum

Stores three types characters sets.

BASE32_CHARS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567'
BASE36_CHARS = 'abcdefghijklmnopqrstuvwxyz1234567890'
BASE64STD_CHARS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
BASE64URL_CHARS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_'
BASE64_CHARS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='
HEX_CHARS = '0123456789ABCDEFabcdef'
class credsweeper.common.constants.Confidence(value)[source]

Bases: Enum

Confidence of candidate

MODERATE = 'moderate'
STRONG = 'strong'
WEAK = 'weak'
static get(confidence)[source]

returns Confidence value from string or None

Return type:

Optional[Confidence]

class credsweeper.common.constants.DiffRowType(value)[source]

Bases: Enum

Diff type of row

ADDED = 'added'
DELETED = 'deleted'
class credsweeper.common.constants.GroupType(value)[source]

Bases: Enum

Group type - used in Group constructor for load predefined set of filters

DEFAULT = 'default'
KEYWORD = 'keyword'
PATTERN = 'pattern'
class credsweeper.common.constants.KeyValidationOption(value)[source]

Bases: Enum

API validation state

INVALID_KEY = 0
NOT_AVAILABLE = 3
UNDECIDED = 2
VALIDATED_KEY = 1
class credsweeper.common.constants.KeywordPattern[source]

Bases: object

Pattern set of keyword types

classmethod get_keyword_pattern(keyword)[source]

Returns compiled regex pattern

Return type:

Pattern

key_left = '(?P<variable>(([`\'\\"]+[^:=\'\\"`}<>\\\\/&?]*|[^:=\'\\"`}<>\\s()\\\\/&?]*)(?P<keyword>'
key_right = ')[^:=\'\\"`<>{?!&]*)[`\'\\"]*)'
separator = '\\s*\\]?\\s*(?P<separator>:( [a-z]{3,9} )?=|:( oauth | basic | bearer | apikey | accesskey )?|=>|!=|===|==|=)((?!\\s*ENC(\\(|\\[))(\\s|\\w)*\\((\\s|\\w|=|\\()*|\\s*)'
value = '(?P<value_leftquote>((b|r|br|rb|u|f|rf|fr|\\\\)?[`\'\\"])+)?(?P<value>(?:\\{[^}]{3,8000}\\})|(?:<[^>]{3,8000}>)|(?(value_leftquote)(?:\\\\[tnrux0-7][0-9a-f]*|[^`\'\\"\\\\])|(?:\\\\n|\\\\r|\\\\?[^\\s`\'\\"\\\\])){3,8000})(?P<value_rightquote>(\\\\?[`\'\\"])+)?'
credsweeper.common.constants.MAX_LINE_LENGTH = 8000

//docs.python.org/3/library/codecs.html

Type:

values according https

class credsweeper.common.constants.RuleType(value)[source]

Bases: Enum

Rule type

KEYWORD = 'keyword'
MULTI = 'multi'
PATTERN = 'pattern'
PEM_KEY = 'pem_key'
class credsweeper.common.constants.Severity(value)[source]

Bases: Enum

Severity of candidate

CRITICAL = 'critical'
HIGH = 'high'
INFO = 'info'
LOW = 'low'
MEDIUM = 'medium'
static get(severity)[source]

returns Severity value from string or None

Return type:

Optional[Severity]

class credsweeper.common.constants.ThresholdPreset(value)[source]

Bases: Enum

Preset threshold to simplify precision/recall selection for the user.

high = 'high'
highest = 'highest'
low = 'low'
lowest = 'lowest'
medium = 'medium'

credsweeper.common.keyword_checklist module

class credsweeper.common.keyword_checklist.KeywordChecklist[source]

Bases: object

KeywordsChecklist contains words 3 or more letters length

KEYWORD_PATH = PosixPath('/home/docs/checkouts/readthedocs.org/user_builds/credsweeper/checkouts/latest/credsweeper/common/keyword_checklist.txt')
MORPHEME_PATH = PosixPath('/home/docs/checkouts/readthedocs.org/user_builds/credsweeper/checkouts/latest/credsweeper/common/morpheme_checklist.txt')
property keyword_len: int

Length of keyword_set

property keyword_set: Set[str]

Get set with keywords.

Returns:

Set of strings

property morpheme_len: int

Length of morpheme_set

property morpheme_set: Set[str]

Get extended set with keywords.

Returns:

Extended set of strings

Module contents