4 # A tiny Perl hack that makes a country statistic of your /etc/hosts.deny
5 # Copyright 2011 Daniel Borkmann <borkmann@netsniff-ng.org>
6 # Subject to the GNU GPL, version 2.
7 # Debian Dep: libgeo-ip-perl
15 my $db = Geo
::IP
->new(GEOIP_MEMORY_CACHE
);
16 open IN
, "<", "/etc/hosts.deny" or die $!;
21 if (/^\s*\S+:\s*([0-9\.]+)\s*$/) {
22 $country = $db->country_name_by_addr($1);
23 if (defined($country)) {
26 } elsif (/^\s*\S+:\s*(\S+)\s*$/) {
27 $country = $db->country_name_by_name($1);
28 if (defined($country)) {
35 print "$_: $ht{$_}\n";