From cf92814f1d7d82030a52e2d4c4c2e24d4b0e2341 Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Wed, 8 Jul 2020 18:16:28 +0300 Subject: [PATCH 01/10] Update readme_template.md --- readme_template.md | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/readme_template.md b/readme_template.md index 00f12807f..954be6fb2 100644 --- a/readme_template.md +++ b/readme_template.md @@ -1,7 +1,8 @@ ---- **Take Note!** -- This version of the Hosts file generator, and tests, are for Python 3.5+ only. -- With the exception of issues and PRs regarding changes to `hosts/data/StevenBlack/hosts`, all other issues regarding the content of the produced hosts files should be made with the appropriate data source that contributed the content in question. The contact information for all of the data sources can be found in the `hosts/data/` directory. + +* This version of the Hosts file generator, and tests, are for Python 3.5+ only. +* With the exception of issues and PRs regarding changes to `hosts/data/StevenBlack/hosts`, all other issues regarding the content of the produced hosts files should be made with the appropriate data source that contributed the content in question. The contact information for all of the data sources can be found in the `hosts/data/` directory. ---- ![Logo](https://raw.githubusercontent.com/StevenBlack/hosts/master/.github/logo.png) @@ -155,15 +156,18 @@ to remove hosts from the generated hosts file. #### Using NixOS: To install hosts file on your machine add the following into your `configuration.nix`: -```haskell - networking.extraHosts = let + +```nix +{ + networking.extraHosts = let hostsPath = https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts; hostsFile = builtins.fetchurl hostsPath; in builtins.readFile "${hostsFile}"; +} ``` -* NOTE: Change `hostsPath` if you need other versions of hosts file. -* NOTE: The call to `fetchurl` is impure. +* NOTE: Change `hostsPath` if you need other versions of hosts file. +* NOTE: The call to `fetchurl` is impure. Use `fetchFromGitHub` with the exact commit if you want to always get the same result. From 43fe30181b104d59382e2454114a29289fdf6cf9 Mon Sep 17 00:00:00 2001 From: Max G Date: Fri, 10 Jul 2020 22:47:47 +0300 Subject: [PATCH 02/10] Check if a service is running (Fixed #1337) --- updateHostsFile.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/updateHostsFile.py b/updateHostsFile.py index 8eaff1717..a2f09ebd9 100644 --- a/updateHostsFile.py +++ b/updateHostsFile.py @@ -1306,6 +1306,9 @@ def flush_dns_cache(): ) if os.path.isfile(service_file): + if 0 != subprocess.call([systemctl, "status", service], + stdout=subprocess.DEVNULL): + continue dns_cache_found = True if subprocess.call(SUDO + [systemctl, "restart", service]): From 9e3db93d92e7cbb13b3674cb9d58e4a3ad417857 Mon Sep 17 00:00:00 2001 From: Max G Date: Fri, 10 Jul 2020 23:43:09 +0300 Subject: [PATCH 03/10] Updated test --- testUpdateHostsFile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testUpdateHostsFile.py b/testUpdateHostsFile.py index 62616dbc9..8a3b4e49d 100644 --- a/testUpdateHostsFile.py +++ b/testUpdateHostsFile.py @@ -1324,7 +1324,7 @@ class TestFlushDnsCache(BaseStdout): self.assertIn(expected, output) @mock.patch("os.path.isfile", side_effect=[True, False, False, True] + [False] * 10) - @mock.patch("subprocess.call", side_effect=[1, 0]) + @mock.patch("subprocess.call", side_effect=[1, 0, 0]) def test_flush_posix_fail_then_succeed(self, *_): with self.mock_property("platform.system") as obj: obj.return_value = "Linux" From bb1b8e81aeccdb2715b905abf959265da13636b4 Mon Sep 17 00:00:00 2001 From: Max G Date: Fri, 10 Jul 2020 23:48:36 +0300 Subject: [PATCH 04/10] Check if a service has already been restarted (Fixes #1338) --- updateHostsFile.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/updateHostsFile.py b/updateHostsFile.py index 8eaff1717..34c7032ad 100644 --- a/updateHostsFile.py +++ b/updateHostsFile.py @@ -1293,6 +1293,7 @@ def flush_dns_cache(): system_prefixes = ["/usr", ""] service_types = ["NetworkManager", "wicd", "dnsmasq", "networking"] + restarted_services = [] for system_prefix in system_prefixes: systemctl = system_prefix + "/bin/systemctl" @@ -1300,6 +1301,9 @@ def flush_dns_cache(): for service_type in service_types: service = service_type + ".service" + if service in restarted_services: + continue + service_file = path_join_robust(system_dir, service) service_msg = ( "Flushing the DNS cache by restarting " + service + " {result}" @@ -1312,6 +1316,7 @@ def flush_dns_cache(): print_failure(service_msg.format(result="failed")) else: print_success(service_msg.format(result="succeeded")) + restarted_services += [service] dns_clean_file = "/etc/init.d/dns-clean" dns_clean_msg = "Flushing the DNS cache via dns-clean executable {result}" From aa5637dc7fc2fc375a63c6f02943f78ebee24caa Mon Sep 17 00:00:00 2001 From: Steven Black Date: Fri, 10 Jul 2020 19:13:15 -0400 Subject: [PATCH 05/10] Added four new domains from Issue #1335. --- data/StevenBlack/hosts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/data/StevenBlack/hosts b/data/StevenBlack/hosts index 8ade1e348..ec916b547 100644 --- a/data/StevenBlack/hosts +++ b/data/StevenBlack/hosts @@ -2818,4 +2818,10 @@ # Added July 8, 2020 0.0.0.0 runative-syndicate.com -0.0.0.0 www.protectmobiletechieai.club \ No newline at end of file +0.0.0.0 www.protectmobiletechieai.club + +# Added July 10, 2020 +0.0.0.0 xad.dnoticias.pt +0.0.0.0 ad.dnoticias.pt +0.0.0.0 advert.puzzles.mkjigsaw.com +0.0.0.0 adtracker.mkjigsaw.com From be57b6208bd2b14e64ba1aa6e47a4ba9b01a05e3 Mon Sep 17 00:00:00 2001 From: Steven Black Date: Fri, 10 Jul 2020 19:21:18 -0400 Subject: [PATCH 06/10] Add one domain from Issue #1343. --- data/StevenBlack/hosts | 1 + 1 file changed, 1 insertion(+) diff --git a/data/StevenBlack/hosts b/data/StevenBlack/hosts index ec916b547..e31765d70 100644 --- a/data/StevenBlack/hosts +++ b/data/StevenBlack/hosts @@ -2825,3 +2825,4 @@ 0.0.0.0 ad.dnoticias.pt 0.0.0.0 advert.puzzles.mkjigsaw.com 0.0.0.0 adtracker.mkjigsaw.com +0.0.0.0 dadsats.com From 12ee4e0218955f76409c09399f115ba4bf3afa1a Mon Sep 17 00:00:00 2001 From: Max G Date: Sat, 11 Jul 2020 13:37:08 +0300 Subject: [PATCH 07/10] Changed to .append() as requested --- updateHostsFile.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/updateHostsFile.py b/updateHostsFile.py index 34c7032ad..d74375433 100644 --- a/updateHostsFile.py +++ b/updateHostsFile.py @@ -1316,7 +1316,7 @@ def flush_dns_cache(): print_failure(service_msg.format(result="failed")) else: print_success(service_msg.format(result="succeeded")) - restarted_services += [service] + restarted_services.append(service) dns_clean_file = "/etc/init.d/dns-clean" dns_clean_msg = "Flushing the DNS cache via dns-clean executable {result}" From 4f93a59b8bf4d15d98d42801e279a12c21105f7f Mon Sep 17 00:00:00 2001 From: Steven Black Date: Sat, 11 Jul 2020 22:49:51 -0400 Subject: [PATCH 08/10] Issue #1346: add Fathom CDN. --- data/StevenBlack/hosts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/data/StevenBlack/hosts b/data/StevenBlack/hosts index e31765d70..5db770e10 100644 --- a/data/StevenBlack/hosts +++ b/data/StevenBlack/hosts @@ -2826,3 +2826,6 @@ 0.0.0.0 advert.puzzles.mkjigsaw.com 0.0.0.0 adtracker.mkjigsaw.com 0.0.0.0 dadsats.com + +# Added July 10, 2020 +0.0.0.0 cdn.usefathom.com \ No newline at end of file From de3a3d9cb95635fd4b6f34dac3b1e9cb9faf01bb Mon Sep 17 00:00:00 2001 From: Steven Black Date: Sun, 12 Jul 2020 12:46:26 -0400 Subject: [PATCH 09/10] Issue #1346: add CNAME aliases for fathomseo.com. --- data/StevenBlack/hosts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/data/StevenBlack/hosts b/data/StevenBlack/hosts index 5db770e10..b7822e200 100644 --- a/data/StevenBlack/hosts +++ b/data/StevenBlack/hosts @@ -2828,4 +2828,9 @@ 0.0.0.0 dadsats.com # Added July 10, 2020 -0.0.0.0 cdn.usefathom.com \ No newline at end of file +0.0.0.0 cdn.usefathom.com + +# Added July 12, 2020 +0.0.0.0 calltracking.fathomseo.com +0.0.0.0 adtrack.voicestar.com +0.0.0.0 wildcard.directtrack.com.wipext.digitalriverws.com \ No newline at end of file From aea2e921b570dc48911ff13546807b2b7e36fc35 Mon Sep 17 00:00:00 2001 From: Steven Black Date: Sun, 12 Jul 2020 12:49:07 -0400 Subject: [PATCH 10/10] Issue #1346: add domains from usefathom.com. --- data/StevenBlack/hosts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/data/StevenBlack/hosts b/data/StevenBlack/hosts index b7822e200..d801bfa57 100644 --- a/data/StevenBlack/hosts +++ b/data/StevenBlack/hosts @@ -2833,4 +2833,16 @@ # Added July 12, 2020 0.0.0.0 calltracking.fathomseo.com 0.0.0.0 adtrack.voicestar.com -0.0.0.0 wildcard.directtrack.com.wipext.digitalriverws.com \ No newline at end of file +0.0.0.0 wildcard.directtrack.com.wipext.digitalriverws.com +0.0.0.0 collect.usefathom.com +0.0.0.0 img3.usefathom.com +0.0.0.0 akr.usesfathom.com +0.0.0.0 archsmarter.usesfathom.com +0.0.0.0 butshesagirl.usesfathom.com +0.0.0.0 gateguardian.usesfathom.com +0.0.0.0 jsfiddle.usesfathom.com +0.0.0.0 justin.usesfathom.com +0.0.0.0 paleoleap.usesfathom.com +0.0.0.0 perroverde.usesfathom.com +0.0.0.0 stats.usesfathom.com +0.0.0.0 d3lvir7538n0oi.cloudfront.net \ No newline at end of file