巨潮资讯

抓取网址:https://webapi.cninfo.com.cn/#/marketDataDate

抓取目标:影片相关信息

image-20240903093622569

网页分析

打开网页后,按F12打开开发者工具,然后切换时间。

image-20240903093848076

对接口进行分析,存在加密字段

image-20240903093939266

交叉搜索定位关键字位置(增加一个路径)

image-20240903094123327

image-20240903094239612

定位关键字

image-20240903094356752

跟步进入方法内部,发现有混淆

image-20240903094710870

传入ob解混淆网站进行解混淆

image-20240903094742097

将还原后的代码进行搜索AES or DES,我们发现是AES

image-20240903094616091

对代码进行扣取,还原

image-20240903101056766

当不使用Accept-EncKey 或者 Accept-EncKey 不对的时候,禁止访问

image-20240903100955782

image-20240903100719186

代码

  • js代码
const Cryptojs = require("E:\\WAWS_ENV\\nodejs\\node_modules\\crypto-js")

function aaa() {
var _0xa8f94c = Cryptojs.AES.encrypt(Cryptojs.enc.Utf8.parse(Math.floor(new Date().getTime() / 1000)), Cryptojs.enc.Utf8.parse("1234567887654321"), {
'iv': Cryptojs.enc.Utf8.parse("1234567887654321"),
'mode': Cryptojs.mode.CBC,
'padding': Cryptojs.pad.Pkcs7
});
return Cryptojs.enc.Base64.stringify(_0xa8f94c.ciphertext);
}

console.log(aaa())
  • python请求代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import requests
import execjs

t = execjs.compile(open('./kkdkdkd.js',"r",encoding='utf-8').read()).call('aaa')

cookies = {
'routeId': '.uc2',
'MALLSSID': '7A51366E497A586D356959664A68525A4F2F5841317450624E774942314D336D584C4167554A4F4B573267566778442F4831734667775935416C46676D4A416E',
'Hm_lvt_489bd07e99fbfc5f12cbb4145adb0a9b': '1725327254',
'HMACCOUNT': '0AC70A95D0007624',
'SL_G_WPT_TO': 'eo',
'SL_GWPT_Show_Hide_tmp': '1',
'SL_wptGlobTipTmp': '1',
'Hm_lpvt_489bd07e99fbfc5f12cbb4145adb0a9b': '1725327271',
}

headers = {
'Accept': '*/*',
# 'Accept-EncKey': t,
'Accept-EncKey': 'V9oo1dRhZZje1ZmMrmMEuw==',
'Accept-Language': 'zh-CN,zh;q=0.9',
'Cache-Control': 'no-cache',
'Connection': 'keep-alive',
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8',
# 'Cookie': 'routeId=.uc2; MALLSSID=7A51366E497A586D356959664A68525A4F2F5841317450624E774942314D336D584C4167554A4F4B573267566778442F4831734667775935416C46676D4A416E; Hm_lvt_489bd07e99fbfc5f12cbb4145adb0a9b=1725327254; HMACCOUNT=0AC70A95D0007624; SL_G_WPT_TO=eo; SL_GWPT_Show_Hide_tmp=1; SL_wptGlobTipTmp=1; Hm_lpvt_489bd07e99fbfc5f12cbb4145adb0a9b=1725327271',
'Origin': 'https://webapi.cninfo.com.cn',
'Pragma': 'no-cache',
'Referer': 'https://webapi.cninfo.com.cn/',
'Sec-Fetch-Dest': 'empty',
'Sec-Fetch-Mode': 'cors',
'Sec-Fetch-Site': 'same-origin',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/127.0.0.0 Safari/537.36',
'X-Requested-With': 'XMLHttpRequest',
'sec-ch-ua': '"Not)A;Brand";v="99", "Google Chrome";v="127", "Chromium";v="127"',
'sec-ch-ua-mobile': '?0',
'sec-ch-ua-platform': '"Windows"',
}

proxies = {
'http': '127.0.0.1:10792',
'https': '127.0.0.1:10792'
}

data = {
'tdate': '2024-08-28',
'market': 'SZE',
}

response = requests.post('https://webapi.cninfo.com.cn/api/sysapi/p_sysapi1007', cookies=cookies, headers=headers, data=data,proxies=proxies).json()
print(response)

结果

image-20240903101139361