credsweeper.common package
Submodules
credsweeper.common.constants module
- class credsweeper.common.constants.Chars(value)[source]
Bases:
EnumStores enumeration of characters sets of encoding dictionaries
- ASCII_PRINTABLE = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~ \t\n\r\x0b\x0c'
- ASCII_VISIBLE = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~'
- BASE16LOWER = '0123456789abcdef'
- BASE16UPPER = '0123456789ABCDEF'
- BASE32_CHARS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567'
- BASE36_CHARS = '0123456789abcdefghijklmnopqrstuvwxyz'
- BASE62_CHARS = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'
- BASE64STDPAD_CHARS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='
- BASE64STD_CHARS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
- BASE64URLPAD_CHARS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_='
- BASE64URL_CHARS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_'
- HEX_CHARS = '0123456789ABCDEFabcdef'
- UUID_LOWER_CHARS = '0123456789abcdef-'
- UUID_UPPER_CHARS = '0123456789ABCDEF-'
- class credsweeper.common.constants.Confidence(value)[source]
Bases:
EnumConfidence of candidate
- MODERATE = 'moderate'
- STRONG = 'strong'
- WEAK = 'weak'
- static get(confidence: str | Confidence) Confidence | None[source]
returns Confidence value from string or None
- class credsweeper.common.constants.DiffRowType(value)[source]
Bases:
EnumDiff type of row
- ADDED = 'added'
- DELETED = 'deleted'
- class credsweeper.common.constants.GroupType(value)[source]
Bases:
EnumGroup type - used in Group constructor for load predefined set of filters
- DEFAULT = 'default'
- KEYWORD = 'keyword'
- PATTERN = 'pattern'
- class credsweeper.common.constants.RuleType(value)[source]
Bases:
EnumRule type
- KEYWORD = 'keyword'
- MULTI = 'multi'
- PATTERN = 'pattern'
- PEM_KEY = 'pem_key'
- class credsweeper.common.constants.Severity(value)[source]
Bases:
EnumSeverity of candidate
- CRITICAL = 'critical'
- HIGH = 'high'
- INFO = 'info'
- LOW = 'low'
- MEDIUM = 'medium'
credsweeper.common.keyword_checklist module
- class credsweeper.common.keyword_checklist.KeywordChecklist[source]
Bases:
objectKeywordsChecklist contains words 3 or more letters length
- KEYWORD_PATH = PosixPath('/home/docs/checkouts/readthedocs.org/user_builds/credsweeper/checkouts/v1.16.0/credsweeper/common/keyword_checklist.txt')
- MORPHEME_PATH = PosixPath('/home/docs/checkouts/readthedocs.org/user_builds/credsweeper/checkouts/v1.16.0/credsweeper/common/morpheme_checklist.txt')
credsweeper.common.keyword_pattern module
- class credsweeper.common.keyword_pattern.KeywordPattern[source]
Bases:
objectPattern set of keyword types
- auth_keywords = '(\\s?(oauth|bot|basic|bearer|apikey|accesskey|ssws|ntlm|token)\\s)?'
- directive = '(?P<directive>(?:(?:[#%]define|define(?=(\\s|\\\\{1,8}[tnr])*\\()|%global)(?:\\s?\\(|\\s|\\\\{1,8}[tnr]){1,8}|\\bset(?=\\b|\\w*(\\s|\\\\{1,8}[tnr])*\\()))?'
- key_left = '(?:\\\\[nrt]|(\\\\\\\\*u00|%)[0-9a-f]{2}|\\s)*(?P<variable>(([\\"\'`]{1,8}[^:=\\"\'`}<>\\\\/&?]*|[^:=\\"\'`}<>\\s()\\\\/&?;,%]*)'
- key_right = '[^%:=\\"\'`<>({?!&;\\n]{0,80})(&(quot|apos|#3[49]);|(\\\\\\\\*u00|%)[0-9a-f]{2}|[\\"\'`])*)'
- left_quote = '(?P<value_leftquote>((?P<esq>\\\\{1,8})?([\\"\'`]|&(quot|apos|#3[49]);)){1,4}))?'
- right_quote = '(?(value_leftquote)(?P<value_rightquote>(?<!\\\\)(?P=value_leftquote)|\\\\$|(?<=[0-9a-z+_/-])$)|(?(wrap)(\\]|\\)|\\}|;|\\\\|$)))'
- separator = '(?(directive)|(\\s|\\\\{1,8}[tnr])*\\]?(\\s|\\\\{1,8}[tnr])*)(?P<separator>:(\\s[a-z]{3,9}[?]?\\s)?=|:(?!:)|=(>|>|(\\\\\\\\*u00|%)26gt;)|!==|!=|===|==|=~|=|(?(directive)(,|\\\\t|\\s|\\((?!\\))){1,80}|%3d))(\\s|\\\\{1,8}[tnr])*'
- string_prefix = '(((b|r|br|rb|u|t|f|rf|fr|l|@)(?=(\\\\*[\\"\'`])))?'
- value = '(?P<value>(?(value_leftquote)((?!(?P=value_leftquote))(?(esq)((?!(?P=esq)([\\"\'`]|&(quot|apos|#3[49]);)).)|((?!(?P=value_leftquote)).)))|(?!&(quot|apos|#3[49]);)(\\\\{1,8}([ tnr]|[^\\s\\"\'`])|(?P<url_esc>%[0-9a-f]{2})|(?(url_esc)[^\\s\\"\'`,;\\\\&]|[^\\s\\"\'`,;\\\\]))){4,8000}|(<[^>]{4,8000}>)|(\\$?\\({1,3}[^)]{4,8000}\\){1,3})|(\\$?\\{{1,3}[^}]{4,8000}\\}{1,3})|(?(wrap)(?(value_leftquote)(?!\\\\(?P=value_leftquote))|[^\\]\\)\\}]){16,8000}))'
- wrap = '(?P<wrap>(((\\s|\\\\{1,8}[tnr]|new|byte|char|string|\\[\\]){1,8})?(?P<get>([_a-z][0-9a-z_.\\[\\]]*\\.)get|(os\\.)?getenv)?([0-9a-z_.]|::|-(>|>))*\\s*(\\[(?!\\])|\\((?!\\))|\\{(?!\\}))(\\s|\\\\{1,8}[tnr])*(?(get)(\'[^\']{1,31}\'|\\"[^\\"]{1,31}\\")\\s*(,|\\)\\s*or)\\s*|)([0-9a-z_]{1,32}\\s*[:=]\\s*)?){1,8})?'