nvd-api


Namenvd-api JSON
Version 0.5.0 PyPI version JSON
download
home_pagehttps://github.com/kannkyo/nvd-api
SummaryNVD API 2.0 Python API
upload_time2023-02-11 02:09:57
maintainer
docs_urlNone
authorkannkyo
requires_python>=3.8,<4.0
license
keywords nvd security vulnerability
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            =================
NVD API Client
=================


NVD API client is a community driven NVD API 2.0 client. 
This client support `Vulnerabilities`_ API and `Products`_ API.

.. _Vulnerabilities: https://nvd.nist.gov/developers/vulnerabilities
.. _Products: https://nvd.nist.gov/developers/products

.. image:: https://badge.fury.io/py/nvd-api.svg
    :target: https://badge.fury.io/py/nvd-api

.. image:: https://github.com/kannkyo/nvd-api/actions/workflows/python-ci.yml/badge.svg
    :target: https://github.com/kannkyo/nvd-api/actions/workflows/python-ci.yml

.. image:: https://codecov.io/gh/kannkyo/nvd-api/branch/main/graph/badge.svg?token=ASYLVG3X9O
    :target: https://codecov.io/gh/kannkyo/nvd-api

.. image:: https://github.com/kannkyo/nvd-api/actions/workflows/scorecards.yml/badge.svg
    :target: https://github.com/kannkyo/nvd-api/actions/workflows/scorecards.yml

.. image:: https://bestpractices.coreinfrastructure.org/projects/6889/badge
    :target: https://bestpractices.coreinfrastructure.org/projects/6889

Getting Start
=============

Products / CPE API
---------------------

This API's simple example is bellow.

.. code-block:: python

    from client import NvdApiClient
    from pprint import pprint

    client = NvdApiClient()

    response = client.get_cpes(
        cpe_name_id="87316812-5F2C-4286-94FE-CC98B9EAEF53",
        results_per_page=1,
        start_index=0
    )
    pprint(response)

`get_cpes` method check API's all constraints and limitations.

* cpeNameId and matchCriteriaId must be uuid format.
* cpeMatchString must be CPEv2.3 format.
* If filtering by keywordExactMatch, keywordSearch is REQUIRED.
* If filtering by the last modified date, both lastModStartDate and lastModEndDate are REQUIRED.
* resultsPerPage's maximum allowable limit is 10,000.
* The maximum allowable range when using any date range parameters is 120 consecutive days.

Products / Match Criteria API
-----------------------------

This API's simple example is bellow.

.. code-block:: python

    from nvd_api import NvdApiClient
    from pprint import pprint

    client = NvdApiClient()

    response = client.get_cpe_match(
        cve_id="CVE-2022-32223",
        results_per_page=1,
        start_index=0
    )
    pprint(response)

`get_cpe_match` method check API's all constraints and limitations.

* cveId is must be CVE ID format.
* If filtering by the last modified date, both lastModStartDate and lastModEndDate are REQUIRED.
* matchCriteriaId must be uuid format.
* resultsPerPage's maximum allowable limit is 5,000.
* The maximum allowable range when using any date range parameters is 120 consecutive days.
* cpeName must be CPEv2.3 format.

Vulnerabilities / CVE API
---------------------------

This API's simple example is bellow.

.. code-block:: python

    from nvd_api import NvdApiClient
    from pprint import pprint

    client = NvdApiClient()

    response = client.get_cves(
        cpe_name="cpe:2.3:o:debian:debian_linux:3.0:*:*:*:*:*:*:*",
        cvss_v2_metrics="AV:L/AC:L/Au:N/C:C/I:C/A:C",
        cvss_v2_severity="HIGH",
        results_per_page=1,
        start_index=1
    )
    pprint(response)

* cpeName must be CPEv2.3 format.
* cveId is must be CVE ID format.
* cvssV2Severity, cvssV2Metrics is must be CVSS v2 format.
* cvssV3Severity, cvssV3Metrics is must be CVSS v3 format.
* cweId is must be CWE ID format.
* resultsPerPage's maximum allowable limit is 2,000.
* If filtering by keywordExactMatch, keywordSearch is REQUIRED.
* If filtering by the last modified date, both lastModStartDate and lastModEndDate are REQUIRED.
* If filtering by the last modified date, both pubStartDate and pubEndDate are REQUIRED.
* The maximum allowable range when using any date range parameters is 120 consecutive days.
* cvssV2Metrics cannot be used in requests that include cvssV3Metrics.
* cvssV3Metrics cannot be used in requests that include cvssV2Metrics.
* cvssV2Severity cannot be used in requests that include cvssV3Severity.
* cvssV3Severity cannot be used in requests that include cvssV2Severity.

Vulnerabilities / CVE Change History API
-------------------------------------------

This API's simple example is bellow.

.. code-block:: python

    from nvd_api import NvdApiClient
    from pprint import pprint

    client = NvdApiClient()

    response = client.get_cve_history(
        change_start_date="2021-08-04T00:00:00.000",
        change_end_date="2021-10-23T00:00:00.000",
        event_name="CVE Rejected",
        results_per_page=1,
        start_index=1
    )
    pprint(response)

