In the middle of all traffic passing through the proxy, only when a domain is accessed does the sniff. If it is not the domain “http://example.org/”, the sites can be processed without interception action.
import mitmproxy address = "example.org" def request(flow): if flow.request.host != address: print("THIS FLOW IS TRASH") make_disconnect_request(address) def make_disconnect_request(address): return HTTPRequest( "authority", b"DISCONNECT", None, None, None, None, b"HTTP/1.1", http.Headers(), b"" )
I know that sending a request asking to disconnect will not cause the other domains to stop going through the proxy, but the idea is to make those who do not act or even process the requests, they just follow their normal traffic as if they were not being sniffed.
Sry my english, i’m brazilian.