How to differentiate between connected devices?

I have created a plugin, in it I process the

def response(self, flow: mitmproxy.http.HTTPFlow):

callback. Everything works very well except I have no way of differentiating between connected devices.

Let’s say all I did was log the flow, the request and response to the console. If multiple devices are connected to the proxy, there is no way to know which traffic belongs to which device.

How could I solve this problem? Can I see what host the device used when connecting to the proxy? If one device sets up device1.mitmproxy.mydomain.com as its proxy and the other sets up device2.mitmproxy.mydomain.com, is there a way for me to retrieve that host information when processing the flow in my addon?

Alternatively, could authentication be used? If I start it with the --proxyauth option, could I retrieve user information when processing the flow in my addon?

Alternatively, can you think of any other way how I could uniquely attribute traffic to devices?

1 Like

I’d be very interested in any thoughts around this. I have the same need and had wondered whether I could make each user connect to the proxy through a different port. I don’t believe this is possible when running on a windows device

What about looking at flow.client_conn ? (assuming each device has different IP)

Won’t work for my particular case. I’m firing up webdriver instances so they have the same IP