Socket
Socket
Sign inDemoInstall

mmdb-writer

Package Overview
Dependencies
2
Maintainers
1
Alerts
File Explorer

Install Socket

Detect and block malicious and high-risk dependencies

Install

    mmdb-writer

Make mmdb format ip library file which can be read by maxmind official language reader


Maintainers
1

Readme

MaxMind-DB-Writer-python

Make mmdb format ip library file which can be read by maxmind official language reader

The official perl writer was written in perl, which was difficult to customize. So I implemented the MaxmindDB format ip library in python language

Install

pip install -U git+https://github.com/VimT/MaxMind-DB-Writer-python

Usage

from netaddr import IPSet

from mmdb_writer import MMDBWriter
writer = MMDBWriter()

writer.insert_network(IPSet(['1.1.0.0/24', '1.1.1.0/24']), {'country': 'COUNTRY', 'isp': 'ISP'})
writer.to_db_file('test.mmdb')

import maxminddb
m = maxminddb.open_database('test.mmdb')
r = m.get('1.1.1.1')
assert r == {'country': 'COUNTRY', 'isp': 'ISP'}

Examples

see csv_to_mmdb.py

Reference:

FAQs


Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc