Skip to content

formtapez/ripe

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ripe Database Parser

This script parses the ARIN/APNIC/LACNIC/AfriNIC/RIPE databases into a local PostgreSQL database.

Installation of needed packages (Example on Ubuntu 16.04):

apt install postgresql python3 python3-netaddr python3-psycopg2 python3-sqlalchemy

- or -

apt install postgresql python3 python-pip
pip install -r requirements.txt

Create PostgreSQL database (Use "ripe" as password):

sudo -u postgres createuser --pwprompt --createdb ripe
sudo -u postgres createdb --owner=ripe ripe

Prior to starting this script you need to download the database dumps from the following URLs and place it in this directory:

wget ftp://ftp.afrinic.net/pub/dbase/afrinic.db.gz

wget ftp://ftp.apnic.net/pub/apnic/whois/apnic.db.inetnum.gz
wget ftp://ftp.apnic.net/pub/apnic/whois/apnic.db.inet6num.gz

wget ftp://ftp.arin.net/pub/rr/arin.db

wget ftp://ftp.lacnic.net/pub/stats/lacnic/delegated-lacnic-extended-latest

wget ftp://ftp.ripe.net/ripe/dbase/split/ripe.db.inetnum.gz
wget ftp://ftp.ripe.net/ripe/dbase/split/ripe.db.inet6num.gz

- or simply -

./download_dumps.sh

After importing you can lookup an IP address like:

SELECT block.inetnum, block.country, block.description FROM block WHERE block.inetnum >> '2001:db8::1' ORDER BY block.inetnum DESC LIMIT 1;

- or simply -

./query_ripe_db.sh 192.0.2.1

TO-DO:

  • ARIN DB seems to be not very complete
  • LACNIC DB is missing owner-info

About

Parse Ripe Database

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 93.5%
  • Shell 6.5%