mitmproxy的过滤表达式(四)

来源:互联网 发布:遗传算法 船舶调度 编辑:程序博客网 时间:2024/06/08 12:25

Filter expressions

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

ExpressionDescription~aMatch asset in response: CSS, Javascript, Flash, images.~b regexBody~bq regexRequest body~bs regexResponse body~c intHTTP response code~d regexDomain~dst regexMatch destination address~eMatch error~h regexHeader~hq regexRequest header~hs regexResponse header~httpMatch HTTP flows~m regexMethod~markedMatch marked flows~qMatch request with no response~sMatch response~src regexMatch source address~t regexContent-type header~tcpMatch TCP flows~tq regexRequest Content-Type header~ts regexResponse Content-Type header~u regexURL~websocketMatch 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")
原创粉丝点击