應(yīng)該是年前最后一篇文章了,這次逆向的是頭條的_signature
案例鏈接
一、定位加密
1、直接搜索_signature
2、打斷點進入S函數(shù)
3、在S函數(shù)中得知_signature由window.byted_acrawler.sign此生成
4、跟進window.byted_acrawler.sign進入acrawler.js文件中
二察署、補環(huán)境
1、補獲取signature的函數(shù)
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';