Skip to content

Commit

Permalink
main.py
Browse files Browse the repository at this point in the history
Version 2.0
  • Loading branch information
dragonked2 authored Oct 23, 2023
1 parent 857ca41 commit 9a72f88
Showing 1 changed file with 156 additions and 51 deletions.
207 changes: 156 additions & 51 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,76 +16,181 @@

regex_list = {
"Google API Key": r"AIza[0-9A-Za-z\\-_]{35}",
"Artifactory API Token": r'(?:\s|=|:|"|^)AKC[a-zA-Z0-9]{10,}',
"Artifactory Password": r'(?:\s|=|:|"|^)AP[\dABCDEF][a-zA-Z0-9]{8,}',
"Cloudinary Basic Auth": r"cloudinary:\/\/[0-9]{15}:[0-9A-Za-z]+@[a-z]+",
"Firebase Key": r"AAAA[A-Za-z0-9_-]{7}:[A-Za-z0-9_-]{140}",
"LinkedIn Secret Key": r"(?i)linkedin(.{0,20})?['\"][0-9a-z]{16}['\"]",
"Mailto String": r"(?<=mailto:)[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9.-]+",
"Firebase URL": r".*firebaseio\.com",
"Artifactory API Token": r'(?:\s|=|:|^|"|&)AKC[a-zA-Z0-9]{10,}',
"Cloudinary API Key": r"cloudinary://[0-9]{15}:[0-9A-Za-z]+@[a-z]+",
"Firebase API Key": r"AAAA[A-Za-z0-9_-]{7}:[A-Za-z0-9_-]{140}",
"LinkedIn API Key": r"(?i)linkedin(.{0,20})?['\"][0-9a-z]{16}['\"]",
"Email Address": r"(?<=mailto:)[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z.-]+",
"PGP Private Key Block": r"-----BEGIN PGP PRIVATE KEY BLOCK-----",
"SSH Private Key": r"-----BEGIN (?:DSA|EC|OPENSSH|RSA) PRIVATE KEY-----",
"SSH (ssh-ed25519) Public Key": r"ssh-ed25519",
"Google Captcha Key": r"6L[0-9A-Za-z-_]{38}|^6[0-9a-zA-Z_-]{39}$",
"Amazon AWS Access Key ID": r"AKIA[0-9A-Z]{16}",
"Amazon MWS Auth Token": r"amzn\\.mws\\.[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}",
"Amazon AWS API Key": r"AKIA[0-9A-Z]{16}",
"Amazon AWS URL": r"s3\.amazonaws\.com(?:[/]+|[a-zA-Z0-9_-]*\.s3\.amazonaws\.com)",
"Generic API Key": r"(?i)api[_]?key.*['|\"]\w{32,45}['|\"]",
"Generic Secret": r"(?i)secret.*['|\"]\w{32,45}['|\"]",
"Authorization Bearer": r"bearer [a-zA-Z0-9_\\-\\.=]+",
"Authorization Basic": r"basic [a-zA-Z0-9=:_\+\/-]{5,100}",
"Amazon MWS Auth Token": r"amzn\.mws\.[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}",
"Authorization Bearer Token": r"bearer [a-zA-Z0-9_\\-\\.=]+",
"Authorization Basic Credentials": r"basic [a-zA-Z0-9=:_\+\/-]{5,100}",
"Authorization API Key": r"api[key|_key|\s+]+[a-zA-Z0-9_\-]{5,100}",
"PayPal Braintree Access Token": r"access_token\$production\$[0-9a-z]{16}\$[0-9a-f]{32}",
"Mailgun API Key": r"key-[0-9a-zA-Z]{32}",
"MailChimp API Key": r"[0-9a-f]{32}-us[0-9]{1,2}",
"RSA Private Key": r"-----BEGIN RSA PRIVATE KEY-----",
"Heroku API Key": r"(?i)heroku.*[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}",
"JWT Token": r"ey[A-Za-z0-9-_=]+\.[A-Za-z0-9-_=]+\.?[A-Za-z0-9-_.+/=]*$",
"Facebook Access Token": r"EAACEdEose0cBA[0-9A-Za-z]+",
"Facebook OAuth": r"(?i)facebook.*['|\"][0-9a-f]{32}['|\"]",
"Google OAuth": r"ya29\.[0-9A-Za-z\-_]+",
"Facebook Client ID": r"(?i)(facebook|fb)(.{0,20})?['\"][0-9]{13,17}",
"Facebook App ID": r"(?i)(facebook|fb)(.{0,20})?['\"][0-9]{13,17}",
"Google Cloud Platform API Key": r"(?i)\bAIza[0-9A-Za-z\\-_]{35}\b",
"Google Cloud Platform OAuth": r"[0-9]+-[0-9A-Za-z_]{32}\\.apps\\.googleusercontent\\.com",
"Google Drive API Key": r"AIza[0-9A-Za-z-_]{35}",
"Google Drive OAuth": r"(?i)client.*(['\"]).*?client_id['\"]\s*:\s*['\"](.*?)[0-9]-[a-z]{16}['\"]",
"Google Gmail API Key": r"AIza[0-9A-Za-z-_]{35}",
"Google Gmail OAuth": r"(?i)client.*(['\"]).*?client_id['\"]\s*:\s*['\"](.*?)[0-9]-[a-z]{16}['\"]",
"Google Maps API Key": r"AIza[0-9A-Za-z-_]{35}",
"Google Maps OAuth": r"(?i)client.*(['\"]).*?client_id['\"]\s*:\s*['\"](.*?)[0-9]-[a-z]{16}['\"]",
"Google Play Android Developer API Key": r"AIza[0-9A-Za-z-_]{35}",
"Google Play Android Developer OAuth": r"[0-9]+-[0-9A-Za-z_]{32}\\.apps\\.googleusercontent\\.com",
"Google Play Services API Key": r"AIza[0-9A-Za-z-_]{35}",
"Google Play Services OAuth": r"[0-9]+-[0-9A-Za-z_]{32}\\.apps\\.googleusercontent\\.com",
"Google Street View Image API Key": r"AIza[0-9A-Za-z-_]{35}",
"Google Street View Image OAuth": r"[0-9]+-[0-9A-Za-z_]{32}\\.apps\\.googleusercontent\\.com",
"Slack API Key": r"(?i)slack.*['|\"][0-9a-zA-Z-]+['|\"]",
"Stripe Standard API Key": r"sk_live_[0-9a-zA-Z]{24}",
"Stripe Restricted API Key": r"rk_live_[0-9a-zA-Z]{24}",
"Stripe Publishing API Key": r"pk_live_[0-9a-zA-Z]{24}",
"Telegram Bot API Key": r"[0-9]+:[a-zA-Z0-9_-]+",
"Twilio API Key": r"(?i)twilio.*['|\"][0-9a-f]{32}['|\"]",
"Google Cloud Platform OAuth Token": r"[0-9]+-[0-9A-Za-z_]{32}\.apps\.googleusercontent\.com",
"Twitter Access Token": r"(?i)twitter.*['|\"][0-9a-z]{35,44}['|\"]",
"Twitter OAuth": r"(?i)twitter.*['|\"][0-9a-z]{35,44}['|\"]",
"Twitter API Key": r"(?i)twitter.*['|\"][0-9a-z]{35,44}['|\"]",
"Windows Live API Key": r"(?i)windowslive.*['|\"][0-9a-f]{22}['|\"]",
"Microsoft API Key": r"(?i)microsoft.*['|\"][0-9a-f]{22}['|\"]",
"Microsoft Azure Data Explorer (Kusto) API Key": r"fed=.*",
"YouTube API Key": r"AIza[0-9A-Za-z-_]{35}",
"YouTube OAuth": r"(?i)youtube.*['|\"][0-9a-z]{25}['|\"]",
"Reddit Client ID": r"(?i)reddit(.{0,20})?['\"][0-9a-zA-Z-_]{14}['\"]",
"Instagram Access Token": r"(?i)instagram(.{0,20})?['\"][0-9a-zA-Z-_]{7}['\"]",
"Foursquare API Key": r"(?i)foursquare.*['|\"][0-9a-zA-Z]{48}['|\"]",
"OpenID Connect Generic Provider API Key": r"['|\"]?authorization_endpoint['|\"](.{1,50})?['|\"](.*?)[a-z0-9_-]+['|\"]",
"Generic OAuth 2.0": r"(?i)(oauth|open\W*source).*['|\"]?([a-z0-9_-]+)['|\"]",
"Generic OAuth 2.0 Token": r"(?i)(oauth|open\W*source).*['|\"]?([a-z0-9_-]+)['|\"]",
"Bearer Token": r"['|\"]?token['|\"]?\s*[:=]\s*['|\"]?([a-zA-Z0-9-_]+)['|\"]?",
"Basic Auth Credentials": r"(?i)basic.*['|\"]?[a-zA-Z0-9-_]+['|\"]?:['|\"]?[a-zA-Z0-9-_]+['|\"]?",
"Generic API Token": r"['|\"]?api[_]?key['|\"]?\s*[:=]\s*['|\"]?([a-zA-Z0-9-_]+)['|\"]?",
"Generic API Secret": r"['|\"]?api[_]?secret['|\"]?\s*[:=]\s*['|\"]?([a-zA-Z0-9-_]+)['|\"]?",
"Docker Registry Token": r"(?i)docker[^\s]*?['|\"]\w{32,64}['|\"]",
"GitHub Personal Access Token": r"[a-f0-9]{40}",
"GitLab Personal Access Token": r"(?i)gitlab.*['|\"]\w{20,40}['|\"]",
"Amazon SES SMTP Password": r"[a-zA-Z0-9_-]{16,}",
"JIRA API Token": r"(?i)jira.*['|\"]\w{16}['|\"]",
"Azure Key Vault Secret Identifier": r"https:\/\/[a-z0-9-]+\.vault\.azure\.net\/secrets\/[a-zA-Z0-9-]+\/[a-zA-Z0-9-]+",
"Salesforce Access Token": r"[a-zA-Z0-9\.\-]{100,}",
"Trello API Key": r"(?i)trello.*['|\"]\w{32}['|\"]",
"Atlassian API Key": r"(?i)atlassian.*['|\"]\w{32}['|\"]",
"OAuth 2.0 Bearer Token": r"(?i)bearer[^\s]*?['|\"]\w{32,64}['|\"]",
"Zoom API Key": r"(?i)zoom.*['|\"]\w{22}['|\"]",
"Box API Key": r"(?i)box.*['|\"]\w{30}['|\"]",
"Shopify API Key": r"(?i)shopify.*['|\"]\w{32}['|\"]",
"Zendesk API Token": r"(?i)zendesk.*['|\"]\w{40}['|\"]",
"Square Access Token": r"(?i)square.*['|\"]\w{64}['|\"]",
"GitLab OAuth Token": r"(?i)gitlab.*['|\"]\w{20,40}['|\"]",
"Bitbucket OAuth Token": r"(?i)bitbucket.*['|\"]\w{20,40}['|\"]",
"Discord Bot Token": r"[\w-]{24}\.[\w-]{6}\.[\w-]{27}",
"Discord OAuth Token": r"(?i)discord.*['|\"]\w{59}['|\"]",
"NPM Token": r"(?i)npm[_]?token.*['|\"]\w{64}['|\"]",
"Confluence API Token": r"(?i)confluence.*['|\"]\w{10}['|\"]",
"CircleCI API Token": r"(?i)circleci.*['|\"]\w{40}['|\"]",
"Hootsuite API Token": r"(?i)hootsuite.*['|\"]\w{12}['|\"]",
"Oracle Cloud API Key": r"[a-zA-Z0-9]{64}",
"Sentry API Key": r"(?i)sentry.*['|\"]\w{32}['|\"]",
"Box API Secret": r"(?i)box.*['|\"]\w{40}['|\"]",
"DigitalOcean API Token": r"([a-f0-9]{64})",
"Mailjet API Token": r"(\w{32}-\w{13})",
"Twitch Client ID": r"(?i)twitch(.{0,20})?['\"][0-9a-z]{30}['\"]",
"Twitch OAuth Token": r"oauth:[a-z0-9]+",
"Zoom OAuth Token": r"(?i)zoom.*['|\"]\w{60}['|\"]",
"Shopify OAuth Token": r"(?i)shopify.*['|\"]\w{20}['|\"]",
"Zendesk OAuth Token": r"(?i)zendesk.*['|\"]\w{20}['|\"]",
"Salesforce OAuth Token": r"(?i)salesforce.*['|\"]\w{300}['|\"]",
"Atlassian OAuth Token": r"(?i)atlassian.*['|\"]\w{300}['|\"]",
"Stripe Connect OAuth Token": r"(?i)stripe.*['|\"]sk_acct_[0-9a-zA-Z]{24}['|\"]",
"LinkedIn OAuth Token": r"(?i)linkedin.*['|\"]\w{12}['|\"]",
"Yammer OAuth Token": r"(?i)yammer.*['|\"]\w{48}['|\"]",
"Medium Integration Token": r"(?i)medium.*['|\"]\w{100}['|\"]",
"Coinbase OAuth Token": r"(?i)coinbase.*['|\"]\w{45}['|\"]",
"Slack Bot Token": r"([a-zA-Z0-9-]+)",
"Microsoft Office 365 API Token": r"(?i)microsoft.*['|\"]\w{360}['|\"]",
"Pinterest OAuth Token": r"(?i)pinterest.*['|\"]\w{32}['|\"]",
"Salesforce API Token": r"(?i)salesforce.*['|\"]\w{300}['|\"]",
"LinkedIn API Token": r"(?i)linkedin.*['|\"]\w{12}['|\"]",
"Stripe Connect API Token": r"(?i)stripe.*['|\"]rk_acct_[0-9a-zA-Z]{24}['|\"]",
"Twitch API Token": r"(?i)twitch.*['|\"]\w{30}['|\"]",
"Yammer API Token": r"(?i)yammer.*['|\"]\w{48}['|\"]",
"Coinbase API Token": r"(?i)coinbase.*['|\"]\w{45}['|\"]",
"Facebook App Token": r"(?i)facebook.*['|\"]\w{140}['|\"]",
"Facebook App Secret": r"(?i)facebook.*['|\"]\w{32}['|\"]",
"Google Tag Manager Container ID": r"GTM-[A-Z0-9]{6}",
"Yelp Fusion API Key": r"(?i)yelp.*['|\"]\w{32}['|\"]",
"Apple Sign-In Key": r"(?i)apple.*['|\"]\w{10}['|\"]",
"GitKraken OAuth Token": r"(?i)gitkraken.*['|\"]\w{64}['|\"]",
"Dropbox API Token": r"(?i)dropbox.*['|\"]\w{64}['|\"]",
"Auth0 API Token": r"(?i)auth0.*['|\"]\w{16}['|\"]",
"Wix API Key": r"(?i)wix.*['|\"]\w{32}['|\"]",
"Zoom JWT API Key": r"([a-zA-Z0-9-_.]+)\.[a-zAZ0-9-_.]+\.([a-zA-Z0-9-_.]+)",
"Okta API Token": r"(?i)okta.*['|\"]\w{50}['|\"]",
"Keybase PGP Key": r"(?i)keybase.*['|\"]\w{64}['|\"]",
"HashiCorp Vault Token": r"(?i)vault.*['|\"]\w{64}['|\"]",
"Twilio Auth Token": r"(?i)twilio.*['|\"]\w{32}['|\"]",
"PagerDuty API Key": r"(?i)pagerduty.*['|\"]\w{20}['|\"]",
"SendGrid API Key": r"(?i)sendgrid.*['|\"]\w{68}['|\"]",
"Google Analytics Tracking ID": r"UA-\d{4,10}-\d{1,4}",
"Mixpanel API Key": r"(?i)mixpanel.*['|\"]\w{32}['|\"]",
"Segment API Key": r"(?i)segment.*['|\"]\w{50}['|\"]",
"AWS IAM Access Key": r"A[A-Z0-9]{18}",
"AWS IAM Secret Key": r"(?i)aws.*['|\"]\w{40}['|\"]",
"AWS Cognito ID Token": r"(?i)cognito.*['|\"]\w{115}['|\"]",
"AWS Cognito Refresh Token": r"(?i)cognito.*['|\"]\w{110}['|\"]",
"Apache Kafka API Key": r"(?i)kafka.*['|\"]\w{32}['|\"]",
"Splunk API Token": r"(?i)splunk.*['|\"]\w{64}['|\"]",
"Adobe Marketing Cloud API Key": r"(?i)adobe.*['|\"]\w{24}['|\"]",
"OneLogin API Token": r"(?i)onelogin.*['|\"]\w{40}['|\"]",
"Auth0 Client Secret": r"(?i)auth0.*['|\"]\w{40}['|\"]",
"DigitalOcean OAuth Token": r"(?i)do.*['|\"]\w{32}['|\"]",
"PubNub API Key": r"(?i)pubnub.*['|\"]\w{40}['|\"]",
"Fortnite Client ID": r"(?i)fortnite.*['|\"]\w{32}['|\"]",
"Fortnite Client Secret": r"(?i)fortnite.*['|\"]\w{64}['|\"]",
"Duo API Key": r"(?i)duo.*['|\"]\w{40}['|\"]",
"Mapbox API Token": r"(?i)mapbox.*['|\"]\w{32}['|\"]",
"Nordic APIs API Key": r"(?i)nordicapis.*['|\"]\w{24}['|\"]",
"Stoplight API Key": r"(?i)stoplight.*['|\"]\w{36}['|\"]",
"42Crunch API Key": r"(?i)42crunch.*['|\"]\w{64}['|\"]",
"Prometheus API Key": r"(?i)prometheus.*['|\"]\w{16}['|\"]",
"IBM Cloud API Key": r"(?i)ibm.*['|\"]\w{44}['|\"]",
"Imgur Client ID": r"(?i)imgur.*['|\"]\w{12}['|\"]",
"Clarifai API Key": r"(?i)clarifai.*['|\"]\w{24}['|\"]",
"Twillio API Key": r"(?i)twillio.*['|\"]\w{32}['|\"]",
"Quandl API Key": r"(?i)quandl.*['|\"]\w{20}['|\"]",
"World Weather Online API Key": r"(?i)worldweatheronline.*['|\"]\w{20}['|\"]",
"Airtable API Key": r"(?i)airtable.*['|\"]\w{40}['|\"]",
"Bitly Generic Access Token": r"(?i)bitly.*['|\"]\w{40}['|\"]",
"Dropbox App Key": r"(?i)dropbox.*['|\"]\w{40}['|\"]",
"Elasticsearch Authentication": r"(?i)elasticsearch.*['|\"]\w{64}['|\"]",
"Amazon Web Services Access Key": r"(?i)aws.*['|\"]\w{20}['|\"]",
"JIRA API Key": r"(?i)jira.*['|\"]\w{16}['|\"]",
"SendinBlue API Key": r"(?i)sendinblue.*['|\"]\w{64}['|\"]",
"Zoho API Key": r"(?i)zoho.*['|\"]\w{32}['|\"]",
"SoundCloud API Key": r"(?i)soundcloud.*['|\"]\w{32}['|\"]",
"Yandex Disk OAuth Token": r"(?i)yandex.*['|\"]\w{52}['|\"]",
"Asana Access Token": r"(?i)asana.*['|\"]\w{64}['|\"]",
"Adobe Creative Cloud API Key": r"(?i)adobe.*['|\"]\w{22}['|\"]",
"Heroku API Key": r"(?i)heroku.*['|\"]\w{32}['|\"]",
"Digital Ocean Spaces Access Key": r"(?i)digitalocean.*['|\"]\w{20}['|\"]",
"Buildkite API Token": r"(?i)buildkite.*['|\"]\w{40}['|\"]",
"Elastic Email API Key": r"(?i)elasticemail.*['|\"]\w{36}['|\"]",
"OpenWeatherMap API Key": r"(?i)openweathermap.*['|\"]\w{32}['|\"]",
"Pusher App Key": r"(?i)pusher.*['|\"]\w{64}['|\"]",
"Twilio API Key": r"(?i)twilio.*['|\"]\w{32}['|\"]",
"Mandrill API Key": r"(?i)mandrill.*['|\"]\w{42}['|\"]",
"Intercom API Key": r"(?i)intercom.*['|\"]\w{64}['|\"]",
"Shopify Storefront Access Token": r"(?i)shopify.*['|\"]\w{35}['|\"]",
"Vimeo OAuth Token": r"(?i)vimeo.*['|\"]\w{40}['|\"]",
"Mailgun API Key": r"(?i)mailgun.*['|\"]\w{32}['|\"]",
"Zendesk OAuth Token": r"(?i)zendesk.*['|\"]\w{40}['|\"]",
"PubNub API Key": r"(?i)pubnub.*['|\"]\w{32}['|\"]",
"Twitter API Key": r"(?i)twitter.*['|\"]\w{35,44}['|\"]",
"Nexmo API Key": r"(?i)nexmo.*['|\"]\w{32}['|\"]",
"Lob API Key": r"(?i)lob.*['|\"]\w{40}['|\"]",
"Spotify Client ID": r"(?i)spotify.*['|\"]\w{32}['|\"]",
"Stripe API Key": r"(?i)stripe.*['|\"]\w{24}['|\"]",
"Google Maps API Key": r"(?i)google.*['|\"]\w{39}['|\"]",
"Bit.ly Generic Access Token": r"(?i)bitly.*['|\"]\w{34}['|\"]",
"Braintree API Key": r"(?i)braintree.*['|\"]\w{32}['|\"]",
"Coinbase API Key": r"(?i)coinbase.*['|\"]\w{32}['|\"]",
"Splunk API Key": r"(?i)splunk.*['|\"]\w{64}['|\"]",
"AWS IAM Access Key": r"(?i)aws.*['|\"]\w{20}['|\"]",
"AWS IAM Secret Key": r"(?i)aws.*['|\"]\w{40}['|\"]",
"Twilio API Key": r"(?i)twilio.*['|\"]\w{32}['|\"]",
"Firebase Cloud Messaging (FCM) Key": r"AAAA[a-zA-Z0-9_-]{140,340}",
"OAuth 2.0 Access Token": r"(?i)access[^\s]*?['|\"]\w{16,64}['|\"]",
"Basic Authentication": r"Basic\s[A-Za-z0-9_\-]+=*",
"Bearer Token": r"['|\"]?token['|\"]?\s*[:=]\s*['|\"]?([a-zA-Z0-9-_]+)['|\"]?",
"API Token": r"['|\"]?api[_]?key['|\"]?\s*[:=]\s*['|\"]?([a-zA-Z0-9-_]+)['|\"]?",
"Access Token": r"['|\"]?access[_]?token['|\"]?\s*[:=]\s*['|\"]?([a-zA-Z0-9-_]+)['|\"]?",
"Client ID": r"['|\"]?client[_]?id['|\"]?\s*[:=]\s*['|\"]?([a-zA-Z0-9-_]+)['|\"]?",
"Client Secret": r"['|\"]?client[_]?secret['|\"]?\s*[:=]\s*['|\"]?([a-zA-Z0-9-_]+)['|\"]?",
"API Secret": r"['|\"]?api[_]?secret['|\"]?\s*[:=]\s*['|\"]?([a-zA-Z0-9-_]+)['|\"]?",
"Session Token": r"['|\"]?session[_]?token['|\"]?\s*[:=]\s*['|\"]?([a-zA-Z0-9-_]+)['|\"]?",
"Refresh Token": r"['|\"]?refresh[_]?token['|\"]?\s*[:=]\s*['|\"]?([a-zA-Z0-9-_]+)['|\"]?",
}




class SecretScanner:
def __init__(self):
self.console = Console()
Expand Down

0 comments on commit 9a72f88

Please sign in to comment.