fix
This commit is contained in:
parent
dba7ae75cf
commit
794e2f8edf
17
modules/module-get-errorlog-spam.sh
Normal file
17
modules/module-get-errorlog-spam.sh
Normal 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
|
Loading…
Reference in New Issue
Block a user