声明:
该文章为学习使用,严禁用于商业用途和非法用途,违者后果自负,由此产生的一切后果均与作者无关
js运行 atob(‘aHR0cHM6Ly93d3cuemhpaHUuY29tL3NpZ25pbg==’) 拿到网址,浏览器打开网站,F12打开调试工具,清除cookie、storage,刷新页面
在Network中找到api/v2/getconf、v3/d请求,后续扣代码会用到响应结果返回的值,这两个请求中只有v3/d中的d参数是需要扣代码的,api/v2/getconf中的id是网站id,每个网站是唯一的,写固定即可
输入账号密码点击登录,找到v3/b、api/v3/get请求,其中v3/b请求中的d参数是需要解密的,api/v3/get请求中的acToken、fp、cb等参数是需要解密的,api/v3/get返回的是图片信息
验证滑块找到api/v3/check请求,该请求中data、cb等参数是需要解密的,验证成功validate是有值的,后续登录会用到会用到响应结果中的值
根据上面分析破解滑块需要解密这些请求api/v2/getconf、v3/d、v3/b、api/v3/get、api/v3/check中的参数,其中api/v2/getconf是没有加密参数的,鼠标右击请求找到Copy>Copy as cUrl(cmd),打开网站:https://spidertools.cn/#/curl2Request,把拷贝好的curl转成python代码,新建 yiduSlider.py,把代码复制到该文件
修改yiduSlider.py吧request请求替换成requestSession请求,并把id参数单独拿出来,点击运行yiduSlider.py,请求响应成功
import ddddocr
import random
from matplotlib import pyplot
slide = ddddocr.DdddOcr(det=False, ocr=False)
def get_dis():
with open('./img/yd_front.jpg', 'rb') as f:
target_bytes = f.read()
with open('./img/yd_bg.jpg', 'rb') as f:
background_bytes = f.read()
res = slide.slide_match(target_bytes, background_bytes, simple_target=True)
return res['target'][0]
def get_track(dis=0):
dis = dis or get_dis()
track = []
x = random.randint(0, 10) # 移动X坐标
y = random.randint(-5, 5) # 移动y坐标
pass_time = random.randint(10, 90) # 移动时间
move_dis = x # 移动距离
track.append([x, y, pass_time])
# 模拟开始拖动时会产生0-3个类似的x相同的轨迹
for _ in range(random.randint(0, 3)):
pass_time += random.randint(2, 5) # 移动时间
y = random.randint(-1, 1)
track.append([x, y, pass_time])
# 开始模拟轨迹,一般开始拖动时会很快,越接近目标点越慢
while move_dis < dis:
if move_dis > dis * 0.95:
offset = random.randint(-1, 1) # 模拟快到目标点时调整滑块时的轨迹,一般会左右移动几下对齐
elif move_dis > dis * 0.85:
offset = random.randint(0, 1)
elif move_dis > dis * 0.75:
offset = random.randint(1, 2)
elif move_dis > dis * 0.6:
offset = random.randint(2, 4)
else:
offset = random.randint(5, 8)
pass_time += random.randint(30, 48)
move_dis += offset
y = random.choice([y, random.randint(-5, 5)]) # 移动y坐标
track.append([move_dis, y, pass_time])
# 模拟停止时会产生0-3个类似的x相同的轨迹
for _ in range(random.randint(0, 3)):
pass_time += random.randint(2, 5) # 移动时间
y = random.randint(-1, 1)
track.append([move_dis, y, pass_time])
return track, dis
def draw_line_chart(track):
x_axis = [info[2] for info in track]
y_axis = [info[0] for info in track]
pyplot.plot(x_axis, y_axis)
pyplot.show()
if __name__ == '__main__':
# test_track = {
# 260: [[4, 3, 8], [4, 3, 14], [4, 4, 23], [6, 5, 30], [6, 6, 38], [8, 7, 46], [9, 7, 54], [11, 8, 63],
# [13, 9, 68],
# [19, 9, 78], [24, 10, 84], [32, 10, 95], [40, 10, 100], [48, 9, 109], [60, 7, 117], [72, 4, 125],
# [84, 3, 134],
# [98, 0, 139], [112, -2, 147], [124, -3, 154], [136, -5, 164], [145, -5, 170], [155, -6, 179],
# [161, -6, 186],
# [167, -7, 196], [169, -7, 202], [171, -7, 209], [172, -8, 217], [174, -8, 225], [175, -8, 234],
# [177, -9, 241],
# [181, -9, 250], [187, -9, 257], [194, -9, 265], [202, -11, 272], [210, -11, 280], [218, -11, 286],
# [224, -11, 296], [230, -11, 302], [234, -11, 312], [237, -11, 318], [238, -11, 328], [239, -11, 335],
# [240, -11, 341], [240, -11, 467], [244, -11, 475], [245, -11, 480], [246, -11, 497], [248, -11, 641],
# [248, -9, 648], [249, -9, 657], [251, -8, 664], [252, -8, 676], [252, -7, 777], [253, -7, 789],
# [254, -7, 796],
# [256, -6, 1061], [256, -6, 1077], [257, -6, 1172], [258, -6, 1180], [259, -6, 1817], [260, -6, 1826],
# [260, -6, 1835]],
# 197: [[5, -2, 68], [9, -3, 75], [13, -4, 83], [19, -4, 89], [24, -4, 99], [31, -4, 106], [36, -4, 115],
# [44, -5, 122], [53, -6, 131], [61, -6, 139], [87, -9, 173], [92, -10, 175], [94, -10, 183],
# [96, -10, 190],
# [99, -11, 198], [100, -11, 206], [102, -11, 213], [104, -11, 221], [105, -11, 229], [108, -11, 237],
# [110, -11, 245], [112, -11, 254], [116, -11, 261], [119, -11, 268], [120, -11, 276], [122, -11, 283],
# [124, -11, 291], [124, -11, 300], [125, -11, 307], [126, -11, 315], [127, -11, 335], [128, -11, 348],
# [129, -11, 356], [131, -12, 365], [135, -12, 372], [140, -12, 381], [146, -12, 388], [152, -12, 397],
# [157, -13, 405], [161, -13, 413], [164, -13, 420], [166, -13, 427], [168, -14, 435], [168, -15, 510],
# [169, -16, 522], [171, -16, 530], [172, -16, 538], [172, -16, 547], [172, -16, 554], [173, -16, 562],
# [174, -17, 634], [175, -17, 645], [176, -17, 655], [176, -17, 662], [176, -18, 671], [178, -18, 678],
# [179, -18, 686], [180, -18, 693], [182, -18, 701], [183, -18, 708], [184, -18, 717], [184, -18, 822],
# [185, -18, 836], [186, -18, 934], [187, -18, 954], [188, -18, 962], [188, -18, 978], [189, -18, 1001],
# [190, -18, 1012], [191, -18, 1070], [192, -18, 1077], [192, -18, 1086], [193, -18, 1093],
# [194, -18, 1103],
# [195, -18, 1109], [196, -18, 1270], [196, -18, 1581], [197, -18, 1836], [197, -19, 2746],
# [197, -20, 2753]],
# 152: [[6, 0, 50], [9, 0, 58], [15, -1, 67], [20, -2, 76], [26, -4, 82], [34, -5, 89], [40, -6, 96],
# [45, -7, 105],
# [51, -8, 112], [56, -9, 121], [61, -10, 128], [65, -11, 137], [70, -12, 144], [73, -12, 153],
# [77, -13, 157],
# [80, -15, 166], [83, -16, 176], [85, -16, 183], [87, -16, 191], [88, -16, 198], [89, -16, 207],
# [91, -16, 213],
# [92, -16, 226], [92, -16, 256], [96, -16, 264], [100, -16, 272], [105, -16, 279], [111, -16, 290],
# [116, -16, 294], [122, -16, 303], [124, -16, 311], [126, -16, 320], [128, -15, 326], [128, -15, 346],
# [129, -15, 354], [130, -15, 362], [131, -15, 369], [132, -16, 377], [132, -16, 385], [133, -16, 393],
# [134, -16, 442], [137, -17, 462], [143, -18, 471], [148, -18, 478], [153, -18, 487], [159, -18, 493],
# [160, -18, 502], [160, -18, 615], [160, -17, 630], [159, -17, 770], [158, -17, 791], [157, -17, 804],
# [156, -17, 823], [156, -17, 835], [155, -17, 845], [154, -17, 870], [153, -17, 890], [152, -17, 920],
# [152, -18, 932], [151, -18, 940], [150, -18, 972], [151, -18, 1701], [152, -18, 1709], [152, -17, 1828]],
# 243: [[6, 2, 50], [11, 2, 56], [16, 2, 64], [24, 2, 72], [34, 3, 79], [47, 3, 89], [63, 3, 95], [78, 3, 105],
# [92, 3, 112], [104, 2, 120], [115, 1, 128], [123, -1, 132], [129, -2, 145], [135, -3, 150],
# [140, -5, 158],
# [145, -7, 165], [151, -9, 175], [156, -11, 180], [163, -13, 189], [169, -15, 195], [175, -17, 205],
# [182, -19, 212], [187, -20, 220], [193, -21, 229], [198, -21, 236], [200, -22, 245], [202, -22, 252],
# [203, -22, 379], [205, -21, 387], [206, -21, 394], [207, -21, 401], [209, -20, 410], [210, -20, 417],
# [211, -19, 426], [214, -19, 433], [215, -18, 442], [217, -18, 448], [219, -18, 459], [219, -18, 465],
# [220, -18, 471], [221, -18, 482], [222, -18, 624], [223, -18, 648], [223, -18, 655], [225, -18, 663],
# [226, -18, 668], [227, -18, 679], [227, -18, 686], [228, -18, 729], [229, -17, 739], [230, -17, 748],
# [231, -17, 756], [232, -17, 765], [233, -17, 771], [234, -17, 781], [235, -17, 829], [235, -17, 836],
# [235, -16, 844], [237, -16, 852], [238, -16, 867], [238, -15, 875], [239, -15, 952], [239, -15, 972],
# [240, -15, 1076], [241, -14, 1304], [242, -13, 1382], [243, -13, 1401]],
# 146: [[4, 5, 110], [6, 5, 118], [12, 5, 128], [21, 6, 135], [33, 6, 140], [46, 6, 150], [60, 6, 155],
# [72, 6, 167],
# [84, 6, 173], [94, 5, 182], [100, 5, 189], [105, 4, 198], [107, 4, 205], [108, 4, 210], [110, 3, 221],
# [112, 3, 235], [112, 3, 242], [113, 3, 257], [113, 2, 264], [114, 2, 279], [115, 2, 410], [116, 2, 425],
# [117, 2, 432], [119, 3, 442], [120, 3, 449], [122, 3, 458], [123, 4, 466], [124, 4, 475], [126, 5, 479],
# [127, 5, 488], [129, 5, 495], [131, 5, 504], [132, 5, 511], [134, 5, 520], [136, 5, 527], [136, 5, 535],
# [137, 5, 543], [138, 5, 554], [139, 5, 721], [140, 5, 731], [140, 5, 737], [141, 5, 837], [142, 5, 860],
# [143, 6, 1017], [144, 6, 1026], [144, 7, 1031], [145, 7, 1118], [146, 7, 1138], [146, 8, 1149],
# [147, 8, 1161],
# [147, 9, 1199], [148, 9, 1207], [148, 9, 1214], [149, 10, 1231], [148, 10, 1779], [148, 9, 1789],
# [148, 9, 1906], [147, 9, 1969], [146, 9, 1976], [146, 9, 1986]],
# 264: [[4, 0, 41], [5, 0, 48], [12, 1, 57], [21, 1, 66], [33, 1, 74], [53, 1, 80], [75, 1, 88], [100, 3, 95],
# [123, 4, 105], [136, 5, 110], [149, 6, 120], [159, 8, 126], [164, 8, 136], [170, 9, 143], [173, 9, 149],
# [175, 9, 158], [176, 9, 166], [179, 9, 174], [182, 9, 181], [186, 8, 190], [192, 7, 198], [197, 4, 207],
# [203, 4, 210], [208, 4, 221], [212, 4, 227], [214, 3, 236], [215, 3, 242], [216, 3, 251], [217, 3, 258],
# [219, 3, 268], [220, 3, 273], [223, 3, 283], [226, 3, 290], [230, 3, 297], [233, 3, 307], [236, 3, 314],
# [238, 3, 321], [240, 3, 328], [240, 3, 338], [240, 2, 407], [242, 2, 412], [244, 1, 420], [244, 1, 428],
# [245, 1, 437], [246, 0, 528], [247, 0, 587], [248, 0, 595], [250, 1, 610], [251, 1, 617], [252, 2, 705],
# [252, 2, 712], [253, 3, 721], [254, 3, 833], [256, 4, 911], [256, 4, 922], [256, 4, 931], [257, 4, 1071],
# [258, 4, 1073], [258, 5, 1075], [259, 5, 1077], [260, 5, 1127], [260, 5, 1151], [261, 6, 1227],
# [262, 7, 1236],
# [263, 8, 1244], [264, 8, 1254], [264, 8, 1260]],
# 133: [[8, 0, 75], [16, 0, 83], [24, 0, 93], [33, 0, 101], [44, -2, 108], [53, -3, 118], [61, -5, 124],
# [70, -6, 130],
# [76, -8, 142], [81, -10, 145], [87, -12, 154], [92, -14, 160], [97, -16, 167], [102, -17, 176],
# [106, -19, 184], [108, -20, 192], [111, -20, 200], [112, -21, 206], [112, -22, 214], [113, -22, 221],
# [114, -22, 250], [115, -22, 258], [116, -23, 265], [117, -23, 272], [118, -23, 288], [119, -23, 358],
# [120, -23, 376], [120, -23, 454], [121, -23, 465], [123, -23, 472], [124, -22, 480], [125, -22, 487],
# [126, -22, 640], [127, -21, 655], [128, -20, 759], [128, -20, 771], [129, -20, 779], [130, -20, 853],
# [131, -19, 869], [132, -19, 891], [132, -18, 932], [133, -18, 939], [133, -17, 947], [134, -17, 954],
# [135, -16, 961], [136, -16, 971], [135, -16, 1514], [135, -17, 1521], [134, -18, 1565], [134, -19, 1587],
# [133, -19, 1596]],
# 153: [[5, 1, 45], [10, 1, 54], [17, 1, 63], [25, 1, 70], [33, 1, 78], [41, -2, 87], [49, -3, 94], [57, -4, 103],
# [66, -7, 108], [74, -7, 118], [80, -9, 125], [85, -10, 133], [91, -11, 141], [96, -12, 149],
# [98, -12, 157],
# [101, -13, 165], [104, -13, 173], [106, -14, 179], [108, -15, 187], [110, -15, 194], [112, -15, 204],
# [113, -15, 211], [115, -15, 219], [117, -15, 226], [117, -15, 236], [119, -15, 242], [120, -15, 250],
# [121, -16, 256], [121, -16, 265], [122, -16, 276], [123, -16, 286], [125, -16, 291], [128, -17, 302],
# [132, -17, 309], [137, -18, 315], [144, -19, 324], [149, -19, 331], [155, -19, 340], [158, -19, 347],
# [159, -19, 356], [160, -19, 371], [158, -19, 635], [157, -19, 642], [157, -19, 649], [156, -19, 656],
# [155, -19, 674], [155, -20, 945], [154, -21, 960], [153, -22, 972], [153, -22, 1060]],
# 226: [[8, 2, 49], [15, 4, 58], [23, 4, 65], [31, 4, 73], [39, 4, 80], [47, 4, 90], [57, 3, 97], [65, 3, 106],
# [73, 1, 113], [81, -1, 122], [89, -3, 129], [97, -5, 136], [103, -7, 143], [110, -9, 150],
# [117, -11, 160],
# [125, -13, 167], [130, -15, 176], [136, -17, 183], [143, -18, 193], [150, -19, 198], [155, -19, 205],
# [160, -21, 214], [161, -21, 222], [161, -21, 229], [162, -21, 273], [164, -21, 292], [168, -22, 297],
# [173, -23, 308], [177, -23, 315], [181, -23, 323], [183, -23, 330], [185, -23, 337], [186, -23, 346],
# [187, -23, 353], [188, -23, 403], [189, -24, 414], [190, -24, 424], [191, -24, 430], [193, -24, 440],
# [193, -24, 450], [195, -24, 455], [197, -25, 462], [199, -25, 471], [201, -25, 475], [205, -25, 484],
# [206, -26, 493], [209, -26, 500], [210, -26, 509], [211, -26, 591], [213, -26, 602], [213, -27, 621],
# [214, -27, 628], [215, -27, 694], [216, -27, 702], [217, -27, 749], [217, -27, 764], [219, -27, 773],
# [220, -27, 789], [221, -27, 796], [222, -26, 995], [223, -25, 1263], [224, -25, 1283], [225, -25, 1290],
# [225, -24, 1793], [225, -23, 1800], [225, -23, 1808], [226, -23, 2165]],
# 189: [[5, 2, 86], [13, 2, 97], [22, 3, 104], [33, 3, 113], [44, 3, 118], [54, 3, 123], [66, 4, 132],
# [74, 4, 142],
# [80, 4, 148], [85, 4, 157], [88, 4, 164], [88, 5, 174], [90, 5, 180], [91, 5, 187], [92, 5, 204],
# [95, 4, 211],
# [99, 4, 218], [104, 3, 227], [109, 3, 234], [116, 3, 244], [123, 3, 250], [128, 3, 258], [132, 3, 265],
# [135, 3, 274], [136, 3, 280], [136, 3, 332], [138, 3, 347], [144, 3, 354], [152, 3, 363], [160, 3, 371],
# [165, 3, 380], [167, 4, 389], [168, 5, 392], [168, 6, 553], [170, 6, 561], [171, 6, 568], [172, 6, 575],
# [173, 6, 678], [174, 7, 739], [175, 8, 750], [176, 8, 762], [176, 9, 837], [178, 10, 852], [180, 10, 860],
# [182, 10, 867], [184, 11, 875], [187, 11, 883], [188, 12, 892], [188, 13, 1070], [189, 13, 1080]]
# }
# for track in test_track.values():
# draw_line_chart(track)
track, dis = get_track(260)
draw_line_chart(track)
修改yiduSlider.py,验证滑块,其中dt参数是api/v2/getconf请求返回的,token是每次获取验证码api/v3/get时响应返回的。这里就不破解知乎的登录了,有兴趣的可以自己尝试下