update twitupd.sh
This commit is contained in:
parent
6017422529
commit
768811fc40
40
twitupd.sh
Normal file → Executable file
40
twitupd.sh
Normal file → Executable file
@ -1,17 +1,33 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
MYS_DATA="/mystic/data"
|
# Recommended crontab entry
|
||||||
MYS_LOGS="/mystic/logs"
|
# 0 0 * * * /mystic/scripts/twitupd.sh /path/to/mystic && logger -t "mystic_badips" "[crontab] blacklist.txt/denylist.txt updated"
|
||||||
|
|
||||||
|
[[ -z "$1" ]] && MYS_HOME="/mystic" || MYS_HOME="$1"
|
||||||
|
|
||||||
|
MYS_DATA="$MYS_HOME/data"
|
||||||
|
MYS_LOGS="$MYS_HOME/logs"
|
||||||
|
|
||||||
|
# URLs containing raw IP's to use for Mystic's blacklist/denylist
|
||||||
|
URLS=(
|
||||||
|
"https://erb.pw/blacklist"
|
||||||
|
"https://ibbs.archaicbinary.net/ibbs-bots"
|
||||||
|
)
|
||||||
|
|
||||||
|
# Check if using Mystic's blacklist.txt or denylist.txt
|
||||||
|
[[ -f $MYS_DATA/denylist.txt ]] && FILE="$MYS_DATA/denylist.txt" || FILE="$MYS_DATA/blacklist.txt"
|
||||||
|
|
||||||
IFS=$'\n'
|
IFS=$'\n'
|
||||||
for I in $(curl https://www.erb.pw/blacklist 2>/dev/null); do
|
for URL in ${URLS[@]}; do
|
||||||
CHECK=$(grep -c $I $MYS_DATA/blacklist.txt)
|
for I in $(curl -s $URL); do
|
||||||
if [[ $CHECK -lt 1 ]]; then
|
CHECK=$(grep -c $I $FILE)
|
||||||
echo $I >> $MYS_DATA/blacklist.txt
|
if [[ $CHECK -lt 1 ]]; then
|
||||||
echo "[[1;32m+[0m] $I"
|
echo $I >> $FILE
|
||||||
echo "$(date) [+] $I" >> $MYS_LOGS/twitupd.log
|
echo "[[1;32m+[0m] $I"
|
||||||
else
|
echo "$(date) [+] $I" >> $MYS_LOGS/twitupd.log
|
||||||
echo "[[1;33m✔[0m] $I"
|
else
|
||||||
echo "$(date) [✔] $I" >> $MYS_LOGS/twitupd.log
|
echo "[[1;33m✔[0m] $I"
|
||||||
fi
|
echo "$(date) [✔] $I" >> $MYS_LOGS/twitupd.log
|
||||||
|
fi
|
||||||
|
done
|
||||||
done
|
done
|
||||||
|
Loading…
x
Reference in New Issue
Block a user