From 02028f3bf39b4d551ff6387e8e6a8880715fcbe0 Mon Sep 17 00:00:00 2001 From: Valentin CZERYBA Date: Sun, 5 Feb 2023 20:58:28 +0100 Subject: [PATCH] =?UTF-8?q?information=20ip=20envoy=C3=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- roles/deploy-web/files/blacklist.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/roles/deploy-web/files/blacklist.sh b/roles/deploy-web/files/blacklist.sh index 22b91d0..e35df99 100755 --- a/roles/deploy-web/files/blacklist.sh +++ b/roles/deploy-web/files/blacklist.sh @@ -46,9 +46,14 @@ do count=$(cat /tmp/blacklist_404 /tmp/blacklist_400 |grep -f ${BLACKLIST} -v |sort |uniq |wc -l) if [ ${count} -ne 0 ]; then 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} - cat /tmp/blacklist_400 /tmp/blacklist_404 |grep -f ${BLACKLIST} -v |sort |uniq >> ${BLACKLIST} cat ${BLACKLIST} >> ${MAIL} cat ${MAIL} |mail -s "Blacklist IP ${i}" valczebackup@gmail.com fi