ctidb


Namectidb JSON
Version 1.1.15 PyPI version JSON
download
home_pagehttps://github.com/aispera/ctidb
Summarycriminalip.ctidb reader
upload_time2025-01-15 01:33:39
maintainerNone
docs_urlNone
authoraispera
requires_python>=3.6
licenseApache License, Version 2.0
keywords aispera ctidb criminalip
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ========================
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:

.. code-block:: bash

    $ 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
-------

.. code-block:: pycon

    >>> 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
-------



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/aispera/ctidb",
    "name": "ctidb",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": null,
    "keywords": "aispera, ctidb, criminalip",
    "author": "aispera",
    "author_email": "infra@aispera.com",
    "download_url": "https://files.pythonhosted.org/packages/70/b8/2dee14c7848518528c01d0d61e99d0e049990a45057fb6d9a05ba5f85fae/ctidb-1.1.15.tar.gz",
    "platform": null,
    "description": "========================\r\nCTI DB Python Module\r\n========================\r\n\r\nDescription\r\n-----------\r\n\r\nThis is a Python module for reading CTI DB files.\r\n\r\nCTI DB is a binary file format that stores data indexed by IP address\r\nsubnets (IPv4 only).\r\n\r\nInstallation\r\n------------\r\n\r\nTo install ctidb, simply:\r\n\r\n.. code-block:: bash\r\n\r\n    $ pip install ctidb\r\n\r\nUsage\r\n-----\r\n\r\nTo use this module, you must first download or create a CTI DB file.\r\n\r\nAfter you have obtained a database and imported the module, call\r\n``CCtiReader`` with a path,\r\nto the database as the first argument. Optionally, you may pass a mode as the\r\nsecond argument. The modes are exported from ``ctidb``. Valid modes are:\r\n\r\n* ``MODE_MEMORY`` - load database into memory. Pure Python.\r\n* ``MODE_AUTO`` - Default.\r\n\r\n**NOTE**:\r\nTo look up an IP address, use the ``get`` method on this object. The method will return the\r\ncorresponding values for the IP address from the database (e.g., a dictionary\r\nfor GeoIP2/GeoLite2 databases). If the database does not contain a record for\r\nthat IP address, the method will return ``None``.\r\n\r\nExample\r\n-------\r\n\r\n.. code-block:: pycon\r\n\r\n    >>> import ctidb\r\n    >>>\r\n    >>> with ctidb.CCtiReader('criminalip.ctidb') as reader:\r\n    >>>\r\n    >>>     reader.get('223.26.31.75')\r\n    {'country': ... }\r\n\r\nExceptions\r\n----------\r\n\r\nThe module will return an ``InvalidDatabaseError`` if the database is corrupt\r\nor otherwise invalid. A ``ValueError`` will be thrown if you look up an\r\ninvalid IP address or an IPv6 address in an IPv4 database.\r\n\r\nRequirements\r\n------------\r\n\r\nThis code requires Python 3.7+. Older versions are not supported.\r\n\r\nVersioning\r\n----------\r\n\r\n\r\n\r\nSupport\r\n-------\r\n\r\n\r\n",
    "bugtrack_url": null,
    "license": "Apache License, Version 2.0",
    "summary": "criminalip.ctidb reader",
    "version": "1.1.15",
    "project_urls": {
        "Homepage": "https://github.com/aispera/ctidb"
    },
    "split_keywords": [
        "aispera",
        " ctidb",
        " criminalip"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "10ed20127e3d51e7d1ec4590acac4542a6e594c82059109b7a8528655a274e36",
                "md5": "aa76e2607229070ee81753a8bb4f4072",
                "sha256": "065b9059aaec6856a477f69402020eee03c1d76dcf082e572f68cbd55305ce54"
            },
            "downloads": -1,
            "filename": "ctidb-1.1.15-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "aa76e2607229070ee81753a8bb4f4072",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 13543,
            "upload_time": "2025-01-15T01:33:38",
            "upload_time_iso_8601": "2025-01-15T01:33:38.054463Z",
            "url": "https://files.pythonhosted.org/packages/10/ed/20127e3d51e7d1ec4590acac4542a6e594c82059109b7a8528655a274e36/ctidb-1.1.15-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "70b82dee14c7848518528c01d0d61e99d0e049990a45057fb6d9a05ba5f85fae",
                "md5": "9867806e5a63bf3caf2c7d4d39efe7cb",
                "sha256": "23bff5b05ba0b4ae9bf6ad7a7f20dc9d93dbb1e474f5b853ea20e4defc8b21d0"
            },
            "downloads": -1,
            "filename": "ctidb-1.1.15.tar.gz",
            "has_sig": false,
            "md5_digest": "9867806e5a63bf3caf2c7d4d39efe7cb",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 13777,
            "upload_time": "2025-01-15T01:33:39",
            "upload_time_iso_8601": "2025-01-15T01:33:39.362607Z",
            "url": "https://files.pythonhosted.org/packages/70/b8/2dee14c7848518528c01d0d61e99d0e049990a45057fb6d9a05ba5f85fae/ctidb-1.1.15.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-01-15 01:33:39",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "aispera",
    "github_project": "ctidb",
    "github_not_found": true,
    "lcname": "ctidb"
}
        
Elapsed time: 1.47656s