【Python selenium过极验五子棋】自动化过五子棋人机验证,享受丝滑的落子,秒了
创始人
2024-11-15 15:09:42
0

文章日期:2024.07.25

使用工具:Python

文章类型:自动化过极验五子棋

文章全程已做去敏处理!!!  【需要做的可联系我】 

AES解密处理(直接解密即可)(crypto-js.js 标准算法):​​​​​​在线AES加解密工具

【点赞 收藏 关注 】仅供学习,仅供学习。

今天用Python 的 selenium模块,自动化过极验五子棋,先看视频

这个是手动验证的,需要输入指定数字才能开始验证,是一个while死循环,是为了方便展示

1、五子棋人机验证比上一次的哪个消消乐还要简单,哪个消消乐的图片的url全部都不一样,这个五子棋的图片的url都是一样的,又节约了时间和流量
2、这次的人机验证也没什么难度,看图说话

3、难度不大,也没什么好讲的,有些注释没写是因为屎山不需要注释,其次是因为我写代码时都是突然来的灵感,没来的及写,等回过头就忘了要写什么注释了,干脆就不写了,总之我都会,你们不会的可以自己研究一下,还不会就留言,等我给你慢慢讲

【附上代码】教程可能不是很清晰明了,有不懂可以留言或私信

from selenium import webdriver from selenium.webdriver.common.by import By import time import re import hashlib  def md5_encrypt(string):     md5 = hashlib.md5()     md5.update(string.encode('utf-8'))     return md5.hexdigest() # 配置 Chrome 浏览器 chrome_options = webdriver.ChromeOptions() chrome_options.binary_location = "chrome/chrome.exe"  # 指定 Chrome 浏览器的路径 chrome_options.add_argument("--disable-infobars")  # 禁用浏览器中的"信息栏",避免干扰测试。 # 启动浏览器 driver = webdriver.Chrome(options=chrome_options)  # 打开 Google driver.get("http://gt4.geetest.com/")  print('点击开始验证') time.sleep(0.5) # 点击配置 driver.find_element(By.XPATH, r'/html/body/div/div/div[4]/div[1]').click() time.sleep(0.5) # 点击五子棋验证 driver.find_element(By.XPATH, r'/html/body/div/div/div[4]/div[2]/div[2]/div[1]/div[2]/div[3]/div[6]').click() time.sleep(0.5) # 点击验证按钮 driver.find_element(By.XPATH, r'/html/body/div/div/div[2]/div[2]/form/div[3]/div[3]/div[1]/div[1]').click() print('等待加载')  data = driver.page_source # 字典格式的数据 list_chart1 = [] # 数据转哈希 list_chart2 = [] # 上下 for _y in range(5):     # 左右     for _x in range(5):         if re.findall(f'geetest_item-{_y}-{_x} geetest_itemimg geetest_isEmpty', data):             chart_url = ''         else:             chart_url = md5_encrypt(re.findall(f'geetest_item-{_y}-{_x}_.*?url\("(.*?)"\)', data)[0])         list_chart1 += [{f'{_y+1}-{_x+1}': chart_url}]         list_chart2 += [chart_url] print(f'五子棋已排列完成:{list_chart1}') # 去重 quchong = [] # 要查找的参数 chuang = '' # 目标棋子 & 重点坐标 target = ['',''] print('开始检测五子棋并查找缺口!!!') if list_chart2[4::4][:-1].count('') == 1 and len(set(list_chart2[4::4][:-1])) == 2:     quchong += ['1-5','2-4','3-3','4-2','5-1']     chuang = list(filter(None, set(list_chart2[4::4][:-1])))[0]     target[1] = f'{list_chart2[4::4][:-1].index("")+1}-{6-(list_chart2[4::4][:-1].index("")+1)}' if list_chart2[::6].count('') == 1 and len(set(list_chart2[::6])) == 2:     quchong += ['1-1','2-2','3-3','4-4','5-5']     chuang = list(filter(None, set(list_chart2[::6])))[0]     target[1] = f'{list_chart2[::6].index("")+1}-{list_chart2[::6].index("")+1}' for number in range(5):     number_1 = number * 5     if list_chart2[number_1:number_1+5].count('') == 1 and len(set(list_chart2[number_1:number_1+5])) == 2:         quchong += [f'{number_1 // 5 + 1}-{a+1}' for a in range(5)]         chuang = list(filter(None, set(list_chart2[number_1:number_1+5])))[0]         target[1] = list(list_chart1[number_1+list_chart2[number_1:number_1+5].index('')].keys())[0]     if list_chart2[number::5].count('') == 1 and len(set(list_chart2[number::5])) == 2:         quchong += [f'{a+1}-{number+1}' for a in range(5)]         chuang = list(filter(None,set(list_chart2[number::5])))[0]         target[1] = list(list_chart1[number+list_chart2[number::5].index('')*5].keys())[0]     if quchong:         for _ in list_chart1:             if list(_.keys())[0] not in quchong and list(_.values())[0] == chuang:                 target[0] = list(_.keys())[0]         break print(f'缺口方位:{target[0]} 目标棋子方位:{target[1]}') print('准备移动 - 略等2秒,怕页面没加载出来!!!') # 此处要加间隔时间,防止图片没有加载出来 time.sleep(2) driver.find_element(By.XPATH,                     rf'/html/body/div/div/div[2]/div[2]/form/div[3]/div[3]/div[1]/div[4]/div[1]/div[2]/div/div[2]/div[{target[0].split("-")[0]}]/div[{int(target[0].split("-")[1])*2}]').click() time.sleep(0.1) driver.find_element(By.XPATH,                     rf'/html/body/div/div/div[2]/div[2]/form/div[3]/div[3]/div[1]/div[4]/div[1]/div[2]/div/div[2]/div[{target[1].split("-")[0]}]/div[{int(target[1].split("-")[1])*2}]').click() print('验证成功!!!')  print('等待执行其他操作!!!\n\n')  time.sleep(10000) # 关闭浏览器 driver.quit()

