1
2
3
4
5
6
startIpNum,endIpNum,locId
"16777216","16777471","17"
"16777472","16778239","49"
"16778240","16779263","17"
"16779264","16781311","49"
"16781312","16785407","111"
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
#!/usr/bin/perl use strict; use warnings; use Geo::IP; my $gi = Geo::IP->open("/usr/share/GeoIP/GeoIPCity.dat", GEOIP_STANDARD); my $ip = shift; my $record = $gi->record_by_addr($ip); print join "\n", $record->country_code, $record->country_code3, $record->country_name, $record->region, $record->region_name, $record->city, $record->postal_code, $record->latitude, $record->longitude, $record->time_zone, $record->area_code, $record->continent_code, $record->metro_code;
"begin_ip","end_ip","begin_num","end_num","country","name"
startIpNum,endIpNum,locId
2011-09-23T11:00:46 GustlAber wenn dann kein Bereich in der blocks.csv besteht, wo auch diese IP (meine von gestern) 91.8.143.65 drin ist, also 91814365
2011-09-23T08:08:13 GustlExistiert auch als reines Perl-ModulEin weiteres Modul wollte ich vermeiden, aber da werde ich wohl nicht herumkommen.
2011-09-23T10:48:07 GustlBei der IP: 91.8.143.65 sollte in der Abfrage auch 91814365 stehen und nicht 109230246239, das war ein Fehler im Post von mir, sry.
QuoteDein Tipp mit unpack werde ich dann auch umsetzten, danke, im Moment aber