Exemplo n.º 1
0
def main():
    username = pyip.inputStr('Amazon Username: '******'Amazon Password: '******'*')
    passwordCheck = pyip.inputPassword('Re-enter Amazon Password: '******'*')

    if password != passwordCheck:
        print('Passwords did not match. Please try again.')
        exit(0)

    browser = webdriver.Firefox()
    browser.get(
        'https://www.amazon.com/gp/offer-listing/B08HH5WF97/ref=dp_olp_unknown_mbc'
    )

    while True:
        try:
            priceElem = browser.find_element_by_css_selector(
                'span.a-size-large')
            buttonElem = browser.find_element_by_css_selector(
                '.a-button-input')
        except:
            logging.info('No current offers available')

        if convertToNum(priceElem.text) < 800 and isNewCondition(browser):
            buttonElem.click()
            logging.info('Adding to cart')
            if not testing:
                signInandPlaceOrder(browser, username, password)
            browser.quit()
            break

        time.sleep(15)
        logging.info('Refreshing')
        browser.refresh()
Exemplo n.º 2
0
def confirm_password() -> str:
    """
    User enters password and confirms that p1 == p2
    """
    while True:
        p1 = pyip.inputPassword("Enter your password:\n")
        p2 = pyip.inputPassword("Confirm password:\n")
        if p1 == p2:
            return p1
        print("Password does not match please try again")
Exemplo n.º 3
0
 def __init__(self):
     #initializing global variables
     clear.clear()
     global acc
     local = Config()
     inputPassword = pyip.inputPassword("Hi, " + local.get_name() +
                                        ". Please enter your password\n")
     while inputPassword != str(local.get_password()):
         inputPassword = pyip.inputPassword(
             "Password incorrect, please retry or press q to quit: \n")
         if inputPassword == 'q':
             sys.exit()
     acc = Account()
     self.main_menu()
Exemplo n.º 4
0
def main():

    mailAddress = pyinputplus.inputEmail("Enter email address: \n")
    pw = pyinputplus.inputPassword("Enter password for sending the mail: \n",
                                   timeout=10)
    mailMessage = pyinputplus.inputStr("Enter message to send: \n")
    send_mail(mailAddress, pw, mailMessage)
Exemplo n.º 5
0
    def login(self):
        try:
            username_input = self.driver.find_element_by_id('username')
            password_input = self.driver.find_element_by_id('password')
            login_input = self.driver.find_element_by_xpath(
                '/html/body/div/main/div[2]/div[1]/form/div[3]/button')
        except Exception as exc:
            print('%s' % (exc))

        username = pyinp.inputStr(prompt='Username: '******'Password: '******'error-for-username')
            error2 = self.driver.find_element_by_id('error-for-password')
            if error1.is_displayed():
                print('Error for username')
            elif error2.is_displayed():
                print('Error for password')
            self.driver.find_element_by_id('username').clear()
            self.login()
        except:
            print('Loged!')
Exemplo n.º 6
0
    def test_inputPassword(self):
        # Test typical usage.
        pauseThenType('swordfish\n')
        self.assertEqual(pyip.inputPassword(), 'swordfish')

        # Test that it doesn't strip whitespace by default.
        pauseThenType('  PasswordWithSpaces  \n')
        self.assertEqual(pyip.inputPassword('  PasswordWithSpaces  '), '  PasswordWithSpaces  ')

        # Test the backspace character.
        pauseThenType('swordfish\b\b\b\b\b\b\b\b\bmary\n')
        self.assertEqual(pyip.inputPassword(), 'mary')

        # Test that typing too many backspace characters causes you to start over entering the password.
        pauseThenType('swordfish' + ('\b' * 20) + 'mary\n')
        self.assertEqual(pyip.inputPassword(), 'mary')
def login():
    login_element = browser.find_element_by_id("loginUsername")
    password_element = browser.find_element_by_id("loginPassword")

    login_element.send_keys("*****@*****.**")
    password_element.send_keys(pyin.inputPassword())
    password_element.submit()
Exemplo n.º 8
0
def get_info():
    '''
    Get input from user for path, filename and password. Return values. 
    '''

    print('Please fill out the following prompts, which will be the info used '
          'to encrypt your PDF file.')
    path = pyip.inputStr('File path: ')
    filename = pyip.inputStr('File name: ')
    password = pyip.inputPassword(' Password: '******'\nValidating file path and whether specified filename exists...')
    try:
        os.chdir(path)
    except Exception as e1:
        print('\nERROR! Path is not valid. Exiting program.')
        print('Error: {}'.format(e1))
    try:
        os.stat(filename)
    except Exception as e2:
        print('\nERROR! Specified file is not valid. Exiting program.')
        print('Error: {}'.format(e2))
    else:
        print('Success! Path and filename OK.')

    return (path, filename, password)
