예제 #1
0
def get_yzm(driver, imgname):
    attempts = 0
    success = False
    while attempts < 3 and not success:
        try:
            imgurl = driver.find_element_by_xpath(
                '//idms-captcha/div/img[@alt="安全提示图片"]').get_attribute('src')
            success = True
        except:
            attempts += 1
            if attempts == 3:
                return False
            try:
                driver.find_element_by_xpath(
                    '//button[@class ="button link first"]').click()
            except:
                print('刷新验证码失败')
                return False
    try:
        request.urlretrieve(imgurl, imgname)
    except Exception as e:
        print(e)
        print("获取验证码图片失败")
        return False
    try:
        result = lianzhong_api.main(file_name=imgname)
    except:
        print("获取验证码失败")
        return False
    if result == "":
        print("联众api返回为空")
    else:
        print(result)
    return result
예제 #2
0
def p_main(OOOOOO00O00OOO0O0, O0O000OO000OOOO0O, OO0O0OO000O0O0000):  #line:22
    OO000O0OO0000OO0O = 'https://jc88.me/account/regist?userid=' + OO0O0OO000O0O0000  #line:23
    O0O00OOOOOOO0O000 = get_email()  #line:24
    print(O0O00OOOOOOO0O000)  #line:25
    O0O0O00O0O00OO0O0 = Options()  #line:26
    O0O0O00O0O00OO0O0 = webdriver.ChromeOptions()  #line:27
    O0O0O00O0O00OO0O0.add_argument('--headless')  #line:29
    O0O0O00O0O00OO0O0.add_argument('--disable-gpu')  #line:30
    O0O0O00O0O00OO0O0.add_argument("--no-sandbox")  #line:32
    O0O00O000000O00OO = webdriver.Chrome(options=O0O0O00O0O00OO0O0)  #line:33
    O0O00O000000O00OO.get(OO000O0OO0000OO0O)  #line:35
    O0O00O000000O00OO.implicitly_wait(10)  #line:36
    time.sleep(1)  #line:37
    O0O00O000000O00OO.find_element_by_xpath(
        '//*[@id="app"]/section/main/div/div/div[2]/form/div[1]/div[2]/div/span/span/input'
    ).send_keys(O0O00OOOOOOO0O000)  #line:40
    O0OOO0O000O000000 = O0O00O000000O00OO.find_element_by_xpath(
        '//*[@id="app"]/section/main/div/div/div[2]/form/div[2]/div[2]/div/span/span/span/span/img'
    ).get_attribute('src')  #line:45
    O0OOO0O000O000000 = O0OOO0O000O000000.split(",")[-1]  #line:47
    O0OOO0O000O000000 = O0OOO0O000O000000.replace("%0A", '\n')  #line:48
    O000O0OOOOOO0000O = b64decode(O0OOO0O000O000000)  #line:49
    with open('./captcha.gif', 'wb') as O00O0OO0000OOO0OO:  #line:50
        O00O0OO0000OOO0OO.write(O000O0OOOOOO0000O)  #line:51
        O00O0OO0000OOO0OO.close()  #line:52
    time.sleep(2)  #line:53
    O00OOOOOO00OO0000 = './captcha.gif'  #line:55
    O0O0OOOO000000O00 = lianzhong_api.main(
        OOOOOO00O00OOO0O0, O0O000OO000OOOO0O, O00OOOOOO00OO0000,
        'http://v1-http-api.jsdama.com/api.php?mod=php&act=upload', '', '',
        '1008', '8dc962b56f1968a844450834ef91bfd0')  #line:57
    O000OOO000000O000 = O0O0OOOO000000O00.json()['data']['val']  #line:59
    OOO00O0OO0000O000 = O0O0OOOO000000O00.json()['data']['id']  #line:60
    print('图片已识别:' + O000OOO000000O000)  #line:61
    O0O00O000000O00OO.find_element_by_xpath(
        '//*[@id="app"]/section/main/div/div/div[2]/form/div[2]/div[2]/div/span/span/span/input'
    ).send_keys(O000OOO000000O000)  #line:64
    time.sleep(1)  #line:66
    O0O00O000000O00OO.find_element_by_xpath(
        '//*[@id="app"]/section/main/div/div/div[2]/form/div[3]/div[2]/div/span/span/span/span/button'
    ).click()  #line:68
    time.sleep(10)  #line:70
    os.remove(O00OOOOOO00OO0000)  #line:72
    OOOO00OOOOOOOO0O0 = get_num(O0O00OOOOOOO0O000)  #line:74
    print(OOOO00OOOOOOOO0O0)  #line:75
    print('验证码已识别:' + OOOO00OOOOOOOO0O0[0])  #line:76
    O0O00O000000O00OO.find_element_by_xpath(
        '//*[@id="app"]/section/main/div/div/div[2]/form/div[3]/div[2]/div/span/span/span/input'
    ).send_keys(OOOO00OOOOOOOO0O0[0])  #line:79
    O0O00O000000O00OO.find_element_by_xpath(
        '//*[@id="app"]/section/main/div/div/div[2]/form/div[4]/div[2]/div/span/span/input'
    ).send_keys('qwer1234')  #line:83
    time.sleep(1)  #line:85
    O0O00O000000O00OO.find_element_by_xpath(
        '//*[@id="app"]/section/main/div/div/div[2]/div/p[1]/button').click(
        )  #line:86
    print('正在点击注册完成!')  #line:87
    time.sleep(2)  #line:88
    tx_code(O0O00O000000O00OO)  #line:89
    time.sleep(4)  #line:90
    if O0O00O000000O00OO.current_url == 'https://jc88.me/home':  #line:91
        telegram_bot("p88", '邀请成功!')  #line:92
        O0O00O000000O00OO.quit()  #line:93
    else:  #line:94
        telegram_bot("P88", '邀请失败!')  #line:95
        print('邀请失败!')  #line:96
