MaxMind GeoIP CSV到.dat

我需要将本地IP地址放入MaxMind GeoIP数据库。 我已经下载了CSV,并添加新的IP地址和位置很容易。 我发现了两个工具,用于MaxMind GeoIP的csv dat,但我无法让他们工作。

用python脚本:

./csv2dat.py -w custom_geoip.dat mmcountry working.csv File "./csv2dat.py", line 69 print "error: database types don't match" SyntaxError: Missing parentheses in call to 'print' 

此外,我试图编译cpp脚本( https://github.com/dankamongmen/sprezzos-world/blob/master/packaging/geoip/debian/src/geoip-csv-to-dat.cpp ),但我得到大strace。

我已经尝试了新的和旧的MaxMind DB。 有没有其他工具?

谢谢

geoip-csv-to-dat.cpp – 是geoip-bin软件包的一部分,可以从Debian或Ubuntu存储库安装,如果是你的Linux分布的话。

 apt-get install geoip-bin /usr/lib/geoip/geoip-generator --help 

更新:挖掘源头发现,maxmind国家和城市csv数据库有完全不同的格式,所以你必须提供不同的一堆参数来处理它。

对于国家数据库:

 /usr/lib/geoip/geoip-generator -v -o custom_geoip.dat working.csv 

对于城市数据库:

 /usr/lib/geoip/geoip-generator -v -o custom_geoip.dat -t \ GEOIP_CITY_EDITION_REV1 -l working-locations.csv working-blocks.csv 

至于csv2dat.py – 貌似你正在试图用Python 3解释器来执行Python 2脚本。 尝试:

 python2.7 csv2dat.py -w custom_geoip.dat mmcountry working.csv