Filter expressions
mitmproxy和mitmdump中的許多命令都採用過濾器運算式。過濾器運算式由以下運算子組成: Expression Description ~a Match asset in response: CSS, Javascript, Flash, images. ~b regex Body ~bq regex Request body ~bs regex Response body ~c int HTTP response code ~d regex Domain ~dst regex Match destination address ~e Match error ~h regex Header ~hq regex Request header ~hs regex Response header ~http Match HTTP flows ~m regex Method ~marked Match marked flows ~q Match request with no response ~s Match response ~src regex Match source address ~t regex Content-type header ~tcp Match TCP flows ~tq regex Request Content-Type header ~ts regex Response Content-Type header ~u regex URL ~websocket Match WebSocket flows ! unary not & and | or (...) grouping Regex是Python風格的 Regex可以指定為引用的字串 標題匹配(〜h,〜hq,〜hs)與“name:value”形式的字串相反。 沒有運算子的字串與請求URL匹配。 預設的二進位運算子為&。 Examples
URL 包含“google.com”:
google\.com
請求的body包含“test”:
~q ~b test
Anything but requests with a text/html content type:
!(~q & ~t "text/html")