当前位置:首页 > 编程笔记 > 正文
已解决

某网站cookies携带https_ydclearance获取正文

来自网友在路上 172872提问 提问时间:2023-10-24 07:44:27阅读次数: 72

最佳答案 问答题库728位专家为你答疑解惑

1、url

aHR0cHM6Ly9iYnMuNTFjcmVkaXQuY29tL3RocmVhZC03ODI0OTAzLTEtMS5odG1s

2、抓包

在这里插入图片描述

根据抓包返回的两个请求进行访问,发现获取正文需cookies携带https_ydclearance

cookies = {'https_ydclearance': '6973fc7d30e4fe01c1bdde9f-ff5e-4d22-bfc2-00e5ab7769b7-1698036076',
}

3、根据返回的第一个请求(521),代码请求url,返回内容如下:

<html><body><script language="javascript">window.onload = setTimeout("gu(62)", 200);function gu(VJ) {var qo, mo = "",no = "",oo = [0x70, 0x5a, 0x61, 0x4e, 0x7b, 0xa7, 0x26, 0x51, 0xdd, 0x2b, 0xbf, 0xac, 0x43, 0xaf, 0x1c, 0x08, 0xb3, 0xe0, 0xb3, 0xe9, 0x5d, 0x29, 0x78, 0xc5, 0x57, 0x26, 0x13, 0x7d, 0x2b, 0x78, 0xf0, 0xdb, 0x28, 0x53, 0xff, 0x0d, 0x7e, 0x29, 0xb5, 0xa2, 0xcd, 0x04, 0x9a, 0xc5, 0xdc, 0x12, 0x1d, 0xd3, 0x5c, 0xa7, 0x33, 0x2a, 0x75, 0x01, 0xa9, 0xa0, 0xb5, 0x4b, 0x38, 0x63, 0xac, 0xb7, 0xce, 0x83, 0x7a, 0xa5, 0xe6, 0xf1, 0xfe, 0xb4, 0x5f, 0x93, 0xd6, 0x4c, 0xa1, 0x77, 0xc4, 0xf8, 0x96, 0xeb, 0x77, 0x8e, 0xa3, 0xd7, 0xdc, 0xe7, 0xfe, 0xd3, 0xc0, 0xf4, 0xb9, 0xe6, 0x9c, 0xb1, 0x67, 0x74, 0x99, 0xf0, 0xc5, 0x9b, 0x48, 0x93, 0x37, 0x24, 0xfa, 0x2d, 0xe3, 0x79, 0xef, 0xa5, 0x7b, 0x52, 0xa7, 0x1d, 0x09, 0xdf, 0xb5, 0xcc, 0xc2, 0x95, 0x8f, 0xbc, 0x8a, 0x57, 0x03, 0x12, 0xd2, 0xfd, 0xec, 0x21, 0x49, 0xb5, 0x49, 0xd5, 0x2a, 0xfe, 0x14, 0x09, 0x8a, 0xbe, 0x25, 0x12, 0x5f, 0x93, 0xe2, 0xf7, 0xee, 0xc1, 0x98, 0x0e, 0x17, 0x2d, 0x84, 0xd9, 0xef, 0x45, 0x42, 0x57, 0x2c, 0x93, 0xbb, 0x05, 0xa7, 0x9d, 0x72, 0xbd, 0x2a, 0x56, 0xab, 0x58, 0x04, 0x90, 0xc6, 0x59, 0x52, 0x87, 0x3e, 0x29, 0x38, 0x63, 0xc4, 0x10, 0xbb, 0x09, 0x9d, 0x8a, 0x73, 0xdf, 0x0c, 0x02, 0xd6, 0xa3, 0xd7, 0x84, 0xd1, 0x9d, 0xd3, 0x48, 0xe7, 0xdd, 0xb2, 0x9b, 0xc8, 0xb3, 0x49, 0x78, 0x85, 0xb2, 0x26, 0x1c, 0x6b, 0xda, 0x86, 0x11, 0x5e, 0xca, 0x8f, 0xfe, 0x91, 0xde, 0x49, 0x36, 0xcb, 0xfa, 0x25, 0x52, 0xde, 0x2c, 0xeb, 0x80, 0xcc, 0x37, 0x24, 0xd0, 0x76, 0xc3, 0x6f, 0xdb, 0x68, 0x9e, 0xcc, 0x40, 0xb4, 0x02, 0xcd, 0xdc, 0x6d, 0x9a, 0x45, 0x92, 0xc6, 0x3c, 0xa6, 0x7c, 0x91, 0xe8, 0x9e, 0x73, 0x96, 0x8b, 0xbf, 0x76, 0xaa, 0x5f, 0x30, 0xc4, 0x90, 0xdd, 0x0a, 0x56, 0xfc, 0xc4, 0x3b];qo = "qo=271; do{oo[qo]=(-oo[qo])&0xff; oo[qo]=(((oo[qo]>>1)|((oo[qo]<<7)&0xff))-5)&0xff;} while(--qo>=2);";eval(qo);qo = 270;do {oo[qo] = (oo[qo] - oo[qo - 1]) & 0xff;} while (-- qo >= 3 );qo = 1;for (;;) {if (qo > 270) break;oo[qo] = ((((((oo[qo] + 89) & 0xff) + 242) & 0xff) << 4) & 0xff) | (((((oo[qo] + 89) & 0xff) + 242) & 0xff) >> 4);qo++;}po = "";for (qo = 1; qo < oo.length - 1; qo++) if (qo % 6) po += String.fromCharCode(oo[qo] ^ VJ);eval("qo=eval;qo(po);");}</script></body></html>

运行此段js结果如下,可知从第一次请求的返回中获取cookies

在这里插入图片描述
4、在python中运行js,获取cookies

# 取出js方法
js_hanShu = re.findall('(function .*?)</script>', response)[0]
print(js_hanShu)js_hanShu = str(js_hanShu).replace('eval("qo=eval;qo(po);")', 'return po')
js_run = execjs.compile(js_hanShu)                js_name = re.findall('setTimeout\("(.*?)\(', response)[0]
print('js_name:', js_name)
js_arg = re.findall('setTimeout\("\D+\((\d+)\)",', response)[0]
print('js_arg:', js_arg)dCookie = js_run.call(js_name, js_arg)
print(dCookie)ydclearance = re.findall('https_ydclearance=(.*?);', dCookie)[0]cookies = {'https_ydclearance': ydclearance,
}

5、带cookies再次请求即可获得正文
在这里插入图片描述

查看全文

99%的人还看了

猜你感兴趣

版权申明

本文"某网站cookies携带https_ydclearance获取正文":http://eshow365.cn/6-23134-0.html 内容来自互联网,请自行判断内容的正确性。如有侵权请联系我们,立即删除!