information ip envoyé

This commit is contained in:
Valentin CZERYBA 2023-02-05 20:58:28 +01:00
parent c7ddbd20b6
commit 02028f3bf3

View File

@ -46,9 +46,14 @@ do
count=$(cat /tmp/blacklist_404 /tmp/blacklist_400 |grep -f ${BLACKLIST} -v |sort |uniq |wc -l) count=$(cat /tmp/blacklist_404 /tmp/blacklist_400 |grep -f ${BLACKLIST} -v |sort |uniq |wc -l)
if [ ${count} -ne 0 ]; then if [ ${count} -ne 0 ]; then
echo "Nouvelle IP blacklisté" > ${MAIL} echo "Nouvelle IP blacklisté" > ${MAIL}
cat /tmp/blacklist_400 /tmp/blacklist_404 |grep -f ${BLACKLIST} -v |sort |uniq >> ${MAIL} list_ip=($(cat /tmp/blacklist_400 /tmp/blacklist_404 |grep -f ${BLACKLIST} -v |sort |uniq))
for i in ${list_ip[@]}
do
echo ${i} >> ${MAIL}
curl http://ipinfo.ip/${i} >> ${MAIL}
echo ${i} >> ${BLACKLIST}
done
echo "IP dejà blacklisté : " >> ${MAIL} echo "IP dejà blacklisté : " >> ${MAIL}
cat /tmp/blacklist_400 /tmp/blacklist_404 |grep -f ${BLACKLIST} -v |sort |uniq >> ${BLACKLIST}
cat ${BLACKLIST} >> ${MAIL} cat ${BLACKLIST} >> ${MAIL}
cat ${MAIL} |mail -s "Blacklist IP ${i}" valczebackup@gmail.com cat ${MAIL} |mail -s "Blacklist IP ${i}" valczebackup@gmail.com
fi fi