话不多说点我【+qq】
先看滑块 右滑拼图 我们用opencv就可以了,要想提高识别率,就取对接图片打码平台
opencv代码,注释借鉴于网络
import cv2
import numpy as np
from io import BytesIOdef get_distance3(fg_resp, bg_resp):"""计算滑动距离"""# 1. 将背景图、滑块图的二进制响应体转为BytesIO对象bg = BytesIO(bg_resp)fg = BytesIO(fg_resp)# 2. 使用imdecode进行图像解码,转成OpenCV中的Mat对象target = cv2.imdecode(np.asarray(bytearray(fg.read()), dtype=np.uint8), 0)template = cv2.imdecode(np.asarray(bytearray(bg.read()), dtype=np.uint8), 0)# 3. 使用matchTemplate方法进行模板匹配,返回背景图中与滑块的位置匹配值数组result = cv2.matchTemplate(target, template, cv2.TM_CCORR_NORMED)# 4. 使用numpy中的unravel_index函数获取result中位置匹配值最大的索引位置,既是滑动的距离_, distance = np.unravel_index(result.argmax(), result.shape)return distance
默认图片是600*300
所以计算出来的距离需要做操作(距离/600*391)
为什么是391 因为我的手机设备把原图600*300的图缩放成391*195
你需要根据你的手机设备进行修改
网上去找一个生成鼠标轨迹的代码,直接用
def get_random_tracks(distance):"""生成轨迹"""tracks = []y = 0v = 0t = 1current = 0mid = distance * 3 / 4exceed = 80z = ttracks.append([0, 0, 1])while current < (distance + exceed):if current < mid / 2:a = 15elif current < mid:a = 20else:a = -30a /= 2v0 = vs = v0 * t + 0.5 * a * (t * t)current += int(s)v = v0 + a * ty += random.randint(-5, 5)z += 100 + random.randint(0, 10)tracks.append([min(current, (distance + exceed)), y, z])while exceed > 0:exceed -= random.randint(0, 5)y += random.randint(-5, 5)z += 100 + random.randint(0, 10)tracks.append([min(current, (distance + exceed)), y, z])return tracks
解密的是des的 ,随便找个des加密代码就行
提交参数
(end_time-start_time,对应密钥)
(x/391,对应密钥)
(鼠标轨迹数组,对应密钥)
加密提交就行
结果,opencv成功概率还行 10个7次都过了
因为写多了不让发布
点我【+qq】