Example #1
0
def redis_run(url, numIterations):
    for i in range(numIterations):
        import process
        import redis
        wb = webdriver.Firefox()
        wb.get(url)
        c = 'CMDS'
        _id = random.randint(0, pow(2,17))
        element = wb.find_element_by_id("recaptcha_image")
        img = process.make_html_img(element, wb)
        rconn = redis.StrictRedis(host='50.17.215.201', port=6379, db=0, password="******")
        ps = rconn.pubsub()
        print _id
        rconn.publish(c, str(_id) + img) # I am listening here for the solution
        ps.subscribe(str(_id))
        solution = ""
        for m in ps.listen():
            if m['type'] == 'message':
                solution = m.get('data')
                break
        print solution
        field = wb.find_element_by_id('recaptcha_response_field')
        field.send_keys(solution)
        field.send_keys('\n')
        sleep(1)
        wb.close()
Example #2
0
 def make_account(self):
     wb = self.wb
     wb.get("https://petitions.whitehouse.gov/register")
     sleeprand(3)
     wb.find_element_by_id('edit-mail').send_keys(self.email)
     wb.find_element_by_id('edit-profile-main-field-first-name-und-0-value').send_keys(self.first_name)
     wb.find_element_by_id('edit-profile-main-field-last-name-und-0-value').send_keys(self.last_name)
     wb.find_element_by_id('edit-profile-main-field-zip-und-0-value').send_keys(self.zipcode)
     element = wb.find_element_by_id('recaptcha_image')
     import process
     img_src = process.make_html_img(element, wb)
     solution = redis_cli.find_solution(img_src)
     wb.find_element_by_id('recaptcha_response_field').send_keys(solution)
     sleeprand(2)
     wb.find_element_by_id('edit-submit').click()
     sleeprand(3)