From 0247f4c1fed79c18b1a59abfe256bc441b9da09d Mon Sep 17 00:00:00 2001 From: Oliver Ladner Date: Fri, 12 Apr 2013 13:08:06 +0200 Subject: [PATCH] replace message if IP not found in GeoIP db --- iptables-show-recent.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/iptables-show-recent.sh b/iptables-show-recent.sh index f2a4169..2c5edec 100755 --- a/iptables-show-recent.sh +++ b/iptables-show-recent.sh @@ -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