Many commands in mitmproxy and mitmdump take a filter expression. Filter expressions consist of the following operators:
| ~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 |
| ~e | Match error |
| ~h regex | Header |
| ~hq regex | Request header |
| ~hs regex | Response header |
| ~m regex | Method |
| ~q | Match request with no response |
| ~s | Match response |
| ~t regex | Content-type header |
| ~tq regex | Request Content-Type header |
| ~ts regex | Response Content-Type header |
| ~u regex | URL |
| ! | unary not |
| & | and |
| | | or |
| (...) | grouping |
URL containing "google.com":
google\.com
Requests whose body contains the string "test":
~q ~b test
Anything but requests with a text/html content type:
!(~q & ~t \"text/html\")