whistle查看抓包數(shù)據(jù)的頁面,可以添加賬號和密碼,只需要在啟動時,輸入?yún)?shù):
w2 start -p yourport -n yourusername -w yourpassword。
在進入頁面時,就需要鑒權(quán)了
代理接口需要授權(quán)
設(shè)備ip白名單:
一 按照插件 script:
安裝Node: 官網(wǎng)下載安裝最新版本(LTS和Stable都可以)
-
安裝最新版的whistle。
npm install -g whistle # Mac、Linux用戶可能需要加sudo sudo npm install -g whistle -
安裝script插件:
w2 i whistle.script
二 插件寫入校驗?zāi)_本

image.png

image.png
exports.auth = async (req, options) => {
// 給請求添加自定義頭,必須與 `x-whistle-` 開頭
// 這樣可以在插件的其他 hook 里面獲取到該請求頭(除了 http 請求的 reqRead 鉤子)
IPLIST=['xx.xx.xx.xx']
if(IPLIST.indexOf(req.clientIp)!=-1){
req.setHeader('x-whistle-test', '1111111111');
}else{
return false;
}
// return false; // 直接返回 403
};
三 規(guī)則中,加入腳本

image.png
收工~