`get_cve_history` method check API's all constraints and limitations.

* If filtering by the change date, both changeStartDate and changeEndDate are REQUIRED.
* cveId is must be CVE ID format.
* resultsPerPage's maximum allowable limit is 5,000.
* The maximum allowable range when using any date range parameters is 120 consecutive days.

With API Key
---------------------

If you have the nvd api key, you can set key to client.

.. code-block:: python

    from nvd_api import NvdApiClient
    from pprint import pprint

    client = NvdApiClient(wait_time=1 * 1000, api_key='THIS IS API KEY')

    response = client.get_cves(
        cpe_name="cpe:2.3:o:debian:debian_linux:3.0:*:*:*:*:*:*:*",
        cvss_v2_metrics="AV:L/AC:L/Au:N/C:C/I:C/A:C",
        cvss_v2_severity="HIGH",
        results_per_page=1,
        start_index=1
    )
    pprint(response)

* api_key : api key published by nvd.
* wait_time : interval time to execute api (with api key is 50 requests in a rolling 30s window, without api key is 5 requests in a rolling 30s window)


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/kannkyo/nvd-api",
    "name": "nvd-api",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8,<4.0",
    "maintainer_email": "",
    "keywords": "NVD,security,vulnerability",
    "author": "kannkyo",
    "author_email": "15080890+kannkyo@users.noreply.github.com",
    "download_url": "https://files.pythonhosted.org/packages/18/07/ed33a8e8cd29207b4d97a3126efdf8fa3a35fb37f4c292c0de857bdcd5fe/nvd_api-0.5.0.tar.gz",
    "platform": null,
    "description": "=================\nNVD API Client\n=================\n\n\nNVD API client is a community driven NVD API 2.0 client. \nThis client support `Vulnerabilities`_ API and `Products`_ API.\n\n.. _Vulnerabilities: https://nvd.nist.gov/developers/vulnerabilities\n.. _Products: https://nvd.nist.gov/developers/products\n\n.. image:: https://badge.fury.io/py/nvd-api.svg\n    :target: https://badge.fury.io/py/nvd-api\n\n.. image:: https://github.com/kannkyo/nvd-api/actions/workflows/python-ci.yml/badge.svg\n    :target: https://github.com/kannkyo/nvd-api/actions/workflows/python-ci.yml\n\n.. image:: https://codecov.io/gh/kannkyo/nvd-api/branch/main/graph/badge.svg?token=ASYLVG3X9O\n    :target: https://codecov.io/gh/kannkyo/nvd-api\n\n.. image:: https://github.com/kannkyo/nvd-api/actions/workflows/scorecards.yml/badge.svg\n    :target: https://github.com/kannkyo/nvd-api/actions/workflows/scorecards.yml\n\n.. image:: https://bestpractices.coreinfrastructure.org/projects/6889/badge\n    :target: https://bestpractices.coreinfrastructure.org/projects/6889\n\nGetting Start\n=============\n\nProducts / CPE API\n---------------------\n\nThis API's simple example is bellow.\n\n.. code-block:: python\n\n    from client import NvdApiClient\n    from pprint import pprint\n\n    client = NvdApiClient()\n\n    response = client.get_cpes(\n        cpe_name_id=\"87316812-5F2C-4286-94FE-CC98B9EAEF53\",\n        results_per_page=1,\n        start_index=0\n    )\n    pprint(response)\n\n`get_cpes` method check API's all constraints and limitations.\n\n* cpeNameId and matchCriteriaId must be uuid format.\n* cpeMatchString must be CPEv2.3 format.\n* If filtering by keywordExactMatch, keywordSearch is REQUIRED.\n* If filtering by the last modified date, both lastModStartDate and lastModEndDate are REQUIRED.\n* resultsPerPage's maximum allowable limit is 10,000.\n* The maximum allowable range when using any date range parameters is 120 consecutive days.\n\nProducts / Match Criteria API\n-----------------------------\n\nThis API's simple example is bellow.\n\n.. code-block:: python\n\n    from nvd_api import NvdApiClient\n    from pprint import pprint\n\n    client = NvdApiClient()\n\n    response = client.get_cpe_match(\n        cve_id=\"CVE-2022-32223\",\n        results_per_page=1,\n        start_index=0\n    )\n    pprint(response)\n\n`get_cpe_match` method check API's all constraints and limitations.\n\n* cveId is must be CVE ID format.\n* If filtering by the last modified date, both lastModStartDate and lastModEndDate are REQUIRED.\n* matchCriteriaId must be uuid format.\n* resultsPerPage's maximum allowable limit is 5,000.\n* The maximum allowable range when using any date range parameters is 120 consecutive days.\n* cpeName must be CPEv2.3 format.\n\nVulnerabilities / CVE API\n---------------------------\n\nThis API's simple example is bellow.\n\n.. code-block:: python\n\n    from nvd_api import NvdApiClient\n    from pprint import pprint\n\n    client = NvdApiClient()\n\n    response = client.get_cves(\n        cpe_name=\"cpe:2.3:o:debian:debian_linux:3.0:*:*:*:*:*:*:*\",\n        cvss_v2_metrics=\"AV:L/AC:L/Au:N/C:C/I:C/A:C\",\n        cvss_v2_severity=\"HIGH\",\n        results_per_page=1,\n        start_index=1\n    )\n    pprint(response)\n\n* cpeName must be CPEv2.3 format.\n* cveId is must be CVE ID format.\n* cvssV2Severity, cvssV2Metrics is must be CVSS v2 format.\n* cvssV3Severity, cvssV3Metrics is must be CVSS v3 format.\n* cweId is must be CWE ID format.\n* resultsPerPage's maximum allowable limit is 2,000.\n* If filtering by keywordExactMatch, keywordSearch is REQUIRED.\n* If filtering by the last modified date, both lastModStartDate and lastModEndDate are REQUIRED.\n* If filtering by the last modified date, both pubStartDate and pubEndDate are REQUIRED.\n* The maximum allowable range when using any date range parameters is 120 consecutive days.\n* cvssV2Metrics cannot be used in requests that include cvssV3Metrics.\n* cvssV3Metrics cannot be used in requests that include cvssV2Metrics.\n* cvssV2Severity cannot be used in requests that include cvssV3Severity.\n* cvssV3Severity cannot be used in requests that include cvssV2Severity.\n\nVulnerabilities / CVE Change History API\n-------------------------------------------\n\nThis API's simple example is bellow.\n\n.. code-block:: python\n\n    from nvd_api import NvdApiClient\n    from pprint import pprint\n\n    client = NvdApiClient()\n\n    response = client.get_cve_history(\n        change_start_date=\"2021-08-04T00:00:00.000\",\n        change_end_date=\"2021-10-23T00:00:00.000\",\n        event_name=\"CVE Rejected\",\n        results_per_page=1,\n        start_index=1\n    )\n    pprint(response)\n\n`get_cve_history` method check API's all constraints and limitations.\n\n* If filtering by the change date, both changeStartDate and changeEndDate are REQUIRED.\n* cveId is must be CVE ID format.\n* resultsPerPage's maximum allowable limit is 5,000.\n* The maximum allowable range when using any date range parameters is 120 consecutive days.\n\nWith API Key\n---------------------\n\nIf you have the nvd api key, you can set key to client.\n\n.. code-block:: python\n\n    from nvd_api import NvdApiClient\n    from pprint import pprint\n\n    client = NvdApiClient(wait_time=1 * 1000, api_key='THIS IS API KEY')\n\n    response = client.get_cves(\n        cpe_name=\"cpe:2.3:o:debian:debian_linux:3.0:*:*:*:*:*:*:*\",\n        cvss_v2_metrics=\"AV:L/AC:L/Au:N/C:C/I:C/A:C\",\n        cvss_v2_severity=\"HIGH\",\n        results_per_page=1,\n        start_index=1\n    )\n    pprint(response)\n\n* api_key : api key published by nvd.\n* wait_time : interval time to execute api (with api key is 50 requests in a rolling 30s window, without api key is 5 requests in a rolling 30s window)\n\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "NVD API 2.0 Python API",
    "version": "0.5.0",
    "split_keywords": [
        "nvd",
        "security",
        "vulnerability"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ed117f36f3bbe219d6516a2ab8dabe4ba13eb081597ab6abaac0f304d8383cba",
                "md5": "24446f61ed53e4920b5291ca011a0760",
                "sha256": "609dca65503687cd3f8f8847f664324ca026e869a527f6277879339fb16ebd4c"
            },
            "downloads": -1,
            "filename": "nvd_api-0.5.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "24446f61ed53e4920b5291ca011a0760",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8,<4.0",
            "size": 146021,
            "upload_time": "2023-02-11T02:09:55",
            "upload_time_iso_8601": "2023-02-11T02:09:55.594555Z",
            "url": "https://files.pythonhosted.org/packages/ed/11/7f36f3bbe219d6516a2ab8dabe4ba13eb081597ab6abaac0f304d8383cba/nvd_api-0.5.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1807ed33a8e8cd29207b4d97a3126efdf8fa3a35fb37f4c292c0de857bdcd5fe",
                "md5": "0e87f2860d0ed03a391d379045054fba",
                "sha256": "91ed66fe8dff183f5ef7523a1ec30a88d99e6ec1682a845409fe22a57af0f84c"
            },
            "downloads": -1,
            "filename": "nvd_api-0.5.0.tar.gz",
            "has_sig": false,
            "md5_digest": "0e87f2860d0ed03a391d379045054fba",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8,<4.0",
            "size": 67077,
            "upload_time": "2023-02-11T02:09:57",
            "upload_time_iso_8601": "2023-02-11T02:09:57.195310Z",
            "url": "https://files.pythonhosted.org/packages/18/07/ed33a8e8cd29207b4d97a3126efdf8fa3a35fb37f4c292c0de857bdcd5fe/nvd_api-0.5.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-02-11 02:09:57",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "kannkyo",
    "github_project": "nvd-api",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "nvd-api"
}
        
Elapsed time: 0.04441s