相关内容

热门资讯

微乐小程序脚本入口!微乐小程序... 微乐小程序脚本入口!微乐小程序免费黑科技(透视)脚本-都是推荐真的有挂1、很好的工具软件,可以解锁游...
第三分钟脚本!微信小程序微乐内... 第三分钟脚本!微信小程序微乐内蒙破解器,微乐小程序免费黑科技,妙招教程(有挂安装)-哔哩哔哩微信小程...
辅助透视!wpk透视最怕三个东... 辅助透视!wpk透视最怕三个东西(透视)wpk模拟器是什么-本来有挂(哔哩哔哩)在进入wpk透视最怕...
透视新版!微乐小程序黑科技,微... 透视新版!微乐小程序黑科技,微乐自建房辅助软件功能(透视)总是有挂(哔哩哔哩)1、微乐自建房辅助软件...
微乐自建房怎么提高运气!微乐小... 微乐自建房怎么提高运气!微乐小程序黑科技(透视)器-好像有挂存在有挂1、点击下载安装,脚本分类一目了...
三分钟插件!微乐自建房辅助软件... 三分钟插件!微乐自建房辅助软件下载,微乐小程序黑科技,经验教程(有挂安装)-哔哩哔哩1.微乐自建房辅...
第三方插件!wpk俱乐部是真的... 第三方插件!wpk俱乐部是真的吗(透视)有哪些免费的wpk透视码-一贯是真的挂(哔哩哔哩)1、有哪些...
复盘辅助挂!微乐小程序黑科技,... 复盘辅助挂!微乐小程序黑科技,微信小程序微乐辅助(透视)其实存在有挂(哔哩哔哩)1、这是跨平台的微信...
微信小程序微乐修改器!微乐小程... 微信小程序微乐修改器!微乐小程序免费黑科技(透视)工具-总是有挂是有挂1、在插件功能辅助器技巧中,中...
8分钟脚本!万能透视辅助器免费... 8分钟脚本!万能透视辅助器免费版,微乐小程序免费黑科技,办法教程(有挂app)-哔哩哔哩1、微乐小程...