This commit is contained in:
2025-03-24 21:28:20 +00:00
commit a4aba2cad0
15 changed files with 327 additions and 0 deletions
Executable
+19
View File
@@ -0,0 +1,19 @@
#!/bin/bash
ERRORFILE='/tmp/flowers_apache2.log'
rm -f ${ERRORFILE}
touch ${ERRORFILE}
NOW=$(date +"%s")
grep 'Flowers - authorization failed' /var/log/apache2/error.log | while read -r LINE; do
RDT="${LINE:1:31}"
DT=$(date --date="${RDT}" +"%s")
(( SECS = NOW - DT ))
# echo "$RDT, $DT, $NOW, $SECS"
if [[ ${SECS} -lt 601 ]] ; then
echo $LINE >>${ERRORFILE}
IP=$(echo ${LINE} | grep -oE "\b([0-9]{1,3}\.){3}[0-9]{1,3}\b")
addEvent.sh "BLOCK,${IP},5,5,Unauthorized authorization attempt in Flowers"
fi
done
cat ${ERRORFILE} | wc -l