b站登录 极验点选验证码 +登录实现一套流程

声明

本文章中所有内容仅供学习交流使用,不用于其他任何目的,抓包内容、敏感网址、数据接口等均已做脱敏处理,严禁用于商业用途和非法用途,否则由此产生的一切后果均与作者无关!

训练部分实现代码

import hashlib

import cv2
import torch
from ultralytics import YOLO
from getonnx import preONNX
# 训练
# model = YOLO(model='E:/yolov8/ultralytics-main/runs/detect/train2/weights/best.pt',task='detect')
# model.train(data='dataset.yaml',epochs=128,cache=True,imgsz=320,batch=256)
# 导出
# model = YOLO(model='runs/detect/train3/weights/best.pt',task='detect')
# model.export(format='onnx', imgsz=160, simplify=True)
import json
import re
import time

import execjs
import requests
from PIL import Image

c = 1
targets = []
areas = []
def md5_encode(input_string):
    # 创建md5对象
    md5 = hashlib.md5()

    # 使用md5对象的update方法进行加密
    md5.update(input_string.encode('utf-8'))

    # 使用hexdigest()方法获取加密后的字符串
    return md5.hexdigest()
def is_target_in_area(target, area):
    target_x, target_y = target
    area_x1, area_y1, area_x2, area_y2 = area
    return area_x1 <= target_x <= area_x2 and area_y1 <= target_y <= area_y2
def add_white_background(image_path, output_path):
    # 打开图片
    img = Image.open(image_path).convert('RGBA')
    # 获取图片的大小
    width, height = img.size
    # 创建一个新的白色背景图片,大小与原图片相同
    white_background = Image.new('RGBA', (width, height), 'white')
    # 将原图片粘贴到白色背景图片上
    white_background.paste(img, (0, 0), img)
    # 保存新图片
    white_background.save(output_path)

 for que in ques:
    with open(f'./极验/{count}.png','wb') as fp:
         fp.write(session.get(url=f"https://static.geetest.com/{que}").content)
        print(f"https://static.geetest.com/{que}")
     add_white_background(f'./极验/{count}.png',f'./极验/{count}.png')
     count=count+1
 background_name=str(imgs).split("/")[-1]
 print(background_name)

model = YOLO(model='./best.pt', task='detect')
results = model.predict(source=f'ultralytics-main/dataSet/train/images/0e1647dd07af4497ada8c6b6e70e71d2.jpg', imgsz=160, save=True)
 results = model.predict(source=f'dataSet/train/images/e1cc73130d2b40eea038368eadc43b64.jpg', imgsz=160, save=True)
 print(results)
 for result in results:
     y8_detect_xy(result)
 main(background_name.split(".")[0])
 main('e1cc73130d2b40eea038368eadc43b64')
 result = {}
 for target in targets:
     for area in areas:
         if is_target_in_area(target[:2], area[:4]):
             result[area[-1]] = target[-1]
 print(result)

 pre = preONNX("siamese.onnx", providers=["CPUExecutionProvider"])



  Initialize an empty dictionary to store the matched image names
 matched_images = {}

  Continue matching until all images in the first list have a match
 while len(images) > 0:
     # Initialize the maximum similarity score and the pair of images
     max_score = 0
     max_pair = ()

     # Compare each image in the first list with each image in the second list
     for i in range(len(images)):
         for j in range(len(image2)):
             # Start the timer
             begin = time.time()

             # Run the inference
             prediction = pre.reason(images[i], image2[j])

           # # Print the similarity score
             # print(f"Similarity score between {images[i]} and {image2[j]}: {prediction}")

           # Check if the current score is greater than the maximum score
             if prediction > max_score:
                 max_score = prediction
                 max_pair = (images[i], image2[j])
 dict1 = result
 dict2 =matched_images
 # Initialize an empty dictionary to store the matched pairs
 matched_pairs = {}

 # Iterate over the items in the first dictionary
 for key1, value1 in dict1.items():
     # Iterate over the items in the second dictionary
     for key2, value2 in dict2.items():
         value2_last_part = key2[1].split("/")[-1]
        # Check if the keys match
         if key1 == value2_last_part:
             # Store the pair in the dictionary
             matched_pairs[key2[0]] = value1

逆向代码

var get_challenge = function () {
    return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
        var r = Math.random() * 16 | 0;
        var v = c === 'x' ? r : (r & 0x3 | 0x8);
        return v.toString(16);
    });
};

function getW(lot_number,pow_msg,pow_sign,userresponse) {
    key = ""
    e = {}
    n = _pp()
    _TT['prototype']['setPublic'](key, '10001')
    _ = _TT['prototype']['encrypt'](n)
    e = _ee.stringify(e)
    w = _ww(_nn.encrypt(e, n)) + _
    return w
}

结果

 点击返回url查看是否登录成功有头像即登录成功。

总结 

1.出于安全考虑,本章未提供完整流程,调试环节省略较多,只提供大致思路,具体细节要你自己还原,相信你也能调试出来。 

  • 6
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值