问题
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:
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.
来源:https://stackoverflow.com/questions/52312857/mitmproxy-how-to-remove-flows-so-they-do-not-show-up-in-mitmweb