This commit is contained in:
Your Name 2024-10-09 09:48:28 -06:00
parent dba7ae75cf
commit 794e2f8edf

View File

@ -0,0 +1,17 @@
#!/bin/bash
DATE="$(date +'%Y/%m/%d %H:%M' -d '1 minute ago')"
echo $DATE
FIREWALL="/opt/firewall/firewall.sh"
ATTACK="module-get-errorlog-spam"
IP=($(grep "$DATE" $1 | grep "GET / HTTP" | cut -d ' ' -f12 | sed 's/,//' | sort -u))
for i in "${IP[@]}"; do
echo $i
COUNT_SPAM=$(cat $1 | grep $i | wc -l)
if [[ $COUNT_SPAM -gt 10 ]]; then
echo here
bash $FIREWALL ipBlockParser "$i"
bash $FIREWALL message "$ATTACK-$i"
redis-cli SADD tmp_block $i
cp -f $2 /tmp/debug-$ATTACK-$i.txt
fi
done