文章目录
逆向目标
- 网址:
https://y.qq.com/n/ryqq/album/3
- 接口:
https://u6.y.qq.com/cgi-bin/musics.fcg
- 参数:
sign
逆向分析
这里主要分析 新碟
类别下的接口,直接 Copy as cURL
转为 request
代码
分析测试后发现只有 sign
一个加密点
python
import requests
import json
headers = {
"accept": "application/json",
"content-type": "application/x-www-form-urlencoded",
"origin": "https://y.qq.com",
"referer": "https://y.qq.com/",
"user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/129.0.0.0 Safari/537.36"
}
url = "https://u6.y.qq.com/cgi-bin/musics.fcg"
params = {
"_": "1727234868757",
"sign": "zzcbbf59d7pla6a5ydbueoa23w3joa1cm8kkm97a37a49"
}
data = {
"comm": {
"cv": 4747474,
"ct": 24,
"format": "json",
"inCharset": "utf-8",
"outCharset": "utf-8",
"notice": 0,
"platform": "yqq.json",
"needNewCode": 1,
"uin": 0,
"g_tk_new_20200303": 5381,
"g_tk": 5381
},
"req_1": {
"module": "newalbum.NewAlbumServer",
"method": "get_new_album_info",
"param": {
"area": 2,
"start": 0,
"sin": 0,
"num": 20
}
}
}
data = json.dumps(data, separators=(',', ':'))
response = requests.post(url, headers=headers, cookies=None, params=params, data=data)
print(response.json())
可以看到依然会输出正确结果
逆向过程
sign
是 URL
参数加密,我们直接打个 XHR
断点,然后刷新下页面即可
如上图所示,跟栈分析向上一层就找到了加密的逻辑,直接跟进去看 n(350)
可以判断是 webpack
语法,加载器找到了,今天主要是给大家介绍一种工具的用法,这里就不手扣了,我们直接使用工具来处理 webpack
bash
-l 加载器的js路径
加载器的js特征:
1.以自执行函数开头
2.定义导出函数,类似 return e[n].call(r.exports, r, r.exports, d), r.l = !0, r.exports
3.为导出函数添加多个方法,类似d.e,d.m,d.n等等
-m 函数模块的js路径
函数模块的js特征:
1.一般以(window.webpackJsonp开头
-o 输入结果的js路径
我们按照如上的参数说明扣一下相关代码然后执行一下
javascript
node webpack_mixer.js -l runtime.js -m app.js -o webout.js
可以看到加密函数被导出了,我们拿网页上的数据来做下验证,网页上的加密逻辑是
javascript
var i, o = n(350).default;
i = o(t.data)
// 用于加密的字符串
'{"comm":{"cv":4747474,"ct":24,"format":"json","inCharset":"utf-8","outCharset":"utf-8","notice":0,"platform":"yqq.json","needNewCode":1,"uin":0,"g_tk_new_20200303":5381,"g_tk":5381},"req_1":{"module":"newalbum.NewAlbumServer","method":"get_new_album_info","param":{"area":3,"start":0,"sin":0,"num":20}}}'
我们本地加密下看看结果
逆向总结
工欲善其事,必先利其器,逆向分析过程中有一个好的工具,有时候能节省很多时间,今天的分享就到这了,希望对大家有所帮助