Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl
- use strict;
- use warnings;
- use Geo::IP;
- use Data::Dumper;
- my @rawlines;
- my $region;
- my $gi = Geo::IP->open('/home/kovensky/GeoIP.dat', GEOIP_INDEX_CACHE) or die $!;
- map {
- /\(host=(\d+.\d+.\d+.\d+)/;
- my $ip = $1;
- next if $region->{$ip};
- print $ip . "\n";
- my $record = $gi->record_by_addr($ip);
- $region->{$ip}->{continent} = $record->continent_code;
- $region->{$ip}->{country} = $record->country_name;
- } grep /connection established/, <>;
- print Dumper($region);
Add Comment
Please, Sign In to add comment