Exemple #1
0
 for i in range(random.randint(1, 12)):
     screen.type(Key.DOWN)
 screen.type(Key.TAB)
 for i in range(random.randint(18, 50)):
     screen.type(Key.DOWN)
 screen.type(Key.TAB)
 screen.type(Key.DOWN)  #question
 screen.type(Key.TAB)
 screen.paste(
     str(random.randint(1111111111111111111,
                        111111111111111111111)))  #secret answer
 screen.type(Key.TAB)
 screen.mouseMove('Image_Next_To_Captcha.png')
 current_loc = Env.getMouseLocation()
 current_loc.x -= 150
 screen.hover(current_loc)
 #screen.wait(copyImageLocation,15)
 #screen.click(copyImageLocation)
 tries = 0
 while True:  #try a few times to decode the captcha
     tries += 1
     if tries == 10:  #solve manually
         captcha_solution = input(
             "Please enter the solution to the captcha manually")
         break
     screen.rightClick(current_loc)
     try:
         screen.wait(copyImageLocation, 15)
         screen.click(copyImageLocation)
         #screen.type("o", KeyModifier.CTRL)
         captcha_url = Env.getClipboard()
     screen.type(Key.DOWN)
 screen.type(Key.TAB)
 for i in range(random.randint(1,12)):
     screen.type(Key.DOWN)
 screen.type(Key.TAB)
 for i in range(random.randint(18,50)):
     screen.type(Key.DOWN)
 screen.type(Key.TAB)
 screen.type(Key.DOWN) #question
 screen.type(Key.TAB)
 screen.paste(str(random.randint(1111111111111111111,111111111111111111111))) #secret answer
 screen.type(Key.TAB)
 screen.mouseMove('Image_Next_To_Captcha.png')
 current_loc = Env.getMouseLocation()
 current_loc.x -= 150
 screen.hover(current_loc)
 #screen.wait(copyImageLocation,15)
 #screen.click(copyImageLocation)
 tries = 0
 while True: #try a few times to decode the captcha
     tries += 1
     if tries == 10: #solve manually
         captcha_solution = input("Please enter the solution to the captcha manually")
         break
     screen.rightClick(current_loc)
     try:
         screen.wait(copyImageLocation,15)
         screen.click(copyImageLocation)
         #screen.type("o", KeyModifier.CTRL)
         captcha_url = Env.getClipboard()
         p = subprocess.Popen(['%s %s "%s"' % ('/usr/bin/python', CLOUDFUSION_PATH+'/third_party/captcha_decoder/decode_number_captcha.py', captcha_url)], stdout=subprocess.PIPE, shell=True)