File: convert-geoip.pl

package info (click to toggle)
multitail 7.1.5-2
  • links: PTS
  • area: main
  • in suites: forky, sid, trixie
  • size: 884 kB
  • sloc: ansic: 14,945; makefile: 119; sh: 28; perl: 25
file content (21 lines) | stat: -rwxr-xr-x 223 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/perl

use Geo::IP;

my $gi = Geo::IP->new(GEOIP_STANDARD);

$| = 1;

while(<>)
{
	chomp($_);

	$country = $gi->country_code_by_addr($_);

	if ($country eq '')
	{
		$country = '?';
	}

	print "$_ ($country)\n";
}