From faab4f7384c6cdd3e818846631fbc7300aab7d1b Mon Sep 17 00:00:00 2001 From: Alfonso Date: Mon, 6 Feb 2023 12:42:12 +0100 Subject: [PATCH] Update blocklist.sh --- blocklist.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/blocklist.sh b/blocklist.sh index 6003f90..f09e0e8 100755 --- a/blocklist.sh +++ b/blocklist.sh @@ -25,14 +25,14 @@ if [ -f $GREP_PATH ]; then echo "grep OK"; else echo "Cannot find [ grep ]. Inst echo "Downloading the most recent IP list from $BLOCKLISTDE ... and adding them to ipset blocklistde" $(whereis ipset | cut -d" " -f 2) create blocklistde hash:ip -curl -s https://lists.blocklist.de/lists/all.txt | grep -E -o "(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)" | xargs -L1 ipset add blocklistde 2>&1 +curl -s https://lists.blocklist.de/lists/all.txt | grep -E -o "(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)" | xargs -L1 $IPSET_PATH add blocklistde 2>&1 echo "Downloading the most recent IP list from $CRWALERS ... and adding them to ipset crawler_bots" $(whereis ipset | cut -d" " -f 2) create crawler_bots hash:ip -curl -s https://isc.sans.edu/api/threatcategory/research?json | jq '.[] | {ipv4}' | grep ':' | awk '{ print $2 }' | tr -d '"' | xargs -L1 ipset add crawler_bots 2>&1 +curl -s https://isc.sans.edu/api/threatcategory/research?json | jq '.[] | {ipv4}' | grep ':' | awk '{ print $2 }' | tr -d '"' | xargs -L1 $IPSET_PATH add crawler_bots 2>&1 echo "Downloading the most recent IP list from $ABUSE and adding them to abuseipdb" $(whereis ipset | cut -d" " -f 2) create abuseipdb hash:ip -curl -s -H "key: $abuse_key" https://api.abuseipdb.com/api/v2/blacklist | grep -E -o "(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)" | xargs -L1 ipset add abuseipdb 2>&1 +curl -s -H "key: $abuse_key" https://api.abuseipdb.com/api/v2/blacklist | grep -E -o "(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)" | xargs -L1 $IPSET_PATH add abuseipdb 2>&1 echo "Adding the iptables rules..." -$(whereis iptables | cut -d" " -f 2) -I INPUT -m set --match-set crawler_bots src -j DROP -$(whereis iptables | cut -d" " -f 2) -I INPUT -m set --match-set blocklistde src -j DROP -$(whereis iptables | cut -d" " -f 2) -I INPUT -m set --match-set abuseipdb src -j DROP +$IPTABLES_PATH -I INPUT -m set --match-set crawler_bots src -j DROP +$IPTABLES_PATH -I INPUT -m set --match-set blocklistde src -j DROP +$IPTABLES_PATH -I INPUT -m set --match-set abuseipdb src -j DROP