# How to ignore everything but a list of IPs/domains and their subdomains in transparent mode?

**URL:** <https://discourse.mitmproxy.org/t/how-to-ignore-everything-but-a-list-of-ips-domains-and-their-subdomains-in-transparent-mode/871>\
**Category:** help\
**Created:** [February 23, 2018, 10:32pm UTC](https://discourse.mitmproxy.org/t/how-to-ignore-everything-but-a-list-of-ips-domains-and-their-subdomains-in-transparent-mode/871 "2018-02-23T22:32:50Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![blacktable](https://avatars.discourse-cdn.com/v4/letter/b/f19dbf/32.png) [@blacktable](https://discourse.mitmproxy.org/u/blacktable)\
**Post date:** [February 23, 2018, 10:32pm UTC](https://discourse.mitmproxy.org/t/how-to-ignore-everything-but-a-list-of-ips-domains-and-their-subdomains-in-transparent-mode/871/1 "2018-02-23T22:32:51Z")

</div>

The documentation at [https://mitmproxy.readthedocs.io/en/v2.0.2/features/passthrough.html#tutorial](https://mitmproxy.readthedocs.io/en/v2.0.2/features/passthrough.html#tutorial) was not helpful.

I tried combinations of `--ignore '(?!<domain or ip>|<domain2 or ip2>)'` and `--ignore '(?!<domain or ip>)(?!<domain2 or ip2>)'`, with and without leading `^` but no luck.

How do I ignore everything but a specific list of IPs or (sub)domains in transparent mode? Using v2.0.2

Just to add that `^(?!(.*)?\.?domain1\.com|(.*)?\.?domain2\.com).*$` matches everything but those two domains on [regex101.com](http://regex101.com) using the Python engine, but doesn’t seem to when used in mitmproxy with `--ignore '<regex>'`

---

<div class="post-metadata">

**Author:** ![mhils](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mitmproxy.org/mhils/32/7_2.png) [@mhils](https://discourse.mitmproxy.org/u/mhils)\
**Post date:** [February 24, 2018, 10:46am UTC](https://discourse.mitmproxy.org/t/how-to-ignore-everything-but-a-list-of-ips-domains-and-their-subdomains-in-transparent-mode/871/2 "2018-02-24T10:46:04Z")

</div>

What do you see in your mitmproxy event log?

---

<div class="post-metadata">

**Author:** ![blacktable](https://avatars.discourse-cdn.com/v4/letter/b/f19dbf/32.png) [@blacktable](https://discourse.mitmproxy.org/u/blacktable)\
**Post date:** [February 24, 2018, 3:09pm UTC](https://discourse.mitmproxy.org/t/how-to-ignore-everything-but-a-list-of-ips-domains-and-their-subdomains-in-transparent-mode/871/3 "2018-02-24T15:09:10Z")

</div>

Lots of `clientconnect` and `clientdisconnect` from the proxied device’s IP

 ![Screenshot%20from%202018-02-24%2010-08-27](https://canada1.discourse-cdn.com/flex030/uploads/mitmproxy1/original/1X/d266a235a3877c0b0f4b909f34821c63ef2de158.png)

---

<div class="post-metadata">

**Author:** ![mhils](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mitmproxy.org/mhils/32/7_2.png) [@mhils](https://discourse.mitmproxy.org/u/mhils)\
**Post date:** [February 24, 2018, 3:21pm UTC](https://discourse.mitmproxy.org/t/how-to-ignore-everything-but-a-list-of-ips-domains-and-their-subdomains-in-transparent-mode/871/4 "2018-02-24T15:21:48Z")

</div>

If you increase the verbosity a bit, you should see which string the pattern is matched on.

---

<div class="post-metadata">

**Author:** ![blacktable](https://avatars.discourse-cdn.com/v4/letter/b/f19dbf/32.png) [@blacktable](https://discourse.mitmproxy.org/u/blacktable)\
**Post date:** [February 24, 2018, 3:42pm UTC](https://discourse.mitmproxy.org/t/how-to-ignore-everything-but-a-list-of-ips-domains-and-their-subdomains-in-transparent-mode/871/5 "2018-02-24T15:42:21Z")

</div>

I don’t know how to make sense of it. starting it with `--verbose` adds `-> <ip>:443` for some IPs in the Event Log. What do I get from this, and how do I know if that means it’s a match or not?

---

<div class="post-metadata">

**Author:** ![mhils](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mitmproxy.org/mhils/32/7_2.png) [@mhils](https://discourse.mitmproxy.org/u/mhils)\
**Post date:** [February 25, 2018, 3:58pm UTC](https://discourse.mitmproxy.org/t/how-to-ignore-everything-but-a-list-of-ips-domains-and-their-subdomains-in-transparent-mode/871/6 "2018-02-25T15:58:03Z")

</div>

This is from the tutorial on [https://mitmproxy.org/docs/latest/howto-ignoredomains/#tutorial](https://mitmproxy.org/docs/latest/howto-ignoredomains/#tutorial) - The string displayed here is the string we’re matching on. You can use this as your testcase to see if your pattern is correct.

---

<div class="post-metadata">

**Author:** ![kennylbj](https://avatars.discourse-cdn.com/v4/letter/k/ac8455/32.png) [@kennylbj](https://discourse.mitmproxy.org/u/kennylbj)\
**Post date:** [August 9, 2019, 8:09am UTC](https://discourse.mitmproxy.org/t/how-to-ignore-everything-but-a-list-of-ips-domains-and-their-subdomains-in-transparent-mode/871/7 "2019-08-09T08:09:11Z")

</div>

Is there a way to ignore/disable clientconnect and clientdisconnect log in consolo?
