吾爱破解 - 52pojie.cn

 找回密码
 注册[Register]

QQ登录

只需一步,快速开始

查看: 2024|回复: 10
收起左侧

[Python 转载] [51]网站滑块验证码还原

[复制链接]
lxf0719 发表于 2024-4-28 19:17
51原图.png                          51原图还原后.png
[Python] 纯文本查看 复制代码
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
import requests
import re
from PIL import Image
import time
import hashlib
from fake_useragent import UserAgent
 
imgUrl = re.compile('background-image: url\((.*?)\)') #找到原图链接
positions = re.compile("class='gt_cut_fullbg_slice' style='background-position:(.*?)px (.*?)px;'>")#图片坐标
 
ua = UserAgent()
url='https://authcode.51.com/authcode/slidecode'
headers ={
    'User-Agent': ua.random
}
params={
    'callback': 'jQuery11110024185931707424446_1648388960494',
    'from': 'passport',
    '_': '1648388960512'
}
html=requests.get(url,headers=headers,params=params)
print('html.text->',html.text)
imgurls=imgUrl.findall(html.text)
 
 
for us in imgurls:
    if 'big' in us:
        bigImg='https:'+us.replace("\/",'/').replace('\\"','')
        print('bigImg->',bigImg)
 
pos_lists=[]
positions=positions.findall(html.text)
for ps in positions:
    x=int(ps[0])
    y=int(ps[1])
    pos_lists.append({"x":x,"y":y})
 
bg_img = requests.get(bigImg).content
with open('51原图.png','wb')as f:
    f.write(bg_img)
#bg_img=io.BytesIO(bg_img)
im = Image.open('51原图.png')
 
new_pos=[]
for pos in pos_lists:
    if pos['y'] == -75:
        new_pos.append(im.crop((abs(pos['x']), 75, abs(pos['x']) + 13, 100)))
    if pos['y'] == -50:
        new_pos.append(im.crop((abs(pos['x']), 50, abs(pos['x']) + 13, 75)))
    if pos['y'] == -25:
        new_pos.append(im.crop((abs(pos['x']), 25, abs(pos['x']) + 13, 50)))
    if pos['y'] == 0:
        new_pos.append(im.crop((abs(pos['x']), 0, abs(pos['x']) + 13, 25)))
 
#print(new_pos)
#新图片
new_im = Image.new('RGB', (260, 100))
 
x_offset = 0
y_offset=0
 
for im in new_pos:
    if (x_offset==260):
        x_offset=0
        y_offset+=25
 
    new_im.paste(im, (x_offset, y_offset))
    x_offset += 13
 
print('ok','{}.png'.format('resul'))
new_im.save('./{}.png'.format('51原图还原后'))
 
my_time = int(time.time()*1000)
times = re.compile('<inpu.*?times.*?value=(.*?)>')
times = times.findall(html.text)[0].replace('\\"','')
challenge = re.compile('<inpu.*?challenge.*?value=(.*?)>')
challenge = challenge.findall(html.text)[0].replace('\\"','')
# print(times)
# print(challenge)
point='68'
re_url = 'https://authcode.51.com/authcode/yz2'
params1 = {
    'callback': f'jQuery111104273542489406337_'+str(my_time),
    'point': point,
    'times': times,
    'challenge': challenge,
    'token': hashlib.md5((challenge+times+point).encode('utf8')).hexdigest(),
    'from': 'passport',
    'divpre':'',
    '_': str(my_time)
}
re_html = requests.get(re_url,params=params1)
print(re_html.text)

发帖前要善用论坛搜索功能,那里可能会有你要找的答案或者已经有人发布过相同内容了,请勿重复发帖。

Corgibro 发表于 2024-4-29 07:24
厉害的,感谢分享拖动验证方式
ztqddj007 发表于 2024-4-29 09:23
ayang0513 发表于 2024-4-29 09:29
stu0011613 发表于 2024-4-29 16:50
大佬牛逼啊,新手看看
tianya0908 发表于 2024-4-29 21:02
大佬牛皮
XTCharles 发表于 2024-4-29 23:30
感谢分享
xiugou 发表于 2024-4-30 16:08
很好的思路,感谢!
changesmile 发表于 2024-5-5 16:58
看了下代码,大佬是怎么找到规律的,这也太牛了
vzzwcom 发表于 2024-5-5 21:30
大佬牛皮
您需要登录后才可以回帖 登录 | 注册[Register]

本版积分规则

返回列表

RSS订阅|小黑屋|处罚记录|联系我们|吾爱破解 - LCG - LSG ( 京ICP备16042023号 | 京公网安备 11010502030087号 )

GMT+8, 2025-5-24 17:02

Powered by Discuz!

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表