summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortristan <steckbrief@geekmail.de>2019-03-15 12:14:26 +0100
committertristan <steckbrief@geekmail.de>2019-03-15 12:14:26 +0100
commit576367fff11fff1d5ffab2dc0fd32228a9de5e03 (patch)
tree3cee5c20235b93763504ef00902a3f5de60acd5f
parentce5c3fd5ff52eb8168b7b998743dd6183ecfc5be (diff)
adds 127.0.0.1 as IP address to all addresses to be blocked
-rwxr-xr-xadlists/.gitignore4
-rw-r--r--adlists/README1
-rwxr-xr-xbuildAdBlocklist.sh2
-rwxr-xr-xretrieveAdBlocklists.sh2
4 files changed, 6 insertions, 3 deletions
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