This commit is contained in:
Your Name 2024-07-23 00:17:12 -06:00
parent 2be6719c14
commit 1b70d22044
2 changed files with 16 additions and 16 deletions

View File

@ -24,8 +24,8 @@ SAVED_BOTS='/root/firewall/bots.txt'
CRAWLER_DB='/root/firewall/crawlers.txt'
PEDO_DB='/root/firewall/pedo.txt'
PEDO_LOG='/root/firewall/pedo-log.txt'
MASTODON_DB='/root/firewall/mastodon.txt'
MASTODON_TMP='/tmp/mastodon.tmp'
fediblock_DB='/root/firewall/fediblock.txt'
fediblock_TMP='/tmp/fediblock.tmp'
ATTACKER_DB='/root/firewall/attacker-db.txt'
ATTACKER_LOG='/root/firewall/attackers.txt'
BOT_ACCOUNT="blockbot@detroitriotcity.com"
@ -47,26 +47,26 @@ attacker-protection() {
attacker-search
}
mastodon(){
fediblock(){
BLOCKED_INSTANCES=( $( curl https://fba.ryona.agency/?domain=detroitriotcity.com | grep https | grep -i href | cut -d '"' -f2 | grep -Evi 'breastmilk|detroit' | sed 's/https:\/\///g' > /tmp/blocked.txt) )
MASTODON_IP=($(cat $NGINX_ACCESS | grep -Ei -f /tmp/blocked.txt | cut -d '-' -f1 | sort -u) )
fediblock_IP=($(cat $NGINX_ACCESS | grep -Ei -f /tmp/blocked.txt | cut -d '-' -f1 | sort -u) )
echo
echo "Scanning Nginx for new Mastodon IP's ...."
echo "Scanning Nginx for new fediblock IP's ...."
echo
for i in "${MASTODON_IP[@]}"; do
echo $i >> $MASTODON_TMP
for i in "${fediblock_IP[@]}"; do
echo $i >> $fediblock_TMP
done
echo "Saving Mastodon list to $MASTODON_DB....."
cat $MASTODON_TMP $MASTODON_DB | sort -u > /tmp/masto.tmp
cp -f $MASTODON_TMP $MASTODON_DB
rm -f $MASTODON_TMP
echo "Saving fediblock list to $fediblock_DB....."
cat $fediblock_TMP $fediblock_DB | sort -u > /tmp/masto.tmp
cp -f $fediblock_TMP $fediblock_DB
rm -f $fediblock_TMP
rm -f /tmp/masto.tmp
BOT_LOG=($(cat $MASTODON_DB | sort -u))
BOT_LOG=($(cat $fediblock_DB | sort -u))
echo
echo "Feeding $MASTODON_DB into NFT....."
echo "Feeding $fediblock_DB into NFT....."
echo
for i in "${BOT_LOG[@]}"; do
$NFT add rule ip filter input ip saddr $i $NFT_DROP
@ -249,7 +249,7 @@ start() {
attacker-protection
bot-search
saved-bots
mastodon
fediblock
wireguard
web
admin
@ -298,8 +298,8 @@ stop() {
if [ "$1" = "start" ]; then
start
elif [ "$1" = "mastodon" ]; then
mastodon
elif [ "$1" = "fediblock" ]; then
fediblock
elif [ "$1" = "bot-search" ]; then
bot-search
elif [ "$1" = "attacker-protection" ]; then