def userInputPasswordCheck():
    ppass = pyip.inputPassword("Enter a potential password: "******"Not strong, bling blong")
        return False
    else:
        print("Long, Strong, and down to get the crypto on")
        return True
Exemplo n.º 10
0
def emailer(chores, emails):
    """
    Summary:
        Emails random chores to emails with gmail.

    Args:
        chores (list): list of chores.
        emails (dict): dictionnary containning names, emails and last chore.
    """
    # Assign Chore to 'emails'
    for name in emails.keys():
        randomChore = random.choice(chores)
        emails[name]['chore'] = randomChore
        chores.remove(randomChore)  # this chore is now taken, so remove it

    # Email account details.
    email = input('Enter your email: ')
    password = pyip.inputPassword('Your Password: '******'smtp.gmail.com', 587)
    smtpObj.ehlo()
    smtpObj.starttls()
    smtpObj.login(email, password)
    # See https://support.google.com/accounts/answer/6010255 if (Bad Credentials Error)

    # Send chore email
    for name in emails:
        email = emails[name]['email']
        chore = emails[name]['chore']
        body = f""" Subject: This Week's Chore.
        \nDear {name},
        \nYour assigned chore for this week is: {chore}.
        \nThank you and have a nice week!"""

        print(f'Sending email to {name}...')
        sendmailStatus = smtpObj.sendmail('*****@*****.**', email,
                                          body)

        if sendmailStatus != {}:
            print(
                f'There was a problem sending email to {email}: {sendmailStatus}'
            )

    # Log out
    smtpObj.quit()
    print('Done.')
    def check_balance():
        """This function collect user inputs for checking balnce.
             
        Collects user id and password, save them to dictionary and pass it to
        the backend check_balance() function. if the result from the backend is 
        true it restart the program. but if the result is false it call itself 
        to collect user information again.

        Return: None
        """
        print("\n")
        print(messages.check_balance)
        u_id = pyip.inputInt("Your Id: ", greaterThan=0)
        password = pyip.inputPassword("Your Password: "******"id": u_id, "password": password}
        result = BankOperationsBackend.check_balance(credentials)
        start_again() if result else BankOperationsUi.check_balance()
    def deposit_money():
        """This Function collect User input for depositing money.
        
        Collects user id and password, save them to dictionary and pass it to
        the backend deposit_money() function. if the result from the backend is 
        true it restart the program. but if the result is false it call itself 
        to collect user information again.

        Return: None
        """
        print("\n")
        print(messages.account_credentials)
        u_id = pyip.inputInt("Your Id: ", greaterThan=0)
        password = pyip.inputPassword("Your Password: "******"id": u_id, "password": password}
        result = BankOperationsBackend.deposit_money(credentials)
        start_again() if result else BankOperationsUi.deposit_money()
    def open_account():
        """This account collect user inputs for opening new account.
        
        Collect User inputs, store that in a list and pass it to the backend
        open account. if the result from the backend is true it restart the 
        program again and if the result if false it call the open_account() 
        method again to collect user information again.

        Return: None
        """
        print("\n")
        print(messages.open_account)
        u_id = pyip.inputInt("Id: ", greaterThan=0)
        name = pyip.inputCustom(raiseNameError, prompt="Name: ")
        address = pyip.inputCustom(raiseAddressError, prompt="Address: ")
        email = pyip.inputEmail("Email: ")
        balance = pyip.inputInt("Balance: ", min=0)
        password = pyip.inputPassword("Password: ")

        user_data = [u_id, name, address, balance, email, password]
        result = BankOperationsBackend.open_account(user_data)

        start_again() if result else BankOperationsUi.open_account()
Exemplo n.º 14
0
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.common.action_chains import ActionChains
import pyinputplus as pyip
from time import sleep
import sys

if len(sys.argv) in range(2, 4):
    creds = sys.argv[1]
    with open(creds, 'r') as f:
        content = f.read()

    email, passwd, *_ = content.split('\n')
else:
    email = pyip.inputEmail('\nE-mail: ')
    passwd = pyip.inputPassword('Password: '******'r') as f:
        content = f.read()
    to_email, subject, *body_lines = content.split('\n')
else:
    to_email = pyip.input('\nTo E-mail: ')
    subject = input('Subject: ')

    print('Body (content) (Ctrl + C to finish):')
    while True:
        try:
            body_lines += [input()]
        except KeyboardInterrupt:
Exemplo n.º 15
0
#!/bin/python3

import pyinputplus as pyin

name = pyin.inputStr("Enter a name: ")

print(name)

number = pyin.inputNum("Enter a number: ")

print(number)

are_you_old = pyin.inputYesNo("Are you old? ")

print(are_you_old)

email = pyin.inputEmail("Enter an email address: ")

print(email)

password = pyin.inputPassword("Enter a password: "******"Premium", "Pro", "Basic"])

