Post Reply 
external filters
Jan. 31, 2017, 08:31 AM (This post was last modified: Feb. 13, 2017 02:23 PM by Faxopita.)
Post: #6
RE: external filters
(Jan. 31, 2017 03:37 AM)cattleyavns Wrote:  
(Jan. 30, 2017 01:46 PM)kik0s Wrote:  edit:
is it possible to block like buttons with hosts file?

I'm pretty sure it is not possible with only the hosts file, "facebook.com/plugins/", hosts file can only block "facebook.com".

Years ago, when I wanted to use Privoxy alongside the hosts file, the latter was ignored. Apparently, it's either hosts file or Privoxy. Not both at the same time.

I confirm hosts file only blocks domains. However, you can use, at the same time, Privoxy and Unbound, for example, a local DNS resolver. It can be used to block domains too. That's your definite solution if my first one above offers you limited results. Note that like hosts file Unbound does not accept regular expressions.

Under this scenario, you could use Unbound to block domains (just like hosts) and Privoxy to block requests based on the path side of the URL.

To block a path (Privoxy):
Code:
{ + block{plug-ins} }
.facebook.com/plugins/

To block a domain (Unbound):
Code:
local-zone: "touchbymediametrie.com" redirect
local-data: "touchbymediametrie.com A 127.0.0.1"

Now, you should have the best of both worlds and enjoy a renewed experience with your computer.

-–—

Converting a hosts File into Unbound local-data

To convert StevenBlack's hosts file, for example, into Unbound local-data, you could issue the following command:
Code:
wget -O - https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts | grep '^0\.0\.0\.0' | \
awk '{print "local-zone: \""$2"\" redirect\nlocal-data: \""$2" A 0.0.0.0\""}' > unbound_blacklist.conf

Taken from here. I tested it and it works. Of course, you repeat with other source lists and amend the script accordingly.

An alternative way to do the conversion is provided by the script `unbound-block-hosts`.

Beware! Unbound hates duplicates; be sure to remove any duplicates. If you need to whitelist an entry, simply remove it from `unbound_blacklist.conf` and restart Unbound.

—–-

Another great way to block ad/tracking domains: using Unbound's void zones; explained here. The main advantage being that there's no need to input every subdomain of the ad/tracking domain.
Add Thank You Quote this message in a reply
[-] The following 1 user says Thank You to Faxopita for this post:
kik0s
Post Reply 


Messages In This Thread
external filters - kik0s - Jan. 29, 2017, 03:21 PM
RE: external filters - Faxopita - Jan. 29, 2017, 11:41 PM
RE: external filters - ryszardzonk - Jul. 16, 2018, 10:40 PM
RE: external filters - cattleyavns - Jan. 30, 2017, 05:13 AM
RE: external filters - kik0s - Jan. 30, 2017, 01:46 PM
RE: external filters - cattleyavns - Jan. 31, 2017, 03:37 AM
RE: external filters - Faxopita - Jan. 31, 2017 08:31 AM
RE: external filters - oldsod - May. 07, 2017, 04:08 AM
RE: external filters - kik0s - May. 07, 2017, 09:49 AM
RE: external filters - oldsod - May. 07, 2017, 04:08 PM
RE: external filters - oldsod - May. 07, 2017, 04:19 PM
RE: external filters - kik0s - May. 07, 2017, 04:28 PM
RE: external filters - ryszardzonk - Sep. 12, 2018, 10:41 AM

Forum Jump: