Using your /etc/hosts file to block trackers, ads, malware and more
Welcome, Guest.
“Theory and practice sometimes clash. And when that happens, theory loses. Every single time.” ― Linus Torvalds

Author Topic: Using your /etc/hosts file to block trackers, ads, malware and more  (Read 10283 times)

Offline gregorylock

  • Contributor
  • *******
  • Posts: 842
Re: Re: Using your /etc/hosts file to block trackers, ads, malware and more
« Reply #15 on: December 07, 2015, 11:37:23 AM »
Be VERY careful what gets posted.! Too many freaks in this world.

I know !  I've been on the outside edge of social media scene for 13 years or so.  The stuff I've seen and been through gives me the shivers. 

I don't know why but after I ran the hostsblockingscript, about five minutes later my PPP went down, and stayed down until today!
« Last Edit: December 07, 2015, 12:04:32 PM by gregorylock »

Offline JayVii

  • Contributor
  • *******
  • Posts: 1759
    • JayVii's Page
Re: Using your /etc/hosts file to block trackers, ads, malware and more
« Reply #16 on: December 08, 2015, 11:49:54 AM »
Alternatively, the script can be obtained from my NotABug-Repo. It contains very brief instructions. It really is the same exact script, but with some minor changes to it. You can take a glance at it here.
This is the current list i'm using myself on 2 machines :)

Note: If you don't know, what the script does or you are unsure of some commands in there, you probably don't want to use it. Random scripts from the internet can be dangerous and you should use them with care ( = only if you EXACTLY know, what they do).

Offline gregorylock

  • Contributor
  • *******
  • Posts: 842
Re: Re: Using your /etc/hosts file to block trackers, ads, malware and more
« Reply #17 on: December 11, 2015, 12:09:32 AM »
Alternatively, the script can be obtained from my NotABug-Repo. It contains very brief instructions. It really is the same exact script, but with some minor changes to it. You can take a glance at it here.
This is the current list i'm using myself on 2 machines :)

Note: If you don't know, what the script does or you are unsure of some commands in there, you probably don't want to use it. Random scripts from the internet can be dangerous and you should use them with care ( = only if you EXACTLY know, what they do).

Hi Jay thank you for the advice. I wish I knew what these scripts do but I think it's too far over my head.  The reasons I was trying this is because I've noticed that my browser has been getting slower and slower, and making the processor work harder and harder.  I thought maybe the adblocker could be causing some of this.

Offline glsmaxx

  • Full Member
  • ****
  • Posts: 274
  • Old Dog Learnin' New Tricks
Re: Using your /etc/hosts file to block trackers, ads, malware and more
« Reply #18 on: December 23, 2015, 11:44:31 AM »

It is time to update my  Hostsblockingscript.sh  script on this machine. I have been doing this for about a year on all of my machines. I have NO idea why it wil not work and throws the errors linked below.

Thought maybe someone could shed some light on this for me. Again the script has been working fine up until now.  This box is Manjaro XFCE with 4.3 kernel. It is upgraded and other than this working fine.

Here is a link to the errors.
here 


Thanks!
Running Manjaro-XFCE  &  Arch-XFCE
           Are There Any Others?

Offline JayVii

  • Contributor
  • *******
  • Posts: 1759
    • JayVii's Page
Re: Using your /etc/hosts file to block trackers, ads, malware and more
« Reply #19 on: December 23, 2015, 02:22:17 PM »
What version of wget are you using?
Code: [Select]
wget -V

UPDATE:
Looks like the newest version of wget (1.17.1) changed some things and the script has to be adjusted.
I'll look into that :)


UPDATE:
Indeed, it was an easy fix. simply remove the "-r" arguments in the wget commands.
Should look like this:


Code: [Select]
#!/bin/bash

# Credits to "Ben" (Administrator) from CupOfLinux.

# This is going to backup our hosts file.
if [ ! -f ~/.hostsbackup ]
then
cp /etc/hosts ~/.hostsbackup
fi

# Temp directory stuff.
Selfdestructinghosts=$(mktemp)
Selfdestructinghosts2=$(mktemp)

# Get some blocker lists and add to our existing /etc/hosts file.
wget -O - https://raw.githubusercontent.com/disconnectme/disconnect/b27abbf033c6f80f157fe9d98cb767c87065fbf4/firefox/content/disconnect.safariextension/opera/chrome/scripts/data.js >> $Selfdestructinghosts

wget -O - https://easylist-downloads.adblockplus.org/easylist.txt >> $Selfdestructinghosts

wget -O - https://easylist-downloads.adblockplus.org/easyprivacy.txt >> $Selfdestructinghosts

wget -O - https://easylist-downloads.adblockplus.org/antiadblockfilters.txt >> $Selfdestructinghosts

wget -O - https://easylist-downloads.adblockplus.org/fanboy-annoyance.txt >> $Selfdestructinghosts

wget -O - https://easylist-downloads.adblockplus.org/fanboy-social.txt >> $Selfdestructinghosts

wget -O - http://winhelp2002.mvps.org/hosts.txt >> $Selfdestructinghosts

wget -O - http://hosts-file.net/ad_servers.asp >> $Selfdestructinghosts

wget -O - http://someonewhocares.org/hosts/hosts >> $Selfdestructinghosts

#wget -O - https://easylist-downloads.adblockplus.org/malwaredomains_full.txt >> $Selfdestructinghosts

sed -e 's/\r//' -e '/^0.0.0.0/!d' -e '/localhost/d' -e 's/0.0.0.0/0.0.0.0/' -e 's/ \+/\t/' -e 's/#.*$//' -e 's/[ \t]*$//' < $Selfdestructinghosts | sort -u > $Selfdestructinghosts2

#Create a master hosts file.
echo -e "\n#Hostslist created "$(date) | cat ~/.hostsbackup - $Selfdestructinghosts2 > ~/.newblocklist

# Cleaning.
rm -rf $Selfdestructinghosts $Selfdestructinghosts2

# Replace current /etc/hosts with our new one.
cp ~/.newblocklist /etc/hosts

« Last Edit: December 23, 2015, 02:42:37 PM by JayVii »

Offline glsmaxx

  • Full Member
  • ****
  • Posts: 274
  • Old Dog Learnin' New Tricks
Thanks.

Worked like a charm.

I marked this as solved.

Running Manjaro-XFCE  &  Arch-XFCE
           Are There Any Others?