Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
spam [2014/01/29 14:28] zagi [HOSTS adblocker] |
spam [2016/08/05 09:00] zagi |
||
---|---|---|---|
Line 1: | Line 1: | ||
===== HOSTS adblocker ==== | ===== HOSTS adblocker ==== | ||
- | http:// | ||
<code bash> | <code bash> | ||
Line 15: | Line 14: | ||
# Perform work in temporary files | # Perform work in temporary files | ||
- | temphosts1="/ | + | temphosts1="/ |
- | temphosts2="/ | + | temphosts2="/ |
- | temphosts3="/ | + | temphosts3="/ |
- | temphosts4="/ | + | temphosts4="/ |
# Obtain various hosts files and merge into one | # Obtain various hosts files and merge into one | ||
Line 24: | Line 23: | ||
wget -nv -O - http:// | wget -nv -O - http:// | ||
wget -nv -O - http:// | wget -nv -O - http:// | ||
- | wget -nv -O - http:// | + | #wget -nv -O - http:// |
+ | wget -nv -O - http:// | ||
+ | wget -nv -O - http:// | ||
wget -nv -O - " | wget -nv -O - " | ||
# Do some work on the file: | # Do some work on the file: | ||
# 1. Remove MS-DOS carriage returns | # 1. Remove MS-DOS carriage returns | ||
- | # 2. Delete all lines that don't begin with 127.0.0.1 | + | # 2. Delete all lines that don't begin with 127.0.0.1 or 0.0.0.0 or ::1 |
- | # 3. Delete any lines containing the word localhost because we'll obtain that from the original hosts file | + | # 3. make everything lowercase |
- | # 4. Scrunch extraneous spaces separating address from name into a single tab | + | # 4. Delete any lines containing the word localhost because we'll obtain that from the original hosts file |
- | # 5. Delete any comments on lines | + | # 5. Replace 127.0.0.1 and 0.0.0.0 with ::1 {localhost on IPv6} |
- | # 6. Clean up leftover trailing blanks | + | # 5. Scrunch extraneous spaces separating address from name into a single tab |
+ | # 6. Delete any comments on lines | ||
+ | # 7. Clean up leftover trailing blanks | ||
+ | # 8. We whitelist hosts j.mp | ||
+ | # | ||
# Pass all this through sort with the unique flag to remove duplicates and save the result | # Pass all this through sort with the unique flag to remove duplicates and save the result | ||
echo " | echo " | ||
- | sed -e ' | + | # |
- | + | # IPv4 | |
+ | #sed -e ' | ||
+ | # | ||
+ | # IPv6 ready | ||
+ | sed -e ' | ||
# Combine system hosts with adblocks | # Combine system hosts with adblocks | ||
echo Merging with original system hosts... | echo Merging with original system hosts... | ||
- | echo -e "\n# Ad blocking hosts generated " | + | echo -e "# Windows HOSTS file should NOT be over 135K!\n# Ad blocking hosts generated " |
cat / | cat / | ||
sudo cp $temphosts3 /etc/hosts | sudo cp $temphosts3 /etc/hosts | ||
Line 52: | Line 62: | ||
echo " sudo cp / | echo " sudo cp / | ||
echo "so don't delete that file! (It's saved read-only for your protection.)" | echo "so don't delete that file! (It's saved read-only for your protection.)" | ||
+ | |||
+ | # *buntu style | ||
+ | / | ||
+ | |||
</ | </ | ||
+ | |||
+ | original (with bugs) @ http:// | ||
+ | |||
+ | |||
+ | how to use this in Ubuntu >>> | ||
====== Fighting SPAM ====== | ====== Fighting SPAM ====== | ||