# How to differentiate between connected devices?

**URL:** <https://discourse.mitmproxy.org/t/how-to-differentiate-between-connected-devices/1280>\
**Category:** help\
**Created:** [October 18, 2018, 3:02pm UTC](https://discourse.mitmproxy.org/t/how-to-differentiate-between-connected-devices/1280 "2018-10-18T15:02:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![draxler](https://avatars.discourse-cdn.com/v4/letter/d/73ab20/32.png) [@draxler](https://discourse.mitmproxy.org/u/draxler)\
**Post date:** [October 18, 2018, 3:02pm UTC](https://discourse.mitmproxy.org/t/how-to-differentiate-between-connected-devices/1280/1 "2018-10-18T15:02:44Z")

</div>

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](http://device1.mitmproxy.mydomain.com) as its proxy and the other sets up [device2.mitmproxy.mydomain.com](http://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?

---

<div class="post-metadata">

**Author:** ![Fraser1994](https://avatars.discourse-cdn.com/v4/letter/f/e68b1a/32.png) [@Fraser1994](https://discourse.mitmproxy.org/u/Fraser1994)\
**Post date:** [November 5, 2018, 12:48pm UTC](https://discourse.mitmproxy.org/t/how-to-differentiate-between-connected-devices/1280/2 "2018-11-05T12:48:21Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jokester](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mitmproxy.org/jokester/32/371_2.png) [@jokester](https://discourse.mitmproxy.org/u/jokester)\
**Post date:** [November 7, 2018, 6:42am UTC](https://discourse.mitmproxy.org/t/how-to-differentiate-between-connected-devices/1280/3 "2018-11-07T06:42:06Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Fraser1994](https://avatars.discourse-cdn.com/v4/letter/f/e68b1a/32.png) [@Fraser1994](https://discourse.mitmproxy.org/u/Fraser1994)\
**Post date:** [November 8, 2018, 3:54pm UTC](https://discourse.mitmproxy.org/t/how-to-differentiate-between-connected-devices/1280/4 "2018-11-08T15:54:58Z")

</div>

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