replace message if IP not found in GeoIP db

This commit is contained in:
Oliver Ladner 2013-04-12 13:08:06 +02:00
commit 0247f4c1fe

View file

@ -9,6 +9,7 @@
for ip in $(cat /proc/net/xt_recent/DEFAULT | awk {'print $1'} | sed 's/src=//'); do
IP=$(geoiplookup $ip | sed 's/GeoIP Country Edition:.*, //')
if [[ "$IP" =~ "IP Address not found" ]]; then IP="n/a"; fi
COUNT=$(cat /proc/net/xt_recent/DEFAULT | grep "$ip" | awk {'print $7'})
echo -e "$COUNT\t$ip\t($IP)"
done | sort -rn