加速乐(__jsl_clearance_s)逆向实战

111次阅读
没有评论

共计 2049 个字符,预计需要花费 6 分钟才能阅读完成。

内容纲要

反正是人均系列,直接丢代码
原理就简单写下,第一次返回一段 js,很简单,直接 eval 就能拿到新的一个 ck,然后返回一大段 js,实际上就是 md5 之类的计算,然后重新请求即可拿到
这个图片直接从网上复制的,讲究看吧
加速乐 (__jsl_clearance_s) 逆向实战
以下代码仅供学习使用,

import requests,re,json,hashlib,urllib3,execjs
urllib3.disable_warnings()
session = requests.Session()
url='url'
headers = {
    'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7',
    'Accept-Language': 'zh-CN,zh;q=0.9',
    'Cache-Control': 'no-cache',
    'Connection': 'keep-alive',
    'Pragma': 'no-cache',
    'Sec-Fetch-Dest': 'document',
    'Sec-Fetch-Mode': 'navigate',
    'Sec-Fetch-Site': 'same-origin',
    'Upgrade-Insecure-Requests': '1',
    'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/111.0.0.0 Safari/537.36',
    'sec-ch-ua': '"Google Chrome";v="111", "Not(A:Brand";v="8", "Chromium";v="111"',
    'sec-ch-ua-mobile': '?0',
    'sec-ch-ua-platform': '"Windows"',
}
cookies={}
def get_twice_clearance(chars, bts, ha, ct):
    for _, char1 in enumerate(chars):
          for __, char2 in enumerate(chars):
            clearance = bts[0] + char1 + char2 + bts[1]
            if ha == "md5":
                yz = hashlib.md5(clearance.encode('utf-8')).hexdigest()
            elif ha == "sha1":
                yz = hashlib.sha1(clearance.encode()).hexdigest()
            elif ha == "sha256":
                encrypt = hashlib.sha256()
                encrypt.update(clearance.encode("utf-8"))
                yz=encrypt.hexdigest()
            if yz == ct:
                return clearance
def get_third_cookie():
    resp_first = session.get(url=url, headers=headers,verify=False)
    cookies.update(resp_first.cookies)
    content_first = re.findall('cookie=(.*?);location', resp_first.text)[0]
    jsl_clearance_s = execjs.eval(content_first).split(';')[0]
    cookies['__jsl_clearance_s'] = jsl_clearance_s.split("=")[1]
    resp_second = session.get(url=url, headers=headers, cookies=cookies,verify=False)
    go_params = re.findall(';go\((.*?)\)</script>', resp_second.text)[0]
    do_dict = json.loads(go_params)
    third_cookie = get_twice_clearance(chars=do_dict['chars'], bts=do_dict['bts'], ha=do_dict['ha'], ct=do_dict['ct'])
    third_cookies={'__jsl_clearance_s':third_cookie}
    cookies.update(third_cookies)

def main():
    get_third_cookie()
    resp_2 = session.get(url=url, headers=headers, cookies=cookies,verify=False)
    print(resp_2)

if __name__ == '__main__':
    main()
正文完
 0
bgspider
版权声明:本站原创文章,由 bgspider 于2024-05-07发表,共计2049字。
转载说明:除特殊说明外本站文章皆由CC-4.0协议发布,转载请注明出处。