From fd63734b648712b56c66add4de385518e40d5b08 Mon Sep 17 00:00:00 2001 From: MeaTLoTioN Date: Mon, 5 Dec 2022 14:49:17 +0000 Subject: [PATCH] fetch archaic binaries blacklisted ip's too --- twitupd.sh | 41 +++++++++++++++++++++++++++++------------ 1 file changed, 29 insertions(+), 12 deletions(-) diff --git a/twitupd.sh b/twitupd.sh index c995780..bc5631a 100755 --- a/twitupd.sh +++ b/twitupd.sh @@ -1,17 +1,34 @@ #!/bin/bash -MYS_DATA="/mystic/data" -MYS_LOGS="/mystic/logs" +# Recommended crontab entry +# 0 0 * * * /mystic/scripts/twitupd.sh && logger -t "mystic_twitupd.sh" "[crontab] blacklist.txt updated" + +if [[ -z "$1" ]]; then + MYS_HOME="/mystic" +else + MYS_HOME="$1" +fi + +MYS_DATA="$MYS_HOME/data" +MYS_LOGS="$MYS_HOME/logs" + +URLS=( + "https://erb.pw/blacklist" + "https://ibbs.archaicbinary.net/ibbs-bots" +) IFS=$'\n' -for I in $(curl https://www.erb.pw/blacklist 2>/dev/null); do - CHECK=$(grep -c $I $MYS_DATA/blacklist.txt) - if [[ $CHECK -lt 1 ]]; then - echo $I >> $MYS_DATA/blacklist.txt - echo "[+] $I" - echo "$(date) [+] $I" >> $MYS_LOGS/twitupd.log - else - echo "[✔] $I" - echo "$(date) [✔] $I" >> $MYS_LOGS/twitupd.log - fi +#for I in $(curl -s https://erb.pw/blacklist); do +for URL in ${URLS[@]}; do + for I in $(curl -s $URL); do + CHECK=$(grep -c $I $MYS_DATA/blacklist.txt) + if [[ $CHECK -lt 1 ]]; then + echo $I >> $MYS_DATA/blacklist.txt + echo "[+] $I" + echo "$(date) [+] $I" >> $MYS_LOGS/twitupd.log + else + echo "[✔] $I" + echo "$(date) [✔] $I" >> $MYS_LOGS/twitupd.log + fi + done done