0xKD / db-ip-store

Store CSV from db-ip.com to MySQL or SQLite for fast IP-based search.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

db-ip-store

Store CSV from dp-ip.com to MySQL or SQLite for fast IP-based search.

To make an SQLite db:

This is based on the simplest IP -> Country database.

Download country-db:

gunzip -c downloaded_file.gz > iplogs.csv

Filter out only IPv4 addresses into ipv4log.csv:

touch ipv4logs.csv
head -n `grep '224.0.0.0' iplogs.csv -n | cut -d':' -f1` iplogs.csv > ipv4logs.csv

Then run

$ python initsqlite.py
$ python savetosqlite.py
$ python iplookup.py '123.45.67.89'

You will need to manually create the database and table for the MySQL version found under _mysql/

About

Store CSV from db-ip.com to MySQL or SQLite for fast IP-based search.


Languages

Language:Python 100.0%