Skip to main content

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

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
ctidb-1.1.16.tar.gz 13.8 kB Details

Built distribution (wheel)

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

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

Release history Release notifications | RSS feed

This release

1.1.16 This release

2 release files

1.1.15

2 release files

1.1.14

2 release files

1.1.11

2 release files

1.1.9

2 release files

1.1.8

2 release files

1.1.7

2 release files

1.1.6

2 release files

1.1.5

2 release files

1.1.3

2 release files

1.1.2

2 release files

1.1.1

2 release files

0.0.15

2 release files

0.0.14

2 release files

0.0.13

2 release files

0.0.12

2 release files

0.0.11

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

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