应该是年前最后一篇文章了,这次逆向的是头条的_signature
案例链接
一、定位加密
1、直接搜索_signature
2、打断点进入S函数
3、在S函数中得知_signature由window.byted_acrawler.sign此生成
4、跟进window.byted_acrawler.sign进入acrawler.js文件中
二、补环境
1、补获取signature的函数
function get_signature(url_) {
return window.byted_acrawler.sign({url: url_})
}
console.log(get_signature('/api/pc/list/feed?channel_id=3189398984&max_behot_time=1643182598&category=pc_profile_channel&aid=24&app_name=toutiao_web'))
2、补window
window = global;
3、补referrer
window.document = {
referrer: ''
};
4、补href
location = {
href: 'https://www.toutiao.com/?wid=1641423780855'
};
5、补protocol
location = {
href: 'https://www.toutiao.com/?wid=1641423780855',
protocol: 'https'
};
6、补navigator
navigator = {
userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.99 Safari/537.36'
};
7、补cookie,可有可无
document.cookie = 'csrftoken=55898f8fba708a9885c9f952efeaeb86; __ac_signature=_02B4Z6wo00f012XavQwAAIDCm5bBP7WH6KNl.rmAALjm6UZwj5nNL9iDoZwydCnUe2uOwb--5m3yPL6pxQ3N97h6fZU47Os6n28eAhM7FJ5EU82kkPdDgGokyvqiJKKogrgX1388pHKNKERrb6; local_city_cache=%E4%B8%8A%E6%B5%B7; s_v_web_id=verify_kyv7w73n_j9aTG5YI_9wh3_4HmA_A8Cz_X5knRXvsl8vu; _tea_utm_cache_24=undefined; __feed_out_channel_key=fashion; tt_scid=700dTRQcFIejYXwekpMoIdGyowxAkT7mDWitCnl-IJMz-xs3-XGbh3dkLnKHn20Sae03; MONITOR_WEB_ID=7028548156813182500';