mystic-twitupd/twitupd.sh
2022-12-05 14:49:17 +00:00

35 lines
802 B
Bash
Executable File
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# 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 -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