예제 #3
0
파일: main.py 프로젝트: tzx0614/MQYwF3
captchaimgdriverelement = captchaimgdriver.find_element_by_css_selector('img')
left = int(captchaimgdriverelement.location['x'])
top = int(captchaimgdriverelement.location['y'])
right = int(captchaimgdriverelement.location['x'] +
            captchaimgdriverelement.size['width'])
bottom = int(captchaimgdriverelement.location['y'] +
             captchaimgdriverelement.size['height'])
im = Image.open('./screenshot.png')
im = im.crop((left, top, right, bottom))
im.save('./code.png')
# time.sleep(5)

driver.add_cookie(captchacookie)
captchaimgdriver.quit()

captchastr = lz.main('./code.png')
captchadic = json.loads(captchastr)

rege = driver.find_element_by_name("reg_checkNub")
rege.send_keys(captchadic["data"]["val"])
confirm.click()

smscode = ph.phone.getsms(phonenum)
telsms_box = driver.find_element_by_name("reg_teljhm")
telsms_box.send_keys(smscode)

pass_box = driver.find_element_by_name("reg_telPassword")
pass_box.send_keys(phonenum)

xieyi_box = driver.find_element_by_id("readWebRule")
xieyi_box.click()
예제 #4
0
    def run(self):

        url = self.yzm_url.replace('\\', '/')
        result = main(url)
        self.get_yzm_result_signal.emit(result)
예제 #5
0
파일: run.py 프로젝트: HIKQ/99
def p_main(user,pass1,invitecode):
            url = 'https://pjj.one/share?userid=' + invitecode
            email=get_email()
            print(email)
            chrome_opt = Options()  # 创建参数设置对象.
            chrome_opt = webdriver.ChromeOptions()
            #chrome_opt.add_argument("'--proxy-server={}".format(porxies))
            chrome_opt.add_argument('--headless')  # 无界面化.
            chrome_opt.add_argument('--disable-gpu')  # 配合上面的无界面化.
            #chrome_opt.add_argument('--window-size=1366,768')  # 设置窗口大小, 窗口大小会有影响.
            chrome_opt.add_argument("--no-sandbox")
            driver = webdriver.Chrome(options=chrome_opt)
            #driver=webdriver.Chrome()
            driver.get(url)
            driver.implicitly_wait(10)
            time.sleep(1)
            # 输入邮箱
            driver.find_element_by_xpath(
                '//*[@id="app"]/section/main/div/div/div[2]/form/div[1]/div[2]/div/span/span/input').send_keys(email)
            #print('正在输入邮箱!')
            # 获取验证码url
            img_str = driver.find_element_by_xpath(
                '//*[@id="app"]/section/main/div/div/div[2]/form/div[2]/div[2]/div/span/span/span/span/img').get_attribute(
                'src')
            #print('找到图片!')
            img_str = img_str.split(",")[-1]  # 删除前面的 “data:image/jpeg;base64,”
            img_str = img_str.replace("%0A", '\n')  # 将"%0A"替换为换行符
            img_data = b64decode(img_str)  # b64decode 解码
            with open('./captcha.gif', 'wb') as fout:
                fout.write(img_data)
                fout.close()
            time.sleep(2)
            #print('验证码图片已保存!')
            im = './captcha.gif'
            s = lianzhong_api.main(user, pass1, im, 'http://v1-http-api.jsdama.com/api.php?mod=php&act=upload', '', '',
                                   '1008', '8dc962b56f1968a844450834ef91bfd0')
            #print(s.json())
            code = s.json()['data']['val']
            yzm_id=s.json()['data']['id']
            print('图片已识别:'+code)
            driver.find_element_by_xpath(
                '//*[@id="app"]/section/main/div/div/div[2]/form/div[2]/div[2]/div/span/span/span/input').send_keys(
                code)
            #print('正在输入图片验证码!')
            time.sleep(1)
            driver.find_element_by_xpath(
                '//*[@id="app"]/section/main/div/div/div[2]/form/div[3]/div[2]/div/span/span/span/span/button').click()
            #print('正在发送邮箱验证码!')
            time.sleep(10)
            #print('等待邮箱验证码!')
            os.remove(im)
            #print('正在移除保存的图片!')
            im_code=get_num(email)
            print(im_code)
            print('验证码已识别:'+im_code[0])
            driver.find_element_by_xpath(
                '//*[@id="app"]/section/main/div/div/div[2]/form/div[3]/div[2]/div/span/span/span/input').send_keys(
                im_code[0])
            #print('正在输入邮箱验证码!')
            driver.find_element_by_xpath(
                '//*[@id="app"]/section/main/div/div/div[2]/form/div[4]/div[2]/div/span/span/input').send_keys(
                'qwer1234')
            #print('正在输入密码!')
            time.sleep(1)
            driver.find_element_by_xpath('//*[@id="app"]/section/main/div/div/div[2]/div/p[1]/button').click()
            print('正在点击注册完成!')
            time.sleep(2)
            tx_code(driver)
            time.sleep(4)
            if driver.current_url=='https://pjj.one/home':
                telegram_bot("p++", '邀请成功!')
                driver.quit()
            else:
                telegram_bot("P++", '邀请失败!')
                print('邀请失败!')