破解__jsluid_s 和 __jsl_clearance_s加密参数
def get_cookies():
headers = {
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3',
'Upgrade-Insecure-Requests': '1',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/75.0.3770.142 Safari/537.36',
}
url1 = 'https://zwgk.hefei.gov.cn/public/column/1741?type=4&action=list&nav=&sub=&catId=6712341'
r1 = requests.get(url1, headers=headers, verify=False)
js = r1.text
js = js.replace('<script>document.cookie=', '').replace(';location.href=location.pathname+location.search</script>',
'')
result = execjs.eval(js)
__jsluid_h = r1.headers['Set-Cookie']
__jsl_clearance = result
cookies = {
'__jsluid_s': __jsluid_h.replace('__jsluid_s=', ''),
'__jsl_clearance_s': __jsl_clearance.replace('__jsl_clearance_s=', '')
}
url2 = 'https://zwgk.hefei.gov.cn/public/column/1741?type=4&action=list&nav=&sub=&catId=6712341'
r2 = requests.get(url2, headers=headers, verify=False, cookies=cookies)
data_org = re.findall(';go(.*)</script>', r2.text)[0]
data = data_org.replace('(', '').replace(')', '')
data = json.loads(data)
bts = data['bts']
chars = data['chars']
ct = data['ct']
ha = data['ha']
# vt = data['vt']
counti = 0
countj = 0
if ha == 'sha256':
print('加密算法-' + ha)
for i in range(len(bts[0])):
for j in range(len(chars)):
cookieTemp = bts[0] + chars[i] + chars[j] + bts[1]
if get_hash256(cookieTemp) == ct:
counti = i
countj = j
break
elif ha == 'sha1':
print('加密算法-' + ha)
for i in range(len(bts[0])):
for j in range(len(chars)):
cookieTemp = bts[0] + chars[i] + chars[j] + bts[1]
if get_hashsha1(cookieTemp) == ct:
counti = i
countj = j
break
elif ha == 'md5':
print('加密算法-' + ha)
for i in range(len(bts[0])):
for j in range(len(chars)):
cookieTemp = bts[0] + chars[i] + chars[j] + bts[1]
if get_hashmd5(cookieTemp) == ct:
counti = i
countj = j
break
__jsl_clearance = bts[0] + chars[counti] + chars[countj] + bts[1]
new_cookies = {
'__jsluid_s': __jsluid_h.replace('__jsluid_s=', '').replace(
'max-age=31536000; path=/; HttpOnly; SameSite=None; secure', ''),
'__jsl_clearance_s': __jsl_clearance,
}
result_cookies = '__jsluid_s={}; __jsl_clearance_s={}'.format(new_cookies['__jsluid_s'],
new_cookies['__jsl_clearance_s'])
return result_cookies