Skip to content

Instantly share code, notes, and snippets.

@flerpadoo
Last active July 23, 2020 22:36
Show Gist options
  • Save flerpadoo/fe5e1ea893855684cf57ae07050e2d84 to your computer and use it in GitHub Desktop.
Save flerpadoo/fe5e1ea893855684cf57ae07050e2d84 to your computer and use it in GitHub Desktop.
Determines if there is an AWS account associated with a given email address
import re
import sys
import subprocess
from time import sleep # Can be optimized / replaced
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
def bruteAmazonEmailLogin(userEmail):
options = Options()
options.add_argument("--headless")
options.add_argument("--no-sandbox")
driver = webdriver.Chrome(chrome_options=options)
driver.get("https://portal.aws.amazon.com/billing/signup#/start")
sleep(1) # Can be optimized / replaced
form = driver.find_element_by_class_name('cc-form-big-box')
link = form.find_element_by_link_text('Sign in to an existing AWS account')
link.click()
sleep(1) # Can be optimized / replaced
form = driver.find_element_by_class_name('signin-container')
form.find_element_by_id("resolving_input").send_keys(userEmail)
form.find_element_by_id("next_button").click()
sleep(1) # Can be optimized / replaced
try:
driver.find_element_by_id("signin_button").click()
sleep(1) # Can be optimized / replaced
return True
except:
return False
def main(email):
truvar = bruteAmazonEmailLogin(email)
if truvar:
print sys.argv[1] + ": valid"
if not truvar:
print sys.argv[1] + ": invalid"
if len(sys.argv) < 2:
sys.exit("You must provide at least one email address.\nEx: user.name@domain.com")
else:
email = sys.argv[1]
if re.match(r"[^@]+@[^@]+\.[^@]+", email):
main(email)
else:
sys.exit("You must provide a valid email address!")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment