From eb50f99bdd67cc9d1ea59c0f8bd10aec1e81c007 Mon Sep 17 00:00:00 2001 From: MeaTLoTioN Date: Sat, 19 Mar 2022 10:55:03 +0000 Subject: [PATCH 1/5] add logrotate configuration for the log file --- logrotate.d/twitupd | 9 +++++++++ twitupd.sh | 0 2 files changed, 9 insertions(+) create mode 100644 logrotate.d/twitupd mode change 100644 => 100755 twitupd.sh diff --git a/logrotate.d/twitupd b/logrotate.d/twitupd new file mode 100644 index 0000000..114339e --- /dev/null +++ b/logrotate.d/twitupd @@ -0,0 +1,9 @@ +/mystic/log/twitupd.log { + daily + rotate 7 + compress + delaycompress + missingok + notifempty + create 644 root root +} diff --git a/twitupd.sh b/twitupd.sh old mode 100644 new mode 100755 From e8ad06b7e7b93ddc9820aa21e9a6f09c47a7dc61 Mon Sep 17 00:00:00 2001 From: MeaTLoTioN Date: Sat, 19 Mar 2022 10:56:52 +0000 Subject: [PATCH 2/5] add to README.md about logrotate config --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 3a09227..61b7471 100644 --- a/README.md +++ b/README.md @@ -7,3 +7,7 @@ using crontab, you could set it up thus; ``` 0 0 * * * /mystic/scripts/twitupd.sh && logger -t "mystic_twitupd.sh" "[crontab] blacklist.txt updated" ``` + +## recommended logrotate config +in the directory `logrotate.d` there's a file called twitupd which is a suggested basic log rotation config +if you change the mystic dirs in the main twitupd.sh, make sure to change the log file location in the logrotate.d config too From 594d857188839c8467a36c411a4fb034ee297ad5 Mon Sep 17 00:00:00 2001 From: MeaTLoTioN Date: Sat, 19 Mar 2022 10:58:59 +0000 Subject: [PATCH 3/5] correct a typo --- logrotate.d/twitupd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/logrotate.d/twitupd b/logrotate.d/twitupd index 114339e..1c8566d 100644 --- a/logrotate.d/twitupd +++ b/logrotate.d/twitupd @@ -1,4 +1,4 @@ -/mystic/log/twitupd.log { +/mystic/logs/twitupd.log { daily rotate 7 compress From fd63734b648712b56c66add4de385518e40d5b08 Mon Sep 17 00:00:00 2001 From: MeaTLoTioN Date: Mon, 5 Dec 2022 14:49:17 +0000 Subject: [PATCH 4/5] 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 From 2c2e87b0dddc938c53dda4d98eb0b6e8d2fb3ab3 Mon Sep 17 00:00:00 2001 From: MeaTLoTioN Date: Mon, 5 Dec 2022 14:57:04 +0000 Subject: [PATCH 5/5] pull ip's from archaic binary as well as erb.pw --- twitupd.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/twitupd.sh b/twitupd.sh index bc5631a..20ce831 100755 --- a/twitupd.sh +++ b/twitupd.sh @@ -18,7 +18,6 @@ URLS=( ) IFS=$'\n' -#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)