HOSTS file

For discussions about security.
Message
Author
musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#21 Post by musher0 »

FYI, there is a new mvps hosts file out, dated late March 2015.
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

Scooby
Posts: 599
Joined: Sat 03 Mar 2012, 09:04

#22 Post by Scooby »

When trying to find out why my comp didn't block ads despite /etc/hosts
I came across this

https://github.com/StevenBlack/hosts

Python script to keep an updated hosts file

Tried it when hacking in "other data" dir also
and got
Success! Your shiny new hosts file has been prepared.
It contains 740574 unique entries
That is several entries, puh

seems like it's mixing 127.0.0.1 and 0.0.0.0 entries though

Scooby
Posts: 599
Joined: Sat 03 Mar 2012, 09:04

#23 Post by Scooby »

Also blocking servers with hosts won't work with tor-browser
Tor does not use your local address resolving facilities because doing so would mean leaking the pages you request through Tor as DNS requests.

User avatar
mikeb
Posts: 11297
Joined: Thu 23 Nov 2006, 13:56

#24 Post by mikeb »

Also blocking servers with hosts won't work with tor-browser
you can set the browser to not use tor for dns requests... not for the purists of course.

mike

Scooby
Posts: 599
Joined: Sat 03 Mar 2012, 09:04

#25 Post by Scooby »

maybe better to use an ad-blocker addon but
that is also cited as a possible security hazard

Maybe not for the purists either?

User avatar
mikeb
Posts: 11297
Joined: Thu 23 Nov 2006, 13:56

#26 Post by mikeb »

I am impure.....

linuxcbon
Posts: 1312
Joined: Thu 09 Aug 2007, 22:54

#27 Post by linuxcbon »

Tor browser is out of topic. (Just to answer, it doesnt use hosts, because it uses its own dns. And using adblock or addons with tor is not good, because you never know what infos they could send about your pc etc. I even have doubts that tor is secure.).

s243a
Posts: 2580
Joined: Tue 02 Sep 2014, 04:48
Contact:

#28 Post by s243a »

linuxcbon wrote:Tor browser is out of topic. (Just to answer, it doesnt use hosts, because it uses its own dns. And using adblock or addons with tor is not good, because you never know what infos they could send about your pc etc. I even have doubts that tor is secure.).
If you request a page from the World wide web then they do have dns addresses. If the page has an onion address, then I don't see why you couldn't block a site based on an onion address. Tor lets you connect to it via a proxy such as a vpn, perhaps one could put a proxy between the browser and tor that would do hostfile type blocking based on addresses. Furthermore, I don't see why one couldn't use the hostfile for this filtering.

linuxcbon
Posts: 1312
Joined: Thu 09 Aug 2007, 22:54

#29 Post by linuxcbon »

@s243a you dont see why ? then find it out. I wont explain, it's out of topic and you can search and learn.

Scooby
Posts: 599
Joined: Sat 03 Mar 2012, 09:04

#30 Post by Scooby »

I don't agree. I think tor-browser regarding hosts file is on topic

Anyway as explained tor uses its own DNS solution because
its more anonymous that way.

another proxy seems complicated and since there is ad-blockers extensions
I would go this way

Guess I am not a purist either....

User avatar
mikeb
Posts: 11297
Joined: Thu 23 Nov 2006, 13:56

#31 Post by mikeb »

We are dealing with an impure internet and software world...this will affect the tactics used.

mike

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#32 Post by musher0 »

mikeb wrote:We are dealing with an impure internet and software world...this will affect the tactics used.

mike
Quite true, General. ;)
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

labbe5
Posts: 2159
Joined: Wed 13 Nov 2013, 14:26
Location: Canada

Block lists to prevent JavaScript miners

#33 Post by labbe5 »

https://github.com/hoshsadiq/adblock-nocoin-list

This is an adblock list to block "browser-based crypto mining".

For the blocking based on the HOSTS file use the below link:
https://raw.githubusercontent.com/hoshs ... /hosts.txt

Ctrl+S to save.

labbe5
Posts: 2159
Joined: Wed 13 Nov 2013, 14:26
Location: Canada

hblock

#34 Post by labbe5 »

https://github.com/hectorm/hblock

This POSIX-compliant shell script, designed for Unix-like systems, gets a list of domains that serve ads, tracking scripts and malware from multiple sources and creates a hosts file (alternative formats are also supported) that prevents your system from connecting to them.

Installation

curl -o /tmp/hblock 'https://raw.githubusercontent.com/hecto ... 1.3/hblock' \
&& echo '5aa752ceee6f4d10bdeab372ca557aefc3c7f32e4e10cceb4dddb3a86f6db4d3 /tmp/hblock' | shasum -c \
&& sudo mv /tmp/hblock /usr/local/bin/hblock \
&& sudo chown root:root /usr/local/bin/hblock \
&& sudo chmod 755 /usr/local/bin/hblock

Usage

In your terminal : hblock

Result :

116888 blocked domains.

Optional :

You can use this Systemd timer to regularly update the hosts file for new additions :
https://github.com/hectorm/hblock/blob/ ... /README.md

The following commands will schedule a daily update of the hosts file :

curl -o '/tmp/hblock.#1' 'https://raw.githubusercontent.com/hecto ... vice,timer}' \
&& echo '70964235a03152d4bc68096a0b99cc59e3f77595b99330f8c55dcca79d7164ff /tmp/hblock.service' | shasum -c \
&& echo '79ecc28c13b2489400bd5ddc0ee61ddaf6c3225acb1d54b5cb4026f822ae60e8 /tmp/hblock.timer' | shasum -c \
&& sudo mv /tmp/hblock.{service,timer} /etc/systemd/system/ \
&& sudo chown root:root /etc/systemd/system/hblock.{service,timer} \
&& sudo chmod 644 /etc/systemd/system/hblock.{service,timer} \
&& sudo systemctl daemon-reload \
&& sudo systemctl enable hblock.timer \
&& sudo systemctl start hblock.timer

musher0
Posts: 14629
Joined: Mon 05 Jan 2009, 00:54
Location: Gatineau (Qc), Canada

#35 Post by musher0 »

Yoo-hoo! Labbe5!

You again forgot that Puppy runs as root, so it does not need the sudo command
before another command.

As to systemctl... we don't have it.

Code: Select all

[~]>systemctl
bash: systemctl: command not found
BFN.
Last edited by musher0 on Mon 30 Dec 2019, 04:42, edited 1 time in total.
musher0
~~~~~~~~~~
"You want it darker? We kill the flame." (L. Cohen)

s243a
Posts: 2580
Joined: Tue 02 Sep 2014, 04:48
Contact:

#36 Post by s243a »

musher0 wrote:Yoo-hoo! Labbe5!

You again forgot that Puppy runs as root, so it does not need the sudo command
before another command.

As to systemctl... we con't have it.

Code: Select all

[~]>systemctl
bash: systemctl: command not found
BFN.
If all also fails kill the daemon and then restart it!

BTW, there is a completely unrelated command called sysctl. I always get this one mixed up with systemctl.
Find me on [url=https://www.minds.com/ns_tidder]minds[/url] and on [url=https://www.pearltrees.com/s243a/puppy-linux/id12399810]pearltrees[/url].

Post Reply