diff --git a/Chapter-4/1-geoIP.py b/Chapter-4/1-geoIP.py index d29abf3..49f1ac0 100644 --- a/Chapter-4/1-geoIP.py +++ b/Chapter-4/1-geoIP.py @@ -1,13 +1,16 @@ #!/usr/bin/python # -*- coding: utf-8 -*- import pygeoip -gi = pygeoip.GeoIP('/opt/GeoIP/Geo.dat') + + +gi = pygeoip.GeoIP('GeoLiteCity.dat') + def printRecord(tgt): rec = gi.record_by_name(tgt) city = rec['city'] - region = rec['region_name'] + region = rec['region_code'] country = rec['country_name'] long = rec['longitude'] lat = rec['latitude'] diff --git a/Chapter-4/3-geoPrint.py b/Chapter-4/3-geoPrint.py index f931d40..a593f95 100644 --- a/Chapter-4/3-geoPrint.py +++ b/Chapter-4/3-geoPrint.py @@ -4,7 +4,7 @@ import socket import pygeoip import optparse -gi = pygeoip.GeoIP('/opt/GeoIP/Geo.dat') +gi = pygeoip.GeoIP('GeoLiteCity.dat') def retGeoStr(ip): diff --git a/Chapter-4/4-googleEarthPcap.py b/Chapter-4/4-googleEarthPcap.py index 88e5157..a1881f9 100644 --- a/Chapter-4/4-googleEarthPcap.py +++ b/Chapter-4/4-googleEarthPcap.py @@ -4,7 +4,7 @@ import socket import pygeoip import optparse -gi = pygeoip.GeoIP('/opt/GeoIP/Geo.dat') +gi = pygeoip.GeoIP('Geo.dat') def retKML(ip): diff --git a/Chapter-4/GeoLiteCity.dat b/Chapter-4/GeoLiteCity.dat new file mode 100644 index 0000000..411aa39 Binary files /dev/null and b/Chapter-4/GeoLiteCity.dat differ