print(membership)
Exemplo n.º 16
0
#! python3

import pyinputplus as pyip

num = pyip.inputNum()
string = pyip.inputStr()
mail = pyip.inputEmail()
yesNo = pyip.inputYesNo()
password = pyip.inputPassword()
Exemplo n.º 17
0
if (len(sys.argv) >= 2):
    emailRecipient = sys.argv[1]
    emailMessage = ''.join(sys.argv[2:])

    logging.debug(f'sending {emailMessage} to recipient {emailRecipient}')

    with webdriver.Firefox() as browser:

        browser.get(emailLoginPage)

        usernameElement = browser.find_element_by_id('username')
        usernameElement.send_keys(emailAddress)

        passwordElement = browser.find_element_by_id('password')
        passwordInput = pyip.inputPassword()

        passwordElement.send_keys(passwordInput)

        submitElement = browser.find_element_by_id('form_submit')
        submitElement.click()
        logging.info(f'Logging in with {emailAddress}')

        # User is logged in, get the compose page
        browser.get(emailComposePage)

        toElement = browser.find_element_by_name('send_to')
        toElement.send_keys(emailRecipient)

        subjectElement = browser.find_element_by_name('subject')
        subjectElement.send_keys('Testmessage')
Exemplo n.º 18
0
from selenium import webdriver
import pyinputplus as pyip
import sys

repository_name = ''
if len(sys.argv) in range(2, 4):
    login = sys.argv[1]
else:
    login = input('\nUsername or Email: ')

if len(sys.argv) == 3:
    repository_name = sys.argv[2]
else:
    repository_name = input('Repository to create (empty for not creating): ')

password = pyip.inputPassword('\nPassword: '******'https://github.com')

browser.set_window_position(2000, 0)
browser.maximize_window()

browser.find_element_by_link_text('Sign in').click()

login_elem = browser.find_element_by_id('login_field')
password_elem = browser.find_element_by_id('password')

login_elem.send_keys(login)
password_elem.send_keys(password)
Exemplo n.º 19
0
# prompt for username/password to sign into Gmail
driver.get(
    "https://accounts.google.com/AccountChooser?service=mail&continue=https://mail.google.com/mail/"
)
userElem = driver.find_element_by_name("identifier")
username = pyip.inputStr("Enter your username:\n")
userElem.send_keys(username)
userElem.send_keys(Keys.ENTER)

try:
    # give page enough time to load password field
    WebDriverWait(driver, 10).until(
        EC.presence_of_element_located((By.NAME, "password")))
finally:
    passwordElem = driver.find_element_by_name("password")
    password = pyip.inputPassword("Input your password:\n")
    passwordElem.send_keys(password)
    passwordElem.send_keys(Keys.ENTER)

try:
    # allow site to load before clicking compose
    WebDriverWait(driver, 10).until(
        EC.presence_of_element_located((
            By.XPATH,
            "/html/body/div[7]/div[3]/div/div[2]/div[1]/div[1]/div[1]/div/div/div/div[1]/div/div"
        )))
finally:
    composeElem = driver.find_element_by_xpath(
        "/html/body/div[7]/div[3]/div/div[2]/div[1]/div[1]/div[1]/div/div/div/div[1]/div/div"
    )
    composeElem.click()
def prompt_encryption_key():
    password = pyinputplus.inputPassword(
        prompt="Enter a password to use as the encryption key:\n"
    )
    return password
def prompt():
    # Ask user for their email and password
    global sender
    global sender_pass
    sender = pyip.inputEmail(prompt="Please enter your email:\n")
    sender_pass = pyip.inputPassword(prompt="Enter your password:\n", mask="*")
Exemplo n.º 22
0
import smtplib
import pyinputplus as pyip
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText

smtp_user = '******'
server = 'smtp.gmail.com'
port = 587
msg = MIMEMultipart("alternative")
msg["Subject"] = 'Why,Oh why!'
msg["From"] = smtp_user
msg["To"] = "*****@*****.**"
msg.attach(MIMEText('\nsent via python', 'plain'))
password = pyip.inputPassword(prompt='Enter password: '******'*')
smtpObj = smtplib.SMTP(server, port)
smtpObj.ehlo()
smtpObj.starttls()
smtpObj.login(smtp_user, password)
s.sendmail(smtp_user, "*****@*****.**", msg.as_string())
s.quit()
print('Good so far')
Exemplo n.º 23
0
#! python3
import sys, time
import pyinputplus as pyip
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
#get cmd line parts
toWhom = sys.argv[1]
subject = sys.argv[2]
body = sys.argv[3:]
pwpart = pyip.inputPassword('Enter password: '******'https://accounts.google.com/ServiceLogin/identifier?service=mail&passive=true&rm=false&continue=https%3A%2F%2Fmail.google.com%2Fmail%2F&ss=1&scc=1&ltmpl=default&ltmplcache=2&emr=1&osid=1&flowName=GlifWebSignIn&flowEntry=ServiceLogin')
#time.sleep(5)
userElem = browser.find_element_by_id('identifierId')
userElem.send_keys('*****@*****.**')
#linkElem = browser.find_element_by_id('ZFr60d CeoRYc')
linkElem = browser.find_element_by_id('identifierNext')
type(linkElem)
linkElem.click()
#enter password
passwordElem = browser.find_element_by_class_name('password')
passwordElem.send_keys(pwpart)
passwordElem.submit()

