Metadata-Version: 2.1
Name: CveXplore
Version: 0.3.34
Summary: Package for interacting with cve-search
Home-page: https://github.com/cve-search/CveXplore
Author: Paul Tikken
Author-email: paul.tikken@gmail.com
License: GNU General Public License v3.0
Project-URL: Documentation, https://cve-search.github.io/CveXplore/
Project-URL: Issues, https://github.com/cve-search/CveXplore/issues
Classifier: License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Operating System :: OS Independent
Requires-Python: >=3.10
Description-Content-Type: text/x-rst
License-File: LICENSE
Requires-Dist: aiohttp>=3.8.6
Requires-Dist: aioretry>=5.0.2
Requires-Dist: ansicolors==1.1.8
Requires-Dist: click-completion==0.5.2
Requires-Dist: click==8.1.7
Requires-Dist: dicttoxml==1.7.16
Requires-Dist: ijson>=3.2.3
Requires-Dist: pandas>=2.1.2
Requires-Dist: pygelf>=0.4.2
Requires-Dist: python-dateutil==2.8.2
Requires-Dist: python-dotenv>=1.0.1
Requires-Dist: requests==2.31.0
Requires-Dist: tqdm==4.66.1
Requires-Dist: urllib3>=2.0.6
Requires-Dist: tabulate>=0.9.0
Requires-Dist: pymongo>=4.8.0
Provides-Extra: mysql
Requires-Dist: PyMySQL>=1.1.0; extra == "mysql"
Requires-Dist: alembic>=1.13.0; extra == "mysql"
Requires-Dist: sqlalchemy>=2.0.23; extra == "mysql"
Provides-Extra: kafka
Provides-Extra: sqllite
Requires-Dist: alembic>=1.13.0; extra == "sqllite"
Requires-Dist: sqlalchemy>=2.0.23; extra == "sqllite"
Provides-Extra: celery
Requires-Dist: celery[redis]>=5.3.6; extra == "celery"
Requires-Dist: celery-redbeat>=2.2.0; extra == "celery"
Requires-Dist: pymongo>=4.8.0; extra == "celery"
Requires-Dist: PyMySQL>=1.1.0; extra == "celery"
Requires-Dist: alembic>=1.13.0; extra == "celery"
Requires-Dist: sqlalchemy>=2.0.23; extra == "celery"
Requires-Dist: alembic>=1.13.0; extra == "celery"
Requires-Dist: sqlalchemy>=2.0.23; extra == "celery"
Requires-Dist: alembic>=1.13.0; extra == "celery"
Requires-Dist: sqlalchemy>=2.0.23; extra == "celery"
Provides-Extra: sqlalchemy
Requires-Dist: alembic>=1.13.0; extra == "sqlalchemy"
Requires-Dist: sqlalchemy>=2.0.23; extra == "sqlalchemy"
Provides-Extra: docs
Requires-Dist: sphinx>=7.2.6; extra == "docs"
Requires-Dist: sphinx-immaterial>=0.11.11; extra == "docs"
Requires-Dist: sphinx-click>=5.1.0; extra == "docs"
Requires-Dist: sphinx_sqlalchemy>=0.3.0; extra == "docs"
Provides-Extra: all-db
Requires-Dist: pymongo>=4.8.0; extra == "all-db"
Requires-Dist: PyMySQL>=1.1.0; extra == "all-db"
Requires-Dist: alembic>=1.13.0; extra == "all-db"
Requires-Dist: sqlalchemy>=2.0.23; extra == "all-db"
Requires-Dist: alembic>=1.13.0; extra == "all-db"
Requires-Dist: sqlalchemy>=2.0.23; extra == "all-db"
Requires-Dist: alembic>=1.13.0; extra == "all-db"
Requires-Dist: sqlalchemy>=2.0.23; extra == "all-db"
Provides-Extra: redis
Provides-Extra: postgres
Requires-Dist: alembic>=1.13.0; extra == "postgres"
Requires-Dist: sqlalchemy>=2.0.23; extra == "postgres"
Provides-Extra: mongodb
Requires-Dist: pymongo>=4.8.0; extra == "mongodb"
Provides-Extra: all
Requires-Dist: pymongo>=4.8.0; extra == "all"
Requires-Dist: sphinx-click>=5.1.0; extra == "all"
Requires-Dist: sphinx_sqlalchemy>=0.3.0; extra == "all"
Requires-Dist: PyMySQL>=1.1.0; extra == "all"
Requires-Dist: celery-redbeat>=2.2.0; extra == "all"
Requires-Dist: alembic>=1.13.0; extra == "all"
Requires-Dist: sphinx>=7.2.6; extra == "all"
Requires-Dist: sphinx-immaterial>=0.11.11; extra == "all"
Requires-Dist: sqlalchemy>=2.0.23; extra == "all"
Requires-Dist: celery[redis]>=5.3.6; extra == "all"



.. image:: https://img.shields.io/github/release/cve-search/CveXplore.svg
   :target: https://GitHub.com/cve-search/CveXplore/releases/

