我試圖實現(xiàn)一個mitmproxy插件腳本,以篡改特定的https數(shù)據(jù)包數(shù)據(jù)-通過mitmproxy的證書注入動態(tài)解密。我正在遵循一個類似問題的Stack Overflow答案以及mitmproxy docs的本教程,但到目前為止沒有任何成功。我定位的數(shù)據(jù)包來自https://api.example.com/api/v1/user/info?,F(xiàn)在這是我寫的整個python腳本,目的是基于上述資源來篡改該數(shù)據(jù)包數(shù)據(jù):from mitmproxy import ctxclass RespModif: def _init_(self): self.num = 0 def response(self, flow): ctx.log.info("RespModif triggered") if flow.request.url == "https://api.example.com/api/v1/user/info": ctx.log.info("RespModif triggered -- In the if statement") self.num = self.num + 1 ctx.log.info("RespModif -- Proceeded to %d response modifications " "of the targetted URLs" % self.num)addons = [ RespModif()]查看事件日志,我能夠看到第一個日志信息(“ RespModif觸發(fā)”)正在報告到日志中,但是if從不報告其他兩個日志信息(從語句內(nèi)部完成),這意味著我認為if聲明永遠不會成功。我的代碼有問題嗎?我如何獲得if成功的陳述?PS:目標URL絕對是正確的,另外,我將它與來自客戶端應(yīng)用程序的注冊帳戶一起使用,該帳戶正被mitmproxy嗅探到。
使用mitmproxy即時修改HTTPS響應(yīng)數(shù)據(jù)包
慕碼人8056858
2021-05-14 15:18:46
