import gui import pyautogui import time import subprocess def main(): pyautogui.FAILSAFE = False screenWidth, screenHeight = pyautogui.size() ui = gui.Gui(screenWidth, screenHeight) print("Screen is {} {}".format(screenWidth, screenHeight)) print("Accessing course on qwiklabs") # Head over to the course on qwiklabs.com pyautogui.press('f6') pyautogui.write("qwiklabs.com") pyautogui.press('/') pyautogui.write("focuses") pyautogui.press('/') pyautogui.write("2794") pyautogui.press('?') pyautogui.write("parent") pyautogui.press('=') pyautogui.write("catalog") pyautogui.press('enter') time.sleep(5) print("Signing in") pyautogui.moveTo(0,0) # Click join button pyautogui.moveTo(ui.qwiklabs_gui.JOIN_BTN[0], ui.qwiklabs_gui.JOIN_BTN[1], 3, pyautogui.easeOutQuad) pyautogui.click(button='left') time.sleep(5) # Move to the end of the page pyautogui.press('pgdn') print("Moving from sign up to sign in") # switch to sign in button pyautogui.moveTo(ui.qwiklabs_gui.SIGN_IN_BTN[0], ui.qwiklabs_gui.SIGN_IN_BTN[1], 3, pyautogui.easeOutQuad) pyautogui.click(button='left') time.sleep(5) # switch to email textbox, the rest is done via kbd pyautogui.moveTo(ui.qwiklabs_gui.EMAIL_TEXTBOX[0], ui.qwiklabs_gui.EMAIL_TEXTBOX[1], 3, pyautogui.easeOutQuad) pyautogui.click(button='left') time.sleep(2) print("Inserting credentials") # account; "mopopa1077@5sword.com", "hellogoodbye" account = ("mopopa1077@5sword.com", "hellogoodbye") username = account[0] password = account[1] first_part = username.split('@')[0] second_part = username.split('@')[1] pyautogui.press('@') pyautogui.press('left') pyautogui.write(first_part, interval=0.2) pyautogui.press('right') pyautogui.write(second_part, interval=0.2) pyautogui.press('\t') pyautogui.write(password, interval=0.2) pyautogui.press('enter') time.sleep(10) # Start course time.sleep(5) print("Starting the course") pyautogui.moveTo(ui.qwiklabs_gui.STARTLAB_BTN[0], ui.qwiklabs_gui.STARTLAB_BTN[1], 3, pyautogui.easeOutQuad) pyautogui.click() # Accept captcha - sometimes they don't even ask for actual verification # time.sleep(5) # print("Accepting captcha (not needed really)") # pyautogui.moveTo(ui.qwiklabs_gui.CAPTCHA_BTN[0], ui.qwiklabs_gui.CAPTCHA_BTN[1], 3, pyautogui.easeOutQuad) # pyautogui.click() bashCommand = "copyq clipboard" # Copy username to clipboard time.sleep(20) print("Copying email") pyautogui.moveTo(ui.qwiklabs_gui.EMAIL_COPY_BTN[0], ui.qwiklabs_gui.EMAIL_COPY_BTN[1], 3, pyautogui.easeOutQuad) pyautogui.click() g_email = subprocess.check_output(['bash','-c', bashCommand]).decode('utf-8') # Copy password to clipboard time.sleep(5) print("Copying password") pyautogui.moveTo(ui.qwiklabs_gui.PASSWORD_COPY_BTN[0], ui.qwiklabs_gui.PASSWORD_COPY_BTN[1], 3, pyautogui.easeOutQuad) pyautogui.click() g_password = subprocess.check_output(['bash','-c', bashCommand]).decode('utf-8') print(g_email, g_password) # while True: # print(pyautogui.position()) main()