MITMProxy how to remove flows so they do not show

2019-08-28 08:07发布

I'd like to use MITMProxy Python scripting to remove flows that i find useless from the web interface.

Lets say i kill a flow

def request(flow):
        if("ads" in flow.request.url):
                flow.kill()

But also i would like killed connections to not show up in my MITMWeb interface.

An example can be found here: https://imgur.com/a/la0RDmh

I am unable to find a way programatically to delete the requests from the list.

I would only like to see the connections that make it through.

Any ideas?

1条回答
戒情不戒烟
2楼-- · 2019-08-28 09:07

Using filter

It's possible to filter out these requests and they won't appear in interface: https://docs.mitmproxy.org/stable/concepts-filters/

In this case, by applying filter: ! googleadservices

Using ignore_hosts option

Or, using option ignore_hosts to ignore these requests completely. These requests will bypass mitmproxy: https://docs.mitmproxy.org/stable/concepts-options/

In this case, by applying option when starting web interface: mitmweb --set ignore_hosts='www.googleadservices.com'

It's also possible to edit ignore hosts in web interface: Options tab -> Edit options -> find ignore hosts and modify it.

查看更多
登录 后发表回答