.. image:: https://img.shields.io/badge/License-GPLv3-blue.svg
   :target: https://www.gnu.org/licenses/gpl-3.0

.. image:: https://badgen.net/badge/Github/repo/green?icon=github
   :target: https://GitHub.com/cve-search/CveXplore


The CveXplore package aims to provide an object related way to interact with the data collected or hosted by a
cve-search instance. It provides an ambiguous way to interact with either the cve-search mongodb or the cve-search API.

From version 0.2.5 onwards CveXplore has the possibility to initialize and update the database without the need of any of
the cve-search binaries and thus providing the same functionality as cve-search but without the GUI components.

A click command line functionality is being build but for now still in progress...

All the data provided by this interaction is converted into objects before being returned. And thus providing a way to
interact with objects rather then with raw data.

Dependencies
------------
As stated you will need to have one of two things; in order to fully use this package you need access to:

* A cve-search mongodb instance

OR

* A cve-search API instance (will be retired in the 0.4 release)

Both of them can be easily created on a physical machine or via a docker instance of cve-search;
please check `cve-search <https://github.com/cve-search/cve-search>`_ or
`CVE-Search-Docker <https://github.com/cve-search/CVE-Search-Docker>`_ for further details.

Installation
------------
Package is hosted on pypi, so to install the minimal core just run:

.. code-block:: bash

   pip install CveXplore

This command will install the core logic of CveXplore and, by default, installs the mongodb module also.

CveXplore is setup in a modular way and therefor has multiple modules which can be installed separately by specifying
them as an extra requirement. To install the mysql module only, specify:

.. code-block:: bash

   pip install CveXplore[mysql]

Or for multiple modules:

.. code-block:: bash

   pip install CveXplore[mysql, redis]

Or simple install all modules:

.. code-block:: bash

   pip install CveXplore[all]

Documentation
-------------
Check `github pages documentation <https://cve-search.github.io/CveXplore/>`_

General
-------

Configuration
*************

CveXplore automatically creates a config folder in '~/.cvexplore'. CveXplore stores several configuration
files in here such as the .env for general configuration and the .sources.ini for data sources configuration.

Logging
*******

CveXplore stores all logs in the '~/.cvexplore/log' folder:

* update_populate.log; logging produced during database updates and database initialization.

Local Database populate / update
********************************

As of version 0.2.5 CveXplore can populate and update a local mongodb instance from either the command line:

.. code-block:: bash

    $ cvexplore database initialize
    $ cvexplore database update

Check the `CLI Documentation <https://cve-search.github.io/CveXplore/cli/cli.html>`_ for more information.

Or via the the CveXplore object:

.. code-block:: python

    >>> from CveXplore import CveXplore
    >>> cvx = CveXplore()
    >>> cvx.database.populate()
    >>> cvx.database.update()

You can add your `NIST API Key <https://nvd.nist.gov/developers/request-an-api-key>`_ in the environment variable
:code:`NVD_NIST_API_KEY` (e.g., in the :code:`~/.cvexplore/.env` file). You can populate CveXplore without an API key,
but it will limit the amount of parallel requests made to the NIST API.

Package usage
-------------

Instantiation
*************

CveXplore can be instantiated with different parameters, depending to which data source you're going to connect to.
If no parameters are given it is assumed that you're going to connect to a mongodb database running on localhost with
default port and security settings (Cve Search default parameters).

.. code-block:: python

    >>> from CveXplore import CveXplore
    >>> cvx = CveXplore()
    >>> cvx.version
    '0.1.2'

To let CveXplore connect to an mongodb with specific parameters:

.. code-block:: python

    >>> from CveXplore import CveXplore
    >>> cvx = CveXplore(datasource_type="mongodb", datasource_connection_details={"host": "mongodb://127.0.0.1:27017"})
    >>> cvx.version
    '0.1.2'

And to let CveXplore talk to an Cve Search API (only query POST endpoint needed):

.. code-block:: python

   >>> from CveXplore import CveXplore
   >>> cvx = CveXplore(datasource_type="api", datasource_connection_details={"address": ("mylocal.cve-search.int", 443), "api_path": "api"})
   >>> cvx.version
   '0.1.2'

For More options please check the package documentation

Command line usage
------------------

CveXplore has a 'Python Click' (`Documentation <https://click.palletsprojects.com/en/>`_) command line interpreter
available. Click provides an extensive help function to guide you through the different options; also check the full
documentation for examples and usage instructions

.. code-block:: bash

    $ cvexplore --help
    Usage: cvexplore [OPTIONS] COMMAND [ARGS]...

    Options:
      -v, --version  Show the current version and exit
      --help         Show this message and exit.

    Commands:
      capec     Query for capec specific data
      cpe       Query for cpe specific data
      cve       Query for cve specific data
      cwe       Query for cwe specific data
      database  Database update / populate commands
      find      Perform find queries on a single collection
      stats     Show datasource statistics
      tasks     Perform task related operations.
