揭秘滑动验证码:人类手抖VS机器精准!你以为它在乎速度和准确性?错!真相只有3秒...
本帖最后由 不二如是 于 2023-12-17 18:27 编辑问:滑动验证码识别人机是看我们滑的快不快,对的有多准吗?
3秒考虑一下
答案:**** Hidden Message *****
揭秘:
https://www.bilibili.com/video/BV1ru4y1J7YT
实现代码:
from PIL import Image, ImageDraw, ImageFont, ImageFilter
import random
# 生成随机字母
def rnd_char():
return chr(random.randint(65, 90))
# 生成随机颜色1
def rnd_color():
return (random.randint(64, 255), random.randint(64, 255), random.randint(64, 255))
# 生成随机颜色2
def rnd_color2():
return (random.randint(32, 127), random.randint(32, 127), random.randint(32, 127))
# 240 x 60:
width = 240
height = 60
image = Image.new('RGB', (width, height), (255, 255, 255))
# 创建Font对象:
font = ImageFont.truetype('Arial.ttf', 36)
# 创建Draw对象:
draw = ImageDraw.Draw(image)
# 填充每个像素:
for x in range(width):
for y in range(height):
draw.point((x, y), fill=rnd_color())
# 输出文字:
for t in range(4):
draw.text((60 * t + 10, 10), rnd_char(), font=font, fill=rnd_color2())
# 模糊:
image = image.filter(ImageFilter.BLUR)
image.save('code.jpg', 'jpeg')
print("验证码已生成并保存为code.jpg")
嗯~ 滑动速度是否匀速?
页:
[1]