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