#!/bin/bash # https://snork.ca/gitsucks/#snorkomasq # 24-07-18 # # Requirements: as long as you have sed/wget and have not disabled the # /etc/dnsmasq.d directory then you should be fine. This script needs to # run as root or via sudo in order to restart dnsmasq and manage files # and directories under /etc and /var/log. # # ========== Configuration =================================================== LOGFILE=/var/log/snorkomasq.log DATEFMT=$(date +"%Y-%m-%d %H:%M:%S") LISTDIR=/etc/dnsmasq.snork CONFFILE=/etc/dnsmasq.d/snorkomasq.conf TMPDIR=/tmp/snorkomasq UA="Mozilla/5.0 (Windows NT 10.0; rv:120.0) Gecko/20100101 Firefox/120.0" # ========== Enable or disable individual lists # My personal list of crappy domains https://snork.ca/gitsucks/projects/snorkomasq/ad_hosts.txt LSTSNRK="false" # Easylist justdomains https://justdomains.github.io/blocklists/lists/easylist-justdomains.txt LSTELJD="true" # Easyprivacy justdomains https://justdomains.github.io/blocklists/lists/easyprivacy-justdomains.txt LSTEPJD="true" # disconnect.me ad hosts list hosted on amazonaws LSTDMSA="true" # Steven Black unified list from https://github.com/StevenBlack/hosts # Note: This list requires significant processing LSTSBUL="true" # 1Hosts PRO list (some possible breakage) https://badmojr.gitlab.io/1hosts/Pro/dnsmasq.conf LST1HPR="false" # 1Hosts LITE list (probably no breakage) https://badmojr.gitlab.io/1hosts/Lite/dnsmasq.conf LST1HLI="true" # TLD's to block CRAPTLD="true" TLDLIST="com.br|jp|co.kr|pw|tk|gq|ml|ga|click|club|top|bid|space|xyz|trade|win|download|review|date|stream" # ========== Make sure at least one list is enabled ========================== if [ $LSTSNRK != "true" ] && [ $LSTELJD != "true" ] && [ $LSTEPJD != "true"] && [ $LSTDMSA != "true" ] && [ $LSTSBUL != "true" ] && [ $LST1HPR != "true" ] && [ $LST1HLI != "true" ]; then echo "$DATEFMT [ERROR] No lists enabled - read the instructions!" >> $LOGFILE exit 0 fi # ========== Check for priv status and dnsmasq, then setup =================== mkdir /etc/snorkomasqcheck if [ $? = 0 ]; then rm -R /etc/snorkomasqcheck else echo "$DATEFMT [ERROR] Could not create /etc/snorkomasqcheck - run as root or with sudo!" >> $LOGFILE exit 1 fi dnsmasq --version if [ $? = 0 ]; then echo "# Snorkomasq auto-generated config file" > $CONFFILE echo "# https://snork.ca/gitsucks/#snorkomasq" >> $CONFFILE else echo "$DATEFMT [ERROR] dnsmasq not found!" >> $LOGFILE exit 2 fi if [ ! -d $LISTDIR ]; then mkdir $LISTDIR echo "$DATEFMT [INFO] Created $LISTDIR directory for snorkomasq files" >> $LOGFILE fi # Clean up anything left from previous run, and setup fresh dir if [ -d $TMPDIR ]; then rm -R $TMPDIR fi mkdir $TMPDIR # ========== Download and convert individual lists =========================== if [ $LSTELJD = "true" ]; then wget -U "$UA" -4 -O $TMPDIR/easylist_jd https://justdomains.github.io/blocklists/lists/easylist-justdomains.txt if [ $? -eq 0 ]; then # Insert dnsmasq formatting sed -i 's/^/address\=\/\./g' $TMPDIR/easylist_jd sed -i 's/$/\/0\.0\.0\.0/g' $TMPDIR/easylist_jd # Move to snorkomasq directory and add to config mv $TMPDIR/easylist_jd $LISTDIR echo "conf-file=$LISTDIR/easylist_jd" >> $CONFFILE else # Something must have gone wrong echo $DATEFMT [ERROR] problem downloading Easylist justdomains! >> $LOGFILE fi fi if [ $LSTEPJD = "true" ]; then wget -U "$UA" -4 -O $TMPDIR/easyprivacy_jd https://justdomains.github.io/blocklists/lists/easyprivacy-justdomains.txt if [ $? -eq 0 ]; then # insert dnsmasq formatting sed -i '/^#/!s/^/address\=\/\./g' $TMPDIR/easyprivacy_jd sed -i '/#$/!s/$/\/0\.0\.0\.0/g' $TMPDIR/easyprivacy_jd # Move to snorkomasq directory and add to config mv $TMPDIR/easyprivacy_jd $LISTDIR echo "conf-file=$LISTDIR/easyprivacy_jd" >> $CONFFILE else # Something must have gone wrong echo $DATEFMT [ERROR] problem downloading Easyprivacy justdomains! >> $LOGFILE fi fi if [ $LSTDMSA = "true" ]; then wget -U "$UA" -4 -O $TMPDIR/disco_ad https://s3.amazonaws.com/lists.disconnect.me/simple_ad.txt if [ $? -eq 0 ]; then # delete blank line[s] sed -i '/^$/d' $TMPDIR/disco_ad # insert dnsmasq formatting sed -i '/^#/!s/^/address\=\/\./g' $TMPDIR/disco_ad sed -i '/#$/!s/$/\/0\.0\.0\.0/g' $TMPDIR/disco_ad # Move to snorkomasq directory and add to config mv $TMPDIR/disco_ad $LISTDIR echo "conf-file=$LISTDIR/disco_ad" >> $CONFFILE else # Something must have gone wrong echo $DATEFMT [ERROR] Could not download disconnect.me ad list! >> $LOGFILE fi fi if [ $LSTSNRK = "true" ]; then wget -U "$UA" -4 -O $TMPDIR/snork_ad https://snork.ca/gitsucks/projects/snorkomasq/ad_hosts.txt if [ $? -eq 0 ]; then # Move to snorkomasq directory and add to config mv $TMPDIR/snork_ad $LISTDIR echo "conf-file=$LISTDIR/snork_ad" >> $CONFFILE else # Something must have gone wrong echo $DATEFMT [ERROR] Could not download snork-o-list! >> $LOGFILE fi fi if [ $LSTSBUL = "true" ]; then wget -U "$UA" -4 -O $TMPDIR/sblack_uni https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts if [ $? -eq 0 ]; then # remove everything that isn't an actual block entry grep -F "0.0.0.0" $TMPDIR/sblack_uni | grep "^0.0.0.0" > $TMPDIR/sblack_unified # get rid of impossible domain names sed -i '/--/d' $TMPDIR/sblack_uni sed -i '/-\./d' $TMPDIR/sblack_uni # get rid of the unnecessary "0.0.0.0" self reference sed -i '/0.0.0.0 0.0.0.0/d' $TMPDIR/sblack_unified # strip the 0.0.0.0 so all lines begin with host names sed -i 's/^0.0.0.0 //' $TMPDIR/sblack_unified # get rid of any trailing comments sed -i 's/ .*$//' $TMPDIR/sblack_unified # Remove entires that have significant repeats sed -i '/alphonso.tv/d' $TMPDIR/sblack_unified sed -i '/xiaomi.com$/d' $TMPDIR/sblack_unified sed -i '/miui.com$/d' $TMPDIR/sblack_unified sed -i '/ero-advertising.com$/d' $TMPDIR/sblack_unified sed -i '/dnset.com$/d' $TMPDIR/sblack_unified sed -i '/ddns.name$/d' $TMPDIR/sblack_unified sed -i '/statcounter.com$/d' $TMPDIR/sblack_unified sed -i '/sextracker.com$/d' $TMPDIR/sblack_unified sed -i '/bravenet.com$/d' $TMPDIR/sblack_unified sed -i '/esomniture.com$/d' $TMPDIR/sblack_unified sed -i '/xiti.com$/d' $TMPDIR/sblack_unified sed -i '/marketscore.com$/d' $TMPDIR/sblack_unified sed -i '/xxxcounter.com$/d' $TMPDIR/sblack_unified sed -i '/sitemeter.com$/d' $TMPDIR/sblack_unified sed -i '/opentracker.net$/d' $TMPDIR/sblack_unified sed -i '/spylog.com$/d' $TMPDIR/sblack_unified sed -i '/addfreestats.com$/d' $TMPDIR/sblack_unified sed -i '/bloke.com$/d' $TMPDIR/sblack_unified sed -i '/click-fr.com$/d' $TMPDIR/sblack_unified sed -i '/sextracker.be$/d' $TMPDIR/sblack_unified sed -i '/sancharnet.in$/d' $TMPDIR/sblack_unified sed -i '/crypto-loot.com$/d' $TMPDIR/sblack_unified sed -i '/imrworldwide.com$/d' $TMPDIR/sblack_unified sed -i '/cjt1.net$/d' $TMPDIR/sblack_unified sed -i '/2o7.net$/d' $TMPDIR/sblack_unified sed -i '/oewabox.at$/d' $TMPDIR/sblack_unified sed -i '/checkm8.com$/d' $TMPDIR/sblack_unified sed -i '/thruport.com$/d' $TMPDIR/sblack_unified sed -i '/hyperbanner.net$/d' $TMPDIR/sblack_unified sed -i '/focalink.com$/d' $TMPDIR/sblack_unified sed -i '/advertwizard.com$/d' $TMPDIR/sblack_unified sed -i '/adtech.de$/d' $TMPDIR/sblack_unified sed -i '/adtech.fr$/d' $TMPDIR/sblack_unified sed -i '/adtech.us$/d' $TMPDIR/sblack_unified sed -i '/gittigidiyor.com$/d' $TMPDIR/sblack_unified sed -i '/casalemedia.com$/d' $TMPDIR/sblack_unified sed -i '/bbelements.com$/d' $TMPDIR/sblack_unified sed -i '/zedo.com$/d' $TMPDIR/sblack_unified sed -i '/economicoutlook.net$/d' $TMPDIR/sblack_unified sed -i '/247realmedia.com$/d' $TMPDIR/sblack_unified sed -i '/kontera.com$/d' $TMPDIR/sblack_unified sed -i '/generals.ea.com$/d' $TMPDIR/sblack_unified sed -i '/popmarker.com$/d' $TMPDIR/sblack_unified sed -i '/videostrip.com$/d' $TMPDIR/sblack_unified sed -i '/googleadservices.com$/d' $TMPDIR/sblack_unified sed -i '/googlesyndication.com$/d' $TMPDIR/sblack_unified sed -i '/pop6.com$/d' $TMPDIR/sblack_unified sed -i '/falkag.net$/d' $TMPDIR/sblack_unified sed -i '/adscience.nl$/d' $TMPDIR/sblack_unified sed -i '/am15.net$/d' $TMPDIR/sblack_unified sed -i '/ad.tomshardware.com$/d' $TMPDIR/sblack_unified sed -i '/glam.com$/d' $TMPDIR/sblack_unified sed -i '/paypopup.com$/d' $TMPDIR/sblack_unified sed -i '/hitbox.com$/d' $TMPDIR/sblack_unified sed -i '/extreme-dm.com$/d' $TMPDIR/sblack_unified sed -i '/fastclick.net$/d' $TMPDIR/sblack_unified sed -i '/p2l.info$/d' $TMPDIR/sblack_unified sed -i '/polybuild.ru$/d' $TMPDIR/sblack_unified sed -i '/sapo.pt$/d' $TMPDIR/sblack_unified sed -i '/adclick.lt$/d' $TMPDIR/sblack_unified sed -i '/adclick.lv$/d' $TMPDIR/sblack_unified sed -i '/flagcounter.com$/d' $TMPDIR/sblack_unified sed -i '/mtree.com$/d' $TMPDIR/sblack_unified sed -i '/outster.com$/d' $TMPDIR/sblack_unified sed -i '/adocean.pl$/d' $TMPDIR/sblack_unified sed -i '/stat24.com$/d' $TMPDIR/sblack_unified sed -i '/skimlinks.com$/d' $TMPDIR/sblack_unified sed -i '/cnzz.com$/d' $TMPDIR/sblack_unified sed -i '/cqcounter.com$/d' $TMPDIR/sblack_unified sed -i '/directtrack.com$/d' $TMPDIR/sblack_unified sed -i '/hotlog.ru$/d' $TMPDIR/sblack_unified sed -i '/eloqua.com$/d' $TMPDIR/sblack_unified sed -i '/stats.misstrends.com$/d' $TMPDIR/sblack_unified sed -i '/v.fwmrm.net$/d' $TMPDIR/sblack_unified sed -i '/hit.gemius.pl$/d' $TMPDIR/sblack_unified sed -i '/amazingcounters.com$/d' $TMPDIR/sblack_unified sed -i '/srs.doubleverify.com$/d' $TMPDIR/sblack_unified sed -i '/etargetnet.com$/d' $TMPDIR/sblack_unified sed -i '/coin-hive.com$/d' $TMPDIR/sblack_unified sed -i '/coinhive.com$/d' $TMPDIR/sblack_unified sed -i '/comclick.com$/d' $TMPDIR/sblack_unified sed -i '/revolvermaps.com$/d' $TMPDIR/sblack_unified sed -i '/ads.httpool.com$/d' $TMPDIR/sblack_unified sed -i '/toboads.com$/d' $TMPDIR/sblack_unified sed -i '/axf8.net$/d' $TMPDIR/sblack_unified sed -i '/webtrekk.net$/d' $TMPDIR/sblack_unified sed -i '/net-filter.com$/d' $TMPDIR/sblack_unified sed -i '/sitestats.com$/d' $TMPDIR/sblack_unified sed -i '/scorecardresearch.com$/d' $TMPDIR/sblack_unified sed -i '/blueseek.com$/d' $TMPDIR/sblack_unified sed -i '/clickshield.net$/d' $TMPDIR/sblack_unified sed -i '/primosearch.com$/d' $TMPDIR/sblack_unified sed -i '/rubiconproject.com$/d' $TMPDIR/sblack_unified sed -i '/crwdcntrl.net$/d' $TMPDIR/sblack_unified sed -i '/industrybrains.com$/d' $TMPDIR/sblack_unified sed -i '/clickzs.com$/d' $TMPDIR/sblack_unified sed -i '/speedbit.com$/d' $TMPDIR/sblack_unified sed -i '/vpptechnologies.com$/d' $TMPDIR/sblack_unified sed -i '/nuggad.net$/d' $TMPDIR/sblack_unified sed -i '/omtrdc.net$/d' $TMPDIR/sblack_unified sed -i '/openx.net$/d' $TMPDIR/sblack_unified sed -i '/hittail.com$/d' $TMPDIR/sblack_unified sed -i '/mydas.mobi$/d' $TMPDIR/sblack_unified sed -i '/smartadserver.com$/d' $TMPDIR/sblack_unified sed -i '/effectivemeasure.net$/d' $TMPDIR/sblack_unified sed -i '/xclicks.net$/d' $TMPDIR/sblack_unified sed -i '/abnad.net$/d' $TMPDIR/sblack_unified sed -i '/clicktracks.com$/d' $TMPDIR/sblack_unified sed -i '/intellitxt.com$/d' $TMPDIR/sblack_unified sed -i '/puhtml.com$/d' $TMPDIR/sblack_unified sed -i '/nimiq.ag$/d' $TMPDIR/sblack_unified sed -i '/nimiq.agency$/d' $TMPDIR/sblack_unified sed -i '/nimiq.net$/d' $TMPDIR/sblack_unified sed -i '/nimiq.network$/d' $TMPDIR/sblack_unified sed -i '/nimiq.com$/d' $TMPDIR/sblack_unified sed -i '/nimiq-network.com$/d' $TMPDIR/sblack_unified sed -i '/freebitco.in$/d' $TMPDIR/sblack_unified sed -i '/minero.cc$/d' $TMPDIR/sblack_unified sed -i '/authedmine.com$/d' $TMPDIR/sblack_unified sed -i '/crypto.csgocpu.com$/d' $TMPDIR/sblack_unified sed -i '/rocks.io$/d' $TMPDIR/sblack_unified sed -i '/crypto-pool.fr$/d' $TMPDIR/sblack_unified sed -i '/jumptap.com$/d' $TMPDIR/sblack_unified sed -i '/smaato.net$/d' $TMPDIR/sblack_unified sed -i '/mojiva.com$/d' $TMPDIR/sblack_unified sed -i '/mocean.mobi$/d' $TMPDIR/sblack_unified sed -i '/letitbefaster.life$/d' $TMPDIR/sblack_unified sed -i '/letitbefaster.website$/d' $TMPDIR/sblack_unified sed -i '/advertising.com$/d' $TMPDIR/sblack_unified sed -i '/2mdn.net$/d' $TMPDIR/sblack_unified sed -i '/doubleclick.net$/d' $TMPDIR/sblack_unified sed -i '/activebestakamaiflash.icu$/d' $TMPDIR/sblack_unified sed -i '/a8.net$/d' $TMPDIR/sblack_unified sed -i '/moba8.net$/d' $TMPDIR/sblack_unified # And now make entries to cover the ones we just deleted echo "alphonso.tv" >> $TMPDIR/sblack_unified echo "xiaomi.com" >> $TMPDIR/sblack_unified echo "miui.com" >> $TMPDIR/sblack_unified echo "ero-advertising.com" >> $TMPDIR/sblack_unified echo "dnset.com" >> $TMPDIR/sblack_unified echo "ddns.name" >> $TMPDIR/sblack_unified echo "statcounter.com" >> $TMPDIR/sblack_unified echo "sextracker.com" >> $TMPDIR/sblack_unified echo "bravenet.com" >> $TMPDIR/sblack_unified echo "esomniture.com" >> $TMPDIR/sblack_unified echo "xiti.com" >> $TMPDIR/sblack_unified echo "marketscore.com" >> $TMPDIR/sblack_unified echo "xxxcounter.com" >> $TMPDIR/sblack_unified echo "sitemeter.com" >> $TMPDIR/sblack_unified echo "opentracker.net" >> $TMPDIR/sblack_unified echo "spylog.com" >> $TMPDIR/sblack_unified echo "addfreestats.com" >> $TMPDIR/sblack_unified echo "bloke.com" >> $TMPDIR/sblack_unified echo "click-fr.com" >> $TMPDIR/sblack_unified echo "sextracker.be" >> $TMPDIR/sblack_unified echo "sancharnet.in" >> $TMPDIR/sblack_unified echo "crypto-loot.com" >> $TMPDIR/sblack_unified echo "imrworldwide.com" >> $TMPDIR/sblack_unified echo "cjt1.net" >> $TMPDIR/sblack_unified echo "2o7.net" >> $TMPDIR/sblack_unified echo "oewabox.at" >> $TMPDIR/sblack_unified echo "checkm8.com" >> $TMPDIR/sblack_unified echo "thruport.com" >> $TMPDIR/sblack_unified echo "hyperbanner.net" >> $TMPDIR/sblack_unified echo "focalink.com" >> $TMPDIR/sblack_unified echo "advertwizard.com" >> $TMPDIR/sblack_unified echo "adtech.de" >> $TMPDIR/sblack_unified echo "adtech.fr" >> $TMPDIR/sblack_unified echo "adtech.us" >> $TMPDIR/sblack_unified echo "gittigidiyor.com" >> $TMPDIR/sblack_unified echo "casalemedia.com" >> $TMPDIR/sblack_unified echo "bbelements.com" >> $TMPDIR/sblack_unified echo "zedo.com" >> $TMPDIR/sblack_unified echo "economicoutlook.net" >> $TMPDIR/sblack_unified echo "247realmedia.com" >> $TMPDIR/sblack_unified echo "kontera.com" >> $TMPDIR/sblack_unified echo "generals.ea.com" >> $TMPDIR/sblack_unified echo "popmarker.com" >> $TMPDIR/sblack_unified echo "videostrip.com" >> $TMPDIR/sblack_unified echo "googleadservices.com" >> $TMPDIR/sblack_unified echo "googlesyndication.com" >> $TMPDIR/sblack_unified echo "pop6.com" >> $TMPDIR/sblack_unified echo "falkag.net" >> $TMPDIR/sblack_unified echo "adscience.nl" >> $TMPDIR/sblack_unified echo "am15.net" >> $TMPDIR/sblack_unified echo "ad.tomshardware.com" >> $TMPDIR/sblack_unified echo "glam.com" >> $TMPDIR/sblack_unified echo "paypopup.com" >> $TMPDIR/sblack_unified echo "hitbox.com" >> $TMPDIR/sblack_unified echo "extreme-dm.com" >> $TMPDIR/sblack_unified echo "fastclick.net" >> $TMPDIR/sblack_unified echo "p2l.info" >> $TMPDIR/sblack_unified echo "polybuild.ru" >> $TMPDIR/sblack_unified echo "sapo.pt" >> $TMPDIR/sblack_unified echo "adclick.lt" >> $TMPDIR/sblack_unified echo "adclick.lv" >> $TMPDIR/sblack_unified echo "flagcounter.com" >> $TMPDIR/sblack_unified echo "mtree.com" >> $TMPDIR/sblack_unified echo "outster.com" >> $TMPDIR/sblack_unified echo "adocean.pl" >> $TMPDIR/sblack_unified echo "stat24.com" >> $TMPDIR/sblack_unified echo "skimlinks.com" >> $TMPDIR/sblack_unified echo "cnzz.com" >> $TMPDIR/sblack_unified echo "cqcounter.com" >> $TMPDIR/sblack_unified echo "directtrack.com" >> $TMPDIR/sblack_unified echo "hotlog.ru" >> $TMPDIR/sblack_unified echo "eloqua.com" >> $TMPDIR/sblack_unified echo "stats.misstrends.com" >> $TMPDIR/sblack_unified echo "v.fwmrm.net" >> $TMPDIR/sblack_unified echo "hit.gemius.pl" >> $TMPDIR/sblack_unified echo "amazingcounters.com" >> $TMPDIR/sblack_unified echo "srs.doubleverify.com" >> $TMPDIR/sblack_unified echo "etargetnet.com" >> $TMPDIR/sblack_unified echo "coin-hive.com" >> $TMPDIR/sblack_unified echo "coinhive.com" >> $TMPDIR/sblack_unified echo "comclick.com" >> $TMPDIR/sblack_unified echo "revolvermaps.com" >> $TMPDIR/sblack_unified echo "ads.httpool.com" >> $TMPDIR/sblack_unified echo "toboads.com" >> $TMPDIR/sblack_unified echo "axf8.net" >> $TMPDIR/sblack_unified echo "webtrekk.net" >> $TMPDIR/sblack_unified echo "net-filter.com" >> $TMPDIR/sblack_unified echo "sitestats.com" >> $TMPDIR/sblack_unified echo "scorecardresearch.com" >> $TMPDIR/sblack_unified echo "blueseek.com" >> $TMPDIR/sblack_unified echo "clickshield.net" >> $TMPDIR/sblack_unified echo "primosearch.com" >> $TMPDIR/sblack_unified echo "rubiconproject.com" >> $TMPDIR/sblack_unified echo "crwdcntrl.net" >> $TMPDIR/sblack_unified echo "industrybrains.com" >> $TMPDIR/sblack_unified echo "clickzs.com" >> $TMPDIR/sblack_unified echo "speedbit.com" >> $TMPDIR/sblack_unified echo "vpptechnologies.com" >> $TMPDIR/sblack_unified echo "nuggad.net" >> $TMPDIR/sblack_unified echo "omtrdc.net" >> $TMPDIR/sblack_unified echo "openx.net" >> $TMPDIR/sblack_unified echo "hittail.com" >> $TMPDIR/sblack_unified echo "mydas.mobi" >> $TMPDIR/sblack_unified echo "smartadserver.com" >> $TMPDIR/sblack_unified echo "effectivemeasure.net" >> $TMPDIR/sblack_unified echo "xclicks.net" >> $TMPDIR/sblack_unified echo "abnad.net" >> $TMPDIR/sblack_unified echo "clicktracks.com" >> $TMPDIR/sblack_unified echo "intellitxt.com" >> $TMPDIR/sblack_unified echo "puhtml.com" >> $TMPDIR/sblack_unified echo "nimiq.ag" >> $TMPDIR/sblack_unified echo "nimiq.agency" >> $TMPDIR/sblack_unified echo "nimiq.net" >> $TMPDIR/sblack_unified echo "nimiq.network" >> $TMPDIR/sblack_unified echo "nimiq.com" >> $TMPDIR/sblack_unified echo "nimiq-network.com" >> $TMPDIR/sblack_unified echo "freebitco.in" >> $TMPDIR/sblack_unified echo "minero.cc" >> $TMPDIR/sblack_unified echo "authedmine.com" >> $TMPDIR/sblack_unified echo "crypto.csgocpu.com" >> $TMPDIR/sblack_unified echo "rocks.io" >> $TMPDIR/sblack_unified echo "crypto-pool.fr" >> $TMPDIR/sblack_unified echo "jumptap.com" >> $TMPDIR/sblack_unified echo "smaato.net" >> $TMPDIR/sblack_unified echo "mojiva.com" >> $TMPDIR/sblack_unified echo "mocean.mobi" >> $TMPDIR/sblack_unified echo "letitbefaster.life" >> $TMPDIR/sblack_unified echo "letitbefaster.website" >> $TMPDIR/sblack_unified echo "advertising.com" >> $TMPDIR/sblack_unified echo "2mdn.net" >> $TMPDIR/sblack_unified echo "doubleclick.net" >> $TMPDIR/sblack_unified echo "activebestakamaiflash.icu" >> $TMPDIR/sblack_unified echo "a8.net" >> $TMPDIR/sblack_unified echo "moba8.net" >> $TMPDIR/sblack_unified # Remove bad TLD's if required if [ $CRAPTLD = "true" ]; then sed -i -E "/\.($TLDLIST)$/d" $TMPDIR/sblack_unified fi # insert dnsmasq formatting sed -i '/^#/!s/^/address\=\/\./' $TMPDIR/sblack_unified sed -i '/#$/!s/$/\/0\.0\.0\.0/' $TMPDIR/sblack_unified # Move to snorkomasq directory and add to config mv $TMPDIR/sblack_unified $LISTDIR echo "conf-file=$LISTDIR/sblack_unified" >> $CONFFILE else # Something must have gone wrong echo $DATEFMT [ERROR] Could not download Steven Black Unified list! >> $LOGFILE fi fi if [ $LST1HPR = "true" ]; then wget -U "$UA" -4 -O $TMPDIR/1hosts https://badmojr.gitlab.io/1hosts/Pro/dnsmasq.conf if [ $? -eq 0 ]; then # get rid of impossible domain names sed -i '/--/d' $TMPDIR/1hosts sed -i '/-\./d' $TMPDIR/1hosts # Remove bad TLD's if required if [ $CRAPTLD = "true" ]; then sed -i -E "/\.($TLDLIST)$/d" $TMPDIR/1hosts fi # Move to snorkomasq directory and add to config mv $TMPDIR/1hosts $LISTDIR echo "conf-file=$LISTDIR/1hosts" >> $CONFFILE else # Something must have gone wrong echo $DATEFMT [ERROR] Could not download 1Hosts list! >> $LOGFILE fi fi if [ $LST1HLI = "true" ]; then wget -U "$UA" -4 -O $TMPDIR/1hosts https://badmojr.gitlab.io/1hosts/Lite/dnsmasq.conf if [ $? -eq 0 ]; then # get rid of impossible domain names sed -i '/--/d' $TMPDIR/1hosts sed -i '/-\./d' $TMPDIR/1hosts # Remove bad TLD's if required if [ $CRAPTLD = "true" ]; then sed -i -E "/\.($TLDLIST)$/d" $TMPDIR/1hosts fi # Move to snorkomasq directory and add to config mv $TMPDIR/1hosts $LISTDIR echo "conf-file=$LISTDIR/1hosts" >> $CONFFILE else # Something must have gone wrong echo $DATEFMT [ERROR] Could not download 1Hosts list! >> $LOGFILE fi fi if [ $CRAPTLD = "true" ]; then CRAPLIST=`echo "$TLDLIST" | sed 's@|@/@g'` echo "address=/$CRAPLIST/0.0.0.0" > $LISTDIR/craptld echo "conf-file=$LISTDIR/craptld" >> $CONFFILE fi # ========== Now cleanup and restart dnsmasq ================================= rm -R $TMPDIR /etc/init.d/dnsmasq restart