Skip to main content

CTI DB Python Module

Description

This is a Python module for reading CTI DB files.

CTI DB is a binary file format that stores data indexed by IP address subnets (IPv4 only).

Installation

To install ctidb, simply:

$ pip install ctidb

Usage

To use this module, you must first download or create a CTI DB file.

After you have obtained a database and imported the module, call CCtiReader with a path, to the database as the first argument. Optionally, you may pass a mode as the second argument. The modes are exported from ctidb. Valid modes are:

  • MODE_MEMORY - load database into memory. Pure Python.

  • MODE_AUTO - Default.

NOTE: To look up an IP address, use the get method on this object. The method will return the corresponding values for the IP address from the database (e.g., a dictionary for GeoIP2/GeoLite2 databases). If the database does not contain a record for that IP address, the method will return None.

Example

>>> import ctidb
>>>
>>> with ctidb.CCtiReader('criminalip.ctidb') as reader:
>>>
>>>     reader.get('223.26.31.75')
{'country': ... }

Exceptions

The module will return an InvalidDatabaseError if the database is corrupt or otherwise invalid. A ValueError will be thrown if you look up an invalid IP address or an IPv6 address in an IPv4 database.

Requirements

This code requires Python 3.7+. Older versions are not supported.

Versioning

Support

Metadata

Release files for ctidb 1.1.16

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ctidb 1.1.16
File Size Uploaded Provenance Actions
ctidb-1.1.16.tar.gz 13.8 kB Without provenance Details for ctidb-1.1.16.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ctidb 1.1.16
File Interpreter ABI Platform Actions
ctidb-1.1.16-py3-none-any.whl Python 3 none any Details for ctidb-1.1.16-py3-none-any.whl

Total release size: 27.3 kB

Release files / ctidb-1.1.16.tar.gz

Download URL ctidb-1.1.16.tar.gz
Size 13.8 kB
Tags Source
SHA-256 checksum
How to use checksums
d8fa080451bcd9e0750f9bd78e185d4351114fbcf6f6605eab671bd79387a394
BLAKE2b-256 checksum
How to use checksums
a74ff5657addc0228756b65d15d76b15d7a808ba84fe9b3c900c4366a14c82aa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.13

Release files / ctidb-1.1.16-py3-none-any.whl

Download URL ctidb-1.1.16-py3-none-any.whl
Size 13.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
caf88bf77eeca3143853e8bcc4848f846fa9e56a8e09d3053ebfa6775765d19d
BLAKE2b-256 checksum
How to use checksums
cbcbdb2a908c2e7a1b164b0f261d679c20a2a62ada4559a849500f0863a823eb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.9.13

Security for ctidb 1.1.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.1.16 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page