From 576367fff11fff1d5ffab2dc0fd32228a9de5e03 Mon Sep 17 00:00:00 2001 From: tristan Date: Fri, 15 Mar 2019 12:14:26 +0100 Subject: adds 127.0.0.1 as IP address to all addresses to be blocked --- adlists/.gitignore | 4 ++++ adlists/README | 1 - buildAdBlocklist.sh | 2 +- retrieveAdBlocklists.sh | 2 +- 4 files changed, 6 insertions(+), 3 deletions(-) create mode 100755 adlists/.gitignore delete mode 100644 adlists/README diff --git a/adlists/.gitignore b/adlists/.gitignore new file mode 100755 index 0000000..5e7d273 --- /dev/null +++ b/adlists/.gitignore @@ -0,0 +1,4 @@ +# Ignore everything in this directory +* +# Except this file +!.gitignore diff --git a/adlists/README b/adlists/README deleted file mode 100644 index 77fa04a..0000000 --- a/adlists/README +++ /dev/null @@ -1 +0,0 @@ -This directory is for the downloaded source ad block lists diff --git a/buildAdBlocklist.sh b/buildAdBlocklist.sh index c12d2a6..510b821 100755 --- a/buildAdBlocklist.sh +++ b/buildAdBlocklist.sh @@ -1,6 +1,6 @@ #°/bin/bash ADLISTDIR=adlists for adfile in $(ls $ADLISTDIR); do - grep -v '^#' < $ADLISTDIR/$adfile | grep -v '^$' | awk '{if (0 < match($0, "\t") || 0 < index($0, " ")) {split($0,b," "); print b[2]} else print $0}' | grep -v '^localhost$' | grep -v '^local$' | grep -v '^localhost.localdomain$' | grep -v '^ip6-localnet$' | grep -v '^ip6-localhost$' >> block.list + grep -v '^#' < $ADLISTDIR/$adfile | grep -v '^$' | awk '{if (0 < match($0, "\t") || 0 < index($0, " ")) {split($0,b," "); print b[2]} else print $0}' | grep -v '^localhost$' | grep -v '^local$' | grep -v '^localhost.localdomain$' | grep -v '^ip6-localnet$' | grep -v '^ip6-localhost$' | grep -v '^$' | while read blockedAddress; do echo "127.0.0.1 $blockedAddress"; done >> block.list done diff --git a/retrieveAdBlocklists.sh b/retrieveAdBlocklists.sh index a56c73e..480ee48 100755 --- a/retrieveAdBlocklists.sh +++ b/retrieveAdBlocklists.sh @@ -1,4 +1,4 @@ #!/bin/bash while read p; do - echo "$p" | awk '{split($0,a,"|"); system("wget -O adlists/"a[1] " " a[2])}' + echo "$p" | awk '{split($0,a,"|"); system("curl -s " a[2] " > adlists/"a[1])}' done < adfilelist.txt -- cgit v1.2.3