mitmproxy的过滤表达式(四)

本文介绍mitmproxy和mitmdump中使用的过滤器表达式语法,包括各种表达式的含义及使用示例,如匹配特定响应代码、域名、方法等。

Filter expressions

mitmproxymitmdump中的许多命令都采用过滤器表达式。过滤器表达式由以下运算符组成:

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
  • 正则表达式是Python风格的
  • 正则表达式可以指定为引用的字符串
  • 标题匹配(〜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")
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值