def capitalone(user=None, quit_when_finished=True, browser=None): if not user: # Get the username from the command line arguments. user = args.get(0) # Must supply username. if user is None: puts(colored.red('You must supply a username like "python capitalone.py nick"')) sys.exit() # Get the user's password from the password backend. key = keyring.get_password('capitalone.com', user) # If the key doesn't exist in the password backend. if key is None: puts(colored.red("You must store the password for {} in your keyring's backend.".format(user))) puts('See: http://pypi.python.org/pypi/keyring/#configure-your-keyring-lib') sys.exit() # Log what we're currently working on. puts(colored.blue('\nCapital One ({})'.format(user))) if not browser: # Init the WebDriver. b = webdriver.Firefox() else: b = browser b.get('https://www.capitalone.com/') # Only credit card accounts are supported at this time. account_type = b.find_element_by_css_selector('option[value="credit cards"]') account_type.click() # Find the username field on the page. username = b.find_element_by_css_selector('input#eos-userid') username.send_keys(user) # Find the password field on the page. password = b.find_element_by_css_selector('input#eos-password') password.send_keys(key) password.submit() # Wait for an account list. try: WebDriverWait(b, timeout=10).until(_element_available(b, 'table.dataTable')) except TimeoutException: puts(colored.red("Couldn't find any accounts for that username.")) b.quit() sys.exit() amount = b.find_element_by_css_selector('table.dataTable tr.itemSummary td:nth-child(4) p') print 'Capital One ({}): {}'.format(user, amount.text) if quit_when_finished: b.quit() return b
def att(user=None, quit_when_finished=True, browser=None): if not user: # Get the username from the command line arguments. user = args.get(0) # Must supply username. if user is None: puts(colored.red('You must supply a username like "python att.py nick"')) sys.exit() # Get the user's password from the password backend. key = keyring.get_password('att.com', user) # If the key doesn't exist in the password backend. if key is None: puts(colored.red("You must store the password for {} in your keyring's backend.".format(user))) puts('See: http://pypi.python.org/pypi/keyring/#configure-your-keyring-lib') sys.exit() # Log what we're currently working on. puts(colored.blue('\nAT&T ({})'.format(user))) if not browser: # Init the WebDriver. b = webdriver.Firefox() else: b = browser b.get('https://www.att.com/') # Find the username field on the page. username = b.find_element_by_css_selector('input#userid') username.send_keys(user) # Find the password field on the page. password = b.find_element_by_css_selector('input#password') password.send_keys(key) password.submit() # Wait for an account page. try: WebDriverWait(b, timeout=15).until(_element_available(b, 'div.mybilldiv span.colorOrange.font30imp')) except TimeoutException: puts(colored.red("Looks like the system is down.")) if quit_when_finished: b.quit() else: return b amount = b.find_element_by_css_selector('div.mybilldiv span.colorOrange.font30imp') print 'AT&T ({}): {}'.format(user, amount.text) if quit_when_finished: b.quit() return b
def wellsfargo(user=None, quit_when_finished=True, browser=None): if not user: # Get the username from the command line arguments. user = args.get(0) # Must supply username. if user is None: puts(colored.red('You must supply a username like "python wellsfargo.py nick"')) sys.exit() # Get the user's password from the password backend. key = keyring.get_password('wellsfargo.com', user) # If the key doesn't exist in the password backend. if key is None: puts(colored.red("You must store the password for {} in your keyring's backend.".format(user))) puts('See: http://pypi.python.org/pypi/keyring/#configure-your-keyring-lib') sys.exit() # Log what we're currently working on. puts(colored.blue('\nWells Fargo ({})'.format(user))) if not browser: # Init the WebDriver. b = webdriver.Firefox() else: b = browser b.get('https://www.wellsfargo.com/') # Find the username field on the page. username = b.find_element_by_css_selector('input#userid') username.send_keys(user) # Find the password field on the page. password = b.find_element_by_css_selector('input#password') password.send_keys(key) password.submit() # Wait for an account list. try: WebDriverWait(b, timeout=10).until(_element_available(b, 'a.account')) except TimeoutException: puts(colored.red("Couldn't find any accounts for that username.")) b.quit() sys.exit() # Click the first account. b.find_element_by_css_selector('a.account').click() amount = b.find_element_by_css_selector('table#balanceDetails td.topRow a') print 'Wells Fargo ({}): {}'.format(user, amount.text) if quit_when_finished: b.quit() return b
def capitalone(user=None, quit_when_finished=True, browser=None): if not user: # Get the username from the command line arguments. user = args.get(0) # Must supply username. if user is None: puts( colored.red( 'You must supply a username like "python capitalone.py nick"')) sys.exit() # Get the user's password from the password backend. key = keyring.get_password('capitalone.com', user) # If the key doesn't exist in the password backend. if key is None: puts( colored.red( "You must store the password for {} in your keyring's backend." .format(user))) puts( 'See: http://pypi.python.org/pypi/keyring/#configure-your-keyring-lib' ) sys.exit() # Log what we're currently working on. puts(colored.blue('\nCapital One ({})'.format(user))) if not browser: # Init the WebDriver. b = webdriver.Firefox() else: b = browser b.get('https://www.capitalone.com/') # Only credit card accounts are supported at this time. account_type = b.find_element_by_css_selector( 'option[value="credit cards"]') account_type.click() # Find the username field on the page. username = b.find_element_by_css_selector('input#eos-userid') username.send_keys(user) # Find the password field on the page. password = b.find_element_by_css_selector('input#eos-password') password.send_keys(key) password.submit() # Wait for an account list. try: WebDriverWait(b, timeout=10).until( _element_available(b, 'table.dataTable')) except TimeoutException: puts(colored.red("Couldn't find any accounts for that username.")) b.quit() sys.exit() amount = b.find_element_by_css_selector( 'table.dataTable tr.itemSummary td:nth-child(4) p') print 'Capital One ({}): {}'.format(user, amount.text) if quit_when_finished: b.quit() return b
def wellsfargo(user=None, quit_when_finished=True, browser=None): if not user: # Get the username from the command line arguments. user = args.get(0) # Must supply username. if user is None: puts( colored.red( 'You must supply a username like "python wellsfargo.py nick"')) sys.exit() # Get the user's password from the password backend. key = keyring.get_password('wellsfargo.com', user) # If the key doesn't exist in the password backend. if key is None: puts( colored.red( "You must store the password for {} in your keyring's backend." .format(user))) puts( 'See: http://pypi.python.org/pypi/keyring/#configure-your-keyring-lib' ) sys.exit() # Log what we're currently working on. puts(colored.blue('\nWells Fargo ({})'.format(user))) if not browser: # Init the WebDriver. b = webdriver.Firefox() else: b = browser b.get('https://www.wellsfargo.com/') # Find the username field on the page. username = b.find_element_by_css_selector('input#userid') username.send_keys(user) # Find the password field on the page. password = b.find_element_by_css_selector('input#password') password.send_keys(key) password.submit() # Wait for an account list. try: WebDriverWait(b, timeout=10).until(_element_available(b, 'a.account')) except TimeoutException: puts(colored.red("Couldn't find any accounts for that username.")) b.quit() sys.exit() # Click the first account. b.find_element_by_css_selector('a.account').click() amount = b.find_element_by_css_selector('table#balanceDetails td.topRow a') print 'Wells Fargo ({}): {}'.format(user, amount.text) if quit_when_finished: b.quit() return b
def bankofamerica(user=None, quit_when_finished=True, browser=None, index=None): if not user: # Get the username from the command line arguments. user = args.get(0) # Must supply username. if user is None: puts(colored.red('You must supply a username like "python bankofamerica.py nick"')) sys.exit() # Get the user's password from the password backend. key = keyring.get_password('bankofamerica.com', user) # If the key doesn't exist in the password backend. if key is None: puts(colored.red("You must store the password for {} in your keyring's backend.".format(user))) puts('See: http://pypi.python.org/pypi/keyring/#configure-your-keyring-lib') sys.exit() # Log what we're currently working on. puts(colored.blue('\nBank of America ({})'.format(user))) if not browser: # Init the WebDriver. b = webdriver.Firefox() else: b = browser b.get('https://www.bankofamerica.com/') # Find the username field on the page. username = b.find_element_by_css_selector('input#id') username.send_keys(user) # Get the state out of the user's config. state_config = config._sections['bankofamerica']['state'] # Select the correct state. state = b.find_element_by_css_selector('option[value="{}"]'.format(state_config)) state.click() username.submit() # If we have a password field, continue. Otherwise, wait to see if we are # being asked a security question. try: WebDriverWait(b, timeout=10).until(_element_available(b, 'input#tlpvt-passcode-input')) except TimeoutException: WebDriverWait(b, timeout=10).until(_element_available(b, 'input#tlpvt-challenge-answer')) # If we have a password field now, fill it with the key and submit the form. try: password = b.find_element_by_css_selector('input#tlpvt-passcode-input') password.send_keys(key) password.submit() except NoSuchElementException: # We need to hit the keychain for the security question. answer = b.find_element_by_css_selector('input#tlpvt-challenge-answer') question = b.find_element_by_css_selector('label[for="tlpvt-challenge-answer"]').text.strip() # The keychain name should be "username What is your mother's middle name", for example. keyAnswer = keyring.get_password('bankofamerica.com', '{} {}'.format(user, question)) # Make sure we have an answer for the question. if keyAnswer is None: puts(colored.red("We couldn't find an answer for the question '{}' in your keyring's backend".format(question))) b.quit() sys.exit() # Fill the answer and submit. answer.send_keys(keyAnswer) answer.submit() # If we've answered correctly, now we have to wait for the password field. WebDriverWait(b, timeout=10).until(_element_available(b, 'input#tlpvt-passcode-input')) # Fill the password and submit. password = b.find_element_by_css_selector('input#tlpvt-passcode-input') password.send_keys(key) password.submit() # Wait until we have a link with the account text, and click it. accounts = config._sections['bankofamerica']['account'].split(',') account = accounts[index] WebDriverWait(b, timeout=10).until(_element_available(b, 'a[id="{}"]'.format(account))) account_link = b.find_element_by_css_selector('a[id="{}"]'.format(account)) account_link.click() print 'Bank of America ({}): {}'.format(user, amount.text) if quit_when_finished: b.quit() return b
def att(user=None, quit_when_finished=True, browser=None): if not user: # Get the username from the command line arguments. user = args.get(0) # Must supply username. if user is None: puts( colored.red( 'You must supply a username like "python att.py nick"')) sys.exit() # Get the user's password from the password backend. key = keyring.get_password('att.com', user) # If the key doesn't exist in the password backend. if key is None: puts( colored.red( "You must store the password for {} in your keyring's backend." .format(user))) puts( 'See: http://pypi.python.org/pypi/keyring/#configure-your-keyring-lib' ) sys.exit() # Log what we're currently working on. puts(colored.blue('\nAT&T ({})'.format(user))) if not browser: # Init the WebDriver. b = webdriver.Firefox() else: b = browser b.get('https://www.att.com/') # Find the username field on the page. username = b.find_element_by_css_selector('input#userid') username.send_keys(user) # Find the password field on the page. password = b.find_element_by_css_selector('input#password') password.send_keys(key) password.submit() # Wait for an account page. try: WebDriverWait(b, timeout=15).until( _element_available(b, 'div.mybilldiv span.colorOrange.font30imp')) except TimeoutException: puts(colored.red("Looks like the system is down.")) if quit_when_finished: b.quit() else: return b amount = b.find_element_by_css_selector( 'div.mybilldiv span.colorOrange.font30imp') print 'AT&T ({}): {}'.format(user, amount.text) if quit_when_finished: b.quit() return b
def aessuccess(user=None, quit_when_finished=True, browser=None): if not user: # Get the username from the command line arguments. user = args.get(0) # Must supply username. if user is None: puts(colored.red('You must supply a username like "python aessuccess.py nick"')) sys.exit() # Get the user's password from the password backend. key = keyring.get_password('aessuccess.org', user) # If the key doesn't exist in the password backend. if key is None: puts(colored.red("You must store the password for {} in your keyring's backend.".format(user))) puts('See: http://pypi.python.org/pypi/keyring/#configure-your-keyring-lib') sys.exit() # Log what we're currently working on. puts(colored.blue('\nAES ({})'.format(user))) if not browser: # Init the WebDriver. b = webdriver.Firefox() else: b = browser b.get('http://aessuccess.org/') # Find the username field on the page. username = b.find_element_by_css_selector('input#username') username.send_keys(user) username.submit() # If we have a password field, continue. Otherwise, wait to see if we are # being asked a security question. try: WebDriverWait(b, timeout=10).until(_element_available(b, 'input#password')) except TimeoutException: WebDriverWait(b, timeout=10).until(_element_available(b, 'input#answer')) # If we have a password field now, fill it with the key and submit the form. try: password = b.find_element_by_css_selector('input#password') password.send_keys(key) password.submit() except NoSuchElementException: # We need to hit the keychain for the security question. answer = b.find_element_by_css_selector('input#answer') question = b.find_element_by_css_selector('div.questionRow label.bold').text # The keychain name should be "username *What is your mother's middle name", for example. keyAnswer = keyring.get_password('aessuccess.org', '{} {}'.format(user, question)) # Make sure we have an answer for the question. if keyAnswer is None: puts(colored.red("We couldn't find an answer for the question '{}' in your keyring's backend".format(question))) b.quit() sys.exit() # Fill the answer and submit. answer.send_keys(keyAnswer) answer.submit() # If we've answered correctly, now we have to wait for the password field. WebDriverWait(b, timeout=10).until(_element_available(b, 'input#password')) # Fill the password and submit. password = b.find_element_by_css_selector('input#password') password.send_keys(key) password.submit() # Finally, once we have the amount on the page, harvest it and print the result. try: WebDriverWait(b, timeout=10).until(_element_available(b, 'table.paymentSummaryTable tbody tr.trCurrentPayment span.amount')) except TimeoutException: puts(colored.red("Looks like the system is down.".format(question))) if quit_when_finished: b.quit() else: return b amount = b.find_element_by_css_selector('table.paymentSummaryTable tbody tr.trCurrentPayment span.amount') print 'AES ({}): {}'.format(user, amount.text) if quit_when_finished: b.quit() return b
def aessuccess(user=None, quit_when_finished=True, browser=None): if not user: # Get the username from the command line arguments. user = args.get(0) # Must supply username. if user is None: puts( colored.red( 'You must supply a username like "python aessuccess.py nick"')) sys.exit() # Get the user's password from the password backend. key = keyring.get_password('aessuccess.org', user) # If the key doesn't exist in the password backend. if key is None: puts( colored.red( "You must store the password for {} in your keyring's backend." .format(user))) puts( 'See: http://pypi.python.org/pypi/keyring/#configure-your-keyring-lib' ) sys.exit() # Log what we're currently working on. puts(colored.blue('\nAES ({})'.format(user))) if not browser: # Init the WebDriver. b = webdriver.Firefox() else: b = browser b.get('http://aessuccess.org/') # Find the username field on the page. username = b.find_element_by_css_selector('input#username') username.send_keys(user) username.submit() # If we have a password field, continue. Otherwise, wait to see if we are # being asked a security question. try: WebDriverWait(b, timeout=10).until( _element_available(b, 'input#password')) except TimeoutException: WebDriverWait(b, timeout=10).until(_element_available(b, 'input#answer')) # If we have a password field now, fill it with the key and submit the form. try: password = b.find_element_by_css_selector('input#password') password.send_keys(key) password.submit() except NoSuchElementException: # We need to hit the keychain for the security question. answer = b.find_element_by_css_selector('input#answer') question = b.find_element_by_css_selector( 'div.questionRow label.bold').text # The keychain name should be "username *What is your mother's middle name", for example. keyAnswer = keyring.get_password('aessuccess.org', '{} {}'.format(user, question)) # Make sure we have an answer for the question. if keyAnswer is None: puts( colored.red( "We couldn't find an answer for the question '{}' in your keyring's backend" .format(question))) b.quit() sys.exit() # Fill the answer and submit. answer.send_keys(keyAnswer) answer.submit() # If we've answered correctly, now we have to wait for the password field. WebDriverWait(b, timeout=10).until( _element_available(b, 'input#password')) # Fill the password and submit. password = b.find_element_by_css_selector('input#password') password.send_keys(key) password.submit() # Finally, once we have the amount on the page, harvest it and print the result. try: WebDriverWait(b, timeout=10).until( _element_available( b, 'table.paymentSummaryTable tbody tr.trCurrentPayment span.amount' )) except TimeoutException: puts(colored.red("Looks like the system is down.".format(question))) if quit_when_finished: b.quit() else: return b amount = b.find_element_by_css_selector( 'table.paymentSummaryTable tbody tr.trCurrentPayment span.amount') print 'AES ({}): {}'.format(user, amount.text) if quit_when_finished: b.quit() return b