print('Done')
Exemplo n.º 24
0
btnSign.click()

btnSign = driver.find_element_by_link_text('Sign in with Google')

btnSign.click()

mailElem = driver.find_element_by_id('identifierId')

mailElem.send_keys('Your mail')

time.sleep(1)

mailElem.send_keys(Keys.ENTER)

pwd = pyip.inputPassword(prompt="Email password: ")

pwdElem = driver.find_element_by_name('password')

pwdElem.clear()

pwdElem.send_keys(pwd)

pwdElem.send_keys(Keys.ENTER)
time.sleep(1)
driver.get('https://mail.google.com/')

time.sleep(1)

composeElem = driver.find_element_by_class_name('T-I-KE')
Exemplo n.º 25
0
import maya
import pyinputplus as pypi

user_name = pypi.inputStr("Enter your name please: ")

user_email = pypi.inputEmail("Enter your email please: ").lower()

password = pypi.inputPassword(
    """\n Your email password is needed for authentication with GMAIL. \n
Enter your email password: """)
name_input = pypi.inputStr(
    "Enter the name of the person you wish to send the email: ")
email_input = pypi.inputEmail("Enter his/her email as well: ").lower()
subject = pypi.inputStr("What is the Title of your email? \n")


#date_sent = pypi.inputDatetime(" WHen do you want to send teh email? ")
def send_msg():
    welcome_message = pypi.inputStr('''Enter your message: \n
        ''')
    print(maya.now())
    return welcome_message
Exemplo n.º 26
0
import pyperclip, random, smtplib, pyinputplus as pyip


def genRandomText(length):
    text = []
    sym = list(
        '''`1234567890-=\][poiuytrewqasdfghjkl;'/.,mnbvcxz?><MNBVCXZASDFGHJKL:"}{POIUYTREWQ~!@ #$%^&*()_+'''
    )
    for i in range(length):
        text.append(random.choice(sym))
    return ''.join(text)


msg = input('Enter a message > ')
cop = genRandomText(873459) + '| ' + msg + ' |' + genRandomText(565682)
user = input('Enter email address: ')
pw = pyip.inputPassword('Enter password: '******'Enter recipent email address: ')
con = smtplib.SMTP('smtp.gmail.com', 587)
con.ehlo()
con.starttls()
con.login(user, pw)
con.sendmail(user, to, 'Subject: A hidden email\n\n' + cop)
con.quit()
Exemplo n.º 27
0
#! python
# Usage: python3 cmdLineEmailer.py

from selenium import webdriver
import sys
import pyinputplus as pyip
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support import expected_conditions as EC
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
import datetime
import time

emailAddress = pyip.inputStr("What's your email address for your work email?\n")
password = pyip.inputPassword("What's the password for your work email?\n")
sendTo = pyip.inputStr("What's the email address you'd like to send to?\n")
subject = str(datetime.date.today()) + ': Taking a Sick Day'
message = ''' Hi,

I'm taking a sick day today, not feeling too well.

Hopefully I'll feel better tomorrow.

Thank you,

Shing.
'''

# open browser
browser = webdriver.Chrome()
browser.maximize_window()
Exemplo n.º 28
0
from selenium import webdriver
from selenium.webdriver.common.by import By
import pyinputplus as pyip

browser = webdriver.Firefox()
browser.get('https://github.com/login')
userElem = browser.find_element(By.ID, 'login_field')
username = input('Enter your username or email:\n')
userElem.send_keys(username)

passwordElem = browser.find_element(By.ID, 'password')
password = pyip.inputPassword('Enter your password:\n')
passwordElem.send_keys(password)
passwordElem.submit()
def main():
    username = pyip.inputStr('Username: '******'Password: ')
    app = Login_Form(username, password)
Exemplo n.º 30
0
from selenium import webdriver
import pyinputplus

browser = webdriver.Firefox()
browser.get("https://gmx.net")
userElem = browser.find_element_by_id("freemailLoginUsername")
userElem.send_keys("*****@*****.**")
passwordElem = browser.find_element_by_id("freemailLoginPassword")
password = pyinputplus.inputPassword("Please enter your password\n")
passwordElem.send_keys(password)
userElem.submit()