Skip to content

Commit

Permalink
Improve password regex
Browse files Browse the repository at this point in the history
More work to be done here but this is a start.
  • Loading branch information
emtunc committed Mar 27, 2020
1 parent 833fd11 commit db340f6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.*/
__pycache__
SlackPirate_*/
.DS_Store
10 changes: 5 additions & 5 deletions SlackPirate.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,12 @@
r"|s3-[a-zA-Z0-9-\.\_\/]+" \
r"|s3.amazonaws.com/[a-zA-Z0-9-\.\_]+" \
r"|s3.console.aws.amazon.com/s3/buckets/[a-zA-Z0-9-\.\_]+)"
# https://regex101.com/r/DoPV1M/1
# https://regex101.com/r/DoPV1M/3
CREDENTIALS_REGEX = r"(?i)(" \
r"password\s*[`=:\"]+\s*[^\s]+" \
r"|password is\s*[`=:\"]+\s*[^\s]+" \
r"|pwd\s*[`=:\"]+\s*[^\s]+" \
r"|passwd\s*[`=:\"]+\s*[^\s]+)"
r"password\s*[`=:\"]+\s*[^\s]+|" \
r"password is\s*[`=:\"]*\s*[^\s]+|" \
r"pwd\s*[`=:\"]*\s*[^\s]+|" \
r"passwd\s*[`=:\"]+\s*[^\s]+)"
# https://regex101.com/r/IEq5nU/4
AWS_KEYS_REGEX = r"((?<![A-Za-z0-9/+])[A-Za-z0-9/+=]{40}(?![A-Za-z0-9/+=])|(?<![A-Z0-9])[A-Z0-9]{20}(?![A-Z0-9]))"
# https://regex101.com/r/SU43wh/1
Expand Down

0 comments on commit db340f6

Please sign in to comment.