vulncheck-sdk


Namevulncheck-sdk JSON
Version 0.0.8 PyPI version JSON
download
home_pagehttps://github.com/vulncheck-oss/sdk-python
SummaryVulnCheck API
upload_time2025-02-01 01:07:04
maintainerNone
docs_urlNone
authorVulnCheck API Support
requires_python<4.0,>=3.8
licenseApache-2.0
keywords openapi openapi-generator vulncheck api
VCS
bugtrack_url
requirements urllib3 python_dateutil pydantic typing-extensions
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <p align="center">
    <img src="https://raw.githubusercontent.com/vulncheck-oss/sdk-python/refs/heads/main/logo-sdk.png" align="center" alt="VulnCheck Logo" width="150" />
</p>

# The VulnCheck SDK For Python

Bring the VulnCheck API to your Python applications.

[![PyPI - Version](https://badge.fury.io/py/vulncheck-sdk.svg)](https://badge.fury.io/py/vulncheck-sdk)
[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/vulncheck-sdk.svg?logo=python&label=Python&logoColor=gold)](https://pypi.org/project/vulncheck-sdk/)
[![Jupyter](https://img.shields.io/badge/Jupyter-Notebooks-F37626.svg?style=flat&logo=Jupyter)](https://jupyter.org/)

<!--toc:start-->
- [The VulnCheck SDK For Python](#the-vulncheck-sdk-for-python)
  - [Installation](#installation)
  - [Resources](#resources)
  - [Quickstart](#quickstart)
  - [Examples](#examples)
    - [PURL](#purl)
    - [CPE](#cpe)
    - [Backup](#backup)
    - [Indices](#indices)
    - [Index](#index)
    - [Pagination](#pagination)
  - [Contributing](#contributing)
  - [Security](#security)
  - [Sponsorship](#sponsorship)
  - [License](#license)
<!--toc:end-->

## Installation

```sh
# From PyPi
pip install vulncheck-sdk
```

> [!IMPORTANT]
> Windows users may need to enable [Long Path Support](https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=registry#enable-long-paths-in-windows-10-version-1607-and-later)

## Resources

- [OpenAPI Documentation](./vulncheck_sdk_README.md)
- [VulnCheck API Docs](https://docs.vulncheck.com/api)
- [VulnCheck Python SDK Docs](https://docs.vulncheck.com/tools/python-sdk/introduction)

## Quickstart

```python
import vulncheck_sdk

# First let's setup a few variables to help us
DEFAULT_HOST = "https://api.vulncheck.com"
DEFAULT_API = DEFAULT_HOST + "/v3"
TOKEN = os.environ["VULNCHECK_API_TOKEN"] # Remember to store your token securely!

# Now let's create a configuration object
configuration = vulncheck_sdk.Configuration(host=DEFAULT_API)
configuration.api_key["Bearer"] = TOKEN

# Pass that config object to our API client and now...
with vulncheck_sdk.ApiClient(configuration) as api_client:
    # We can use two classes to explore the VulnCheck API: EndpointsApi & IndicesApi

    ### EndpointsApi has methods to query every endpoint except `/v3/index`
    # See the full list of endpoints here: https://docs.vulncheck.com/api
    endpoints_client = vulncheck_sdk.EndpointsApi(api_client)

    # PURL
    api_response = endpoints_client.purl_get("pkg:hex/coherence@0.1.2")
    data: V3controllersPurlResponseData = api_response.data
    print(data.cves)

    # CPE
    cpe = "cpe:/a:microsoft:internet_explorer:8.0.6001:beta"
    api_response = endpoints_client.cpe_get(cpe)
    for cve in api_response.data:
        print(cve)

    # Download a Backup
    api_response = endpoints_client.backup_index_get("initial-access")
    backup_url = requests.get(api_response.data[0].url)
    file_path = f"{index}.zip"
    with open(file_path, "wb") as file:
      file.write(backup_url.content)

    ### IndicesApi has methods for each index
    indices_client = vulncheck_sdk.IndicesApi(api_client)

    # Add query parameters to filter what you need
    api_response = indices_client.index_vulncheck_nvd2_get(cve="CVE-2019-19781")

    print(api_response.data)
```

## Examples

### PURL

Get the CVE's for a given PURL

```python
import vulncheck_sdk
from vulncheck_sdk.models.v3controllers_purl_response_data import (
    V3controllersPurlResponseData,
)

DEFAULT_HOST = "https://api.vulncheck.com"
DEFAULT_API = DEFAULT_HOST + "/v3"
TOKEN = os.environ["VULNCHECK_API_TOKEN"]

configuration = vulncheck_sdk.Configuration(host=DEFAULT_API)
configuration.api_key["Bearer"] = TOKEN

with vulncheck_sdk.ApiClient(configuration) as api_client:
    endpoints_client = vulncheck_sdk.EndpointsApi(api_client)

    purl = "pkg:hex/coherence@0.1.2"

    api_response = endpoints_client.purl_get(purl)
    data: V3controllersPurlResponseData = api_response.data

    print(data.cves)
```

### CPE

Get all CPE's related to a CVE

```python
import vulncheck_sdk

DEFAULT_HOST = "https://api.vulncheck.com"
DEFAULT_API = DEFAULT_HOST + "/v3"
TOKEN = os.environ["VULNCHECK_API_TOKEN"]

configuration = vulncheck_sdk.Configuration(host=DEFAULT_API)
configuration.api_key["Bearer"] = TOKEN

with vulncheck_sdk.ApiClient(configuration) as api_client:
    endpoints_client = vulncheck_sdk.EndpointsApi(api_client)

    cpe = "cpe:/a:microsoft:internet_explorer:8.0.6001:beta"

    api_response = endpoints_client.cpe_get(cpe)

    for cve in api_response.data:
        print(cve)
```

### Backup

Download the backup for an index

```python
import requests
import vulncheck_sdk

DEFAULT_HOST = "https://api.vulncheck.com"
DEFAULT_API = DEFAULT_HOST + "/v3"
TOKEN = os.environ["VULNCHECK_API_TOKEN"]

configuration = vulncheck_sdk.Configuration(host=DEFAULT_API)
configuration.api_key["Bearer"] = TOKEN

with vulncheck_sdk.ApiClient(configuration) as api_client:
    endpoints_client = vulncheck_sdk.EndpointsApi(api_client)

    index = "initial-access"

    api_response = endpoints_client.backup_index_get(index)

    backup_url = requests.get(api_response.data[0].url)

    file_path = f"{index}.zip"
    with open(file_path, "wb") as file:
      file.write(backup_url.content)
```

### Indices

Get all available indices

```python
import vulncheck_sdk

DEFAULT_HOST = "https://api.vulncheck.com"
DEFAULT_API = DEFAULT_HOST + "/v3"
TOKEN = os.environ["VULNCHECK_API_TOKEN"]

configuration = vulncheck_sdk.Configuration(host=DEFAULT_API)
configuration.api_key["Bearer"] = TOKEN

with vulncheck_sdk.ApiClient(configuration) as api_client:
    endpoints_client = vulncheck_sdk.EndpointsApi(api_client)

    api_response = endpoints_client.index_get()

    for index in api_response.data:
        print(index.name)
```

### Index

Query VulnCheck-NVD2 for `CVE-2019-19781`

```python
import vulncheck_sdk

DEFAULT_HOST = "https://api.vulncheck.com"
DEFAULT_API = DEFAULT_HOST + "/v3"
TOKEN = os.environ["VULNCHECK_API_TOKEN"]

configuration = vulncheck_sdk.Configuration(host=DEFAULT_API)
configuration.api_key["Bearer"] = TOKEN

with vulncheck_sdk.ApiClient(configuration) as api_client:
    indices_client = vulncheck_sdk.IndicesApi(api_client)

    api_response = indices_client.index_vulncheck_nvd2_get(cve="CVE-2019-19781")

    print(api_response.data)
```

### Pagination

Paginate over results for a query to VulnCheck-KEV using `cursor`

```python
import vulncheck_sdk

DEFAULT_HOST = "https://api.vulncheck.com"
DEFAULT_API = DEFAULT_HOST + "/v3"
TOKEN = os.environ["VULNCHECK_API_TOKEN"]

configuration = vulncheck_sdk.Configuration(host=DEFAULT_API)
configuration.api_key["Bearer"] = TOKEN

with vulncheck_sdk.ApiClient(configuration) as api_client:
    indices_client = vulncheck_sdk.IndicesApi(api_client)
    api_response = indices_client.index_vulncheck_kev_get(
        start_cursor="true",
        # `limit` increases the size of each page, making it faster
        # to download large datasets
        limit = 300
    )

    print(api_response.data)

    while api_response.meta.next_cursor is not None:
        api_response = indices_client.index_vulncheck_kev_get(
            cursor=api_response.meta.next_cursor
        )
        print(api_response.data)
```

## Contributing

Please see [CONTRIBUTING](./.github/CONTRIBUTING.md) for details.

## Security

If you discover any security related issues, please create an [issue](https://github.com/vulncheck-oss/sdk-python/issues/new?template=1_BUG-FORM.yaml).

## Sponsorship

Development of this project is sponsored by [VulnCheck](https://vulncheck.com/) learn more about us!

## License

Apache License 2.0. Please see [License File](./LICENSE) for more information.


            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/vulncheck-oss/sdk-python",
    "name": "vulncheck-sdk",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.8",
    "maintainer_email": null,
    "keywords": "OpenAPI, OpenAPI-Generator, VulnCheck API",
    "author": "VulnCheck API Support",
    "author_email": "support@vulncheck.com",
    "download_url": "https://files.pythonhosted.org/packages/cb/b0/30cd8516eea9ca37f83b32aec49026abca3c2e2c0dc3ea98773b3de1bc90/vulncheck_sdk-0.0.8.tar.gz",
    "platform": null,
    "description": "<p align=\"center\">\n    <img src=\"https://raw.githubusercontent.com/vulncheck-oss/sdk-python/refs/heads/main/logo-sdk.png\" align=\"center\" alt=\"VulnCheck Logo\" width=\"150\" />\n</p>\n\n# The VulnCheck SDK For Python\n\nBring the VulnCheck API to your Python applications.\n\n[![PyPI - Version](https://badge.fury.io/py/vulncheck-sdk.svg)](https://badge.fury.io/py/vulncheck-sdk)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/vulncheck-sdk.svg?logo=python&label=Python&logoColor=gold)](https://pypi.org/project/vulncheck-sdk/)\n[![Jupyter](https://img.shields.io/badge/Jupyter-Notebooks-F37626.svg?style=flat&logo=Jupyter)](https://jupyter.org/)\n\n<!--toc:start-->\n- [The VulnCheck SDK For Python](#the-vulncheck-sdk-for-python)\n  - [Installation](#installation)\n  - [Resources](#resources)\n  - [Quickstart](#quickstart)\n  - [Examples](#examples)\n    - [PURL](#purl)\n    - [CPE](#cpe)\n    - [Backup](#backup)\n    - [Indices](#indices)\n    - [Index](#index)\n    - [Pagination](#pagination)\n  - [Contributing](#contributing)\n  - [Security](#security)\n  - [Sponsorship](#sponsorship)\n  - [License](#license)\n<!--toc:end-->\n\n## Installation\n\n```sh\n# From PyPi\npip install vulncheck-sdk\n```\n\n> [!IMPORTANT]\n> Windows users may need to enable [Long Path Support](https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=registry#enable-long-paths-in-windows-10-version-1607-and-later)\n\n## Resources\n\n- [OpenAPI Documentation](./vulncheck_sdk_README.md)\n- [VulnCheck API Docs](https://docs.vulncheck.com/api)\n- [VulnCheck Python SDK Docs](https://docs.vulncheck.com/tools/python-sdk/introduction)\n\n## Quickstart\n\n```python\nimport vulncheck_sdk\n\n# First let's setup a few variables to help us\nDEFAULT_HOST = \"https://api.vulncheck.com\"\nDEFAULT_API = DEFAULT_HOST + \"/v3\"\nTOKEN = os.environ[\"VULNCHECK_API_TOKEN\"] # Remember to store your token securely!\n\n# Now let's create a configuration object\nconfiguration = vulncheck_sdk.Configuration(host=DEFAULT_API)\nconfiguration.api_key[\"Bearer\"] = TOKEN\n\n# Pass that config object to our API client and now...\nwith vulncheck_sdk.ApiClient(configuration) as api_client:\n    # We can use two classes to explore the VulnCheck API: EndpointsApi & IndicesApi\n\n    ### EndpointsApi has methods to query every endpoint except `/v3/index`\n    # See the full list of endpoints here: https://docs.vulncheck.com/api\n    endpoints_client = vulncheck_sdk.EndpointsApi(api_client)\n\n    # PURL\n    api_response = endpoints_client.purl_get(\"pkg:hex/coherence@0.1.2\")\n    data: V3controllersPurlResponseData = api_response.data\n    print(data.cves)\n\n    # CPE\n    cpe = \"cpe:/a:microsoft:internet_explorer:8.0.6001:beta\"\n    api_response = endpoints_client.cpe_get(cpe)\n    for cve in api_response.data:\n        print(cve)\n\n    # Download a Backup\n    api_response = endpoints_client.backup_index_get(\"initial-access\")\n    backup_url = requests.get(api_response.data[0].url)\n    file_path = f\"{index}.zip\"\n    with open(file_path, \"wb\") as file:\n      file.write(backup_url.content)\n\n    ### IndicesApi has methods for each index\n    indices_client = vulncheck_sdk.IndicesApi(api_client)\n\n    # Add query parameters to filter what you need\n    api_response = indices_client.index_vulncheck_nvd2_get(cve=\"CVE-2019-19781\")\n\n    print(api_response.data)\n```\n\n## Examples\n\n### PURL\n\nGet the CVE's for a given PURL\n\n```python\nimport vulncheck_sdk\nfrom vulncheck_sdk.models.v3controllers_purl_response_data import (\n    V3controllersPurlResponseData,\n)\n\nDEFAULT_HOST = \"https://api.vulncheck.com\"\nDEFAULT_API = DEFAULT_HOST + \"/v3\"\nTOKEN = os.environ[\"VULNCHECK_API_TOKEN\"]\n\nconfiguration = vulncheck_sdk.Configuration(host=DEFAULT_API)\nconfiguration.api_key[\"Bearer\"] = TOKEN\n\nwith vulncheck_sdk.ApiClient(configuration) as api_client:\n    endpoints_client = vulncheck_sdk.EndpointsApi(api_client)\n\n    purl = \"pkg:hex/coherence@0.1.2\"\n\n    api_response = endpoints_client.purl_get(purl)\n    data: V3controllersPurlResponseData = api_response.data\n\n    print(data.cves)\n```\n\n### CPE\n\nGet all CPE's related to a CVE\n\n```python\nimport vulncheck_sdk\n\nDEFAULT_HOST = \"https://api.vulncheck.com\"\nDEFAULT_API = DEFAULT_HOST + \"/v3\"\nTOKEN = os.environ[\"VULNCHECK_API_TOKEN\"]\n\nconfiguration = vulncheck_sdk.Configuration(host=DEFAULT_API)\nconfiguration.api_key[\"Bearer\"] = TOKEN\n\nwith vulncheck_sdk.ApiClient(configuration) as api_client:\n    endpoints_client = vulncheck_sdk.EndpointsApi(api_client)\n\n    cpe = \"cpe:/a:microsoft:internet_explorer:8.0.6001:beta\"\n\n    api_response = endpoints_client.cpe_get(cpe)\n\n    for cve in api_response.data:\n        print(cve)\n```\n\n### Backup\n\nDownload the backup for an index\n\n```python\nimport requests\nimport vulncheck_sdk\n\nDEFAULT_HOST = \"https://api.vulncheck.com\"\nDEFAULT_API = DEFAULT_HOST + \"/v3\"\nTOKEN = os.environ[\"VULNCHECK_API_TOKEN\"]\n\nconfiguration = vulncheck_sdk.Configuration(host=DEFAULT_API)\nconfiguration.api_key[\"Bearer\"] = TOKEN\n\nwith vulncheck_sdk.ApiClient(configuration) as api_client:\n    endpoints_client = vulncheck_sdk.EndpointsApi(api_client)\n\n    index = \"initial-access\"\n\n    api_response = endpoints_client.backup_index_get(index)\n\n    backup_url = requests.get(api_response.data[0].url)\n\n    file_path = f\"{index}.zip\"\n    with open(file_path, \"wb\") as file:\n      file.write(backup_url.content)\n```\n\n### Indices\n\nGet all available indices\n\n```python\nimport vulncheck_sdk\n\nDEFAULT_HOST = \"https://api.vulncheck.com\"\nDEFAULT_API = DEFAULT_HOST + \"/v3\"\nTOKEN = os.environ[\"VULNCHECK_API_TOKEN\"]\n\nconfiguration = vulncheck_sdk.Configuration(host=DEFAULT_API)\nconfiguration.api_key[\"Bearer\"] = TOKEN\n\nwith vulncheck_sdk.ApiClient(configuration) as api_client:\n    endpoints_client = vulncheck_sdk.EndpointsApi(api_client)\n\n    api_response = endpoints_client.index_get()\n\n    for index in api_response.data:\n        print(index.name)\n```\n\n### Index\n\nQuery VulnCheck-NVD2 for `CVE-2019-19781`\n\n```python\nimport vulncheck_sdk\n\nDEFAULT_HOST = \"https://api.vulncheck.com\"\nDEFAULT_API = DEFAULT_HOST + \"/v3\"\nTOKEN = os.environ[\"VULNCHECK_API_TOKEN\"]\n\nconfiguration = vulncheck_sdk.Configuration(host=DEFAULT_API)\nconfiguration.api_key[\"Bearer\"] = TOKEN\n\nwith vulncheck_sdk.ApiClient(configuration) as api_client:\n    indices_client = vulncheck_sdk.IndicesApi(api_client)\n\n    api_response = indices_client.index_vulncheck_nvd2_get(cve=\"CVE-2019-19781\")\n\n    print(api_response.data)\n```\n\n### Pagination\n\nPaginate over results for a query to VulnCheck-KEV using `cursor`\n\n```python\nimport vulncheck_sdk\n\nDEFAULT_HOST = \"https://api.vulncheck.com\"\nDEFAULT_API = DEFAULT_HOST + \"/v3\"\nTOKEN = os.environ[\"VULNCHECK_API_TOKEN\"]\n\nconfiguration = vulncheck_sdk.Configuration(host=DEFAULT_API)\nconfiguration.api_key[\"Bearer\"] = TOKEN\n\nwith vulncheck_sdk.ApiClient(configuration) as api_client:\n    indices_client = vulncheck_sdk.IndicesApi(api_client)\n    api_response = indices_client.index_vulncheck_kev_get(\n        start_cursor=\"true\",\n        # `limit` increases the size of each page, making it faster\n        # to download large datasets\n        limit = 300\n    )\n\n    print(api_response.data)\n\n    while api_response.meta.next_cursor is not None:\n        api_response = indices_client.index_vulncheck_kev_get(\n            cursor=api_response.meta.next_cursor\n        )\n        print(api_response.data)\n```\n\n## Contributing\n\nPlease see [CONTRIBUTING](./.github/CONTRIBUTING.md) for details.\n\n## Security\n\nIf you discover any security related issues, please create an [issue](https://github.com/vulncheck-oss/sdk-python/issues/new?template=1_BUG-FORM.yaml).\n\n## Sponsorship\n\nDevelopment of this project is sponsored by [VulnCheck](https://vulncheck.com/) learn more about us!\n\n## License\n\nApache License 2.0. Please see [License File](./LICENSE) for more information.\n\n",
    "bugtrack_url": null,
    "license": "Apache-2.0",
    "summary": "VulnCheck API",
    "version": "0.0.8",
    "project_urls": {
        "Homepage": "https://github.com/vulncheck-oss/sdk-python",
        "Repository": "https://github.com/vulncheck-oss/sdk-python"
    },
    "split_keywords": [
        "openapi",
        " openapi-generator",
        " vulncheck api"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "14aaf2e9700c899d84ae84d3eafbbeffa745881a3e5e245e80c928f77ff68018",
                "md5": "249bd07745598c2ecd04bd96a703e758",
                "sha256": "2f4ee6e4932da2ec0dde0ad2e5d74325e8c92379c55b488189c8779b7002bf82"
            },
            "downloads": -1,
            "filename": "vulncheck_sdk-0.0.8-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "249bd07745598c2ecd04bd96a703e758",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.8",
            "size": 1792692,
            "upload_time": "2025-02-01T01:07:01",
            "upload_time_iso_8601": "2025-02-01T01:07:01.194033Z",
            "url": "https://files.pythonhosted.org/packages/14/aa/f2e9700c899d84ae84d3eafbbeffa745881a3e5e245e80c928f77ff68018/vulncheck_sdk-0.0.8-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "cbb030cd8516eea9ca37f83b32aec49026abca3c2e2c0dc3ea98773b3de1bc90",
                "md5": "0ecac7774ccf7aec6b25fbcbb09a08e9",
                "sha256": "0e2b3dc0df5af9e1934fcabb6b173ebd9e825ae2775e514c1f97590fac9bcc8e"
            },
            "downloads": -1,
            "filename": "vulncheck_sdk-0.0.8.tar.gz",
            "has_sig": false,
            "md5_digest": "0ecac7774ccf7aec6b25fbcbb09a08e9",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.8",
            "size": 340394,
            "upload_time": "2025-02-01T01:07:04",
            "upload_time_iso_8601": "2025-02-01T01:07:04.942037Z",
            "url": "https://files.pythonhosted.org/packages/cb/b0/30cd8516eea9ca37f83b32aec49026abca3c2e2c0dc3ea98773b3de1bc90/vulncheck_sdk-0.0.8.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-02-01 01:07:04",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "vulncheck-oss",
    "github_project": "sdk-python",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "urllib3",
            "specs": [
                [
                    "<",
                    "3.0.0"
                ],
                [
                    ">=",
                    "1.25.3"
                ]
            ]
        },
        {
            "name": "python_dateutil",
            "specs": [
                [
                    ">=",
                    "2.8.2"
                ]
            ]
        },
        {
            "name": "pydantic",
            "specs": [
                [
                    ">=",
                    "2"
                ]
            ]
        },
        {
            "name": "typing-extensions",
            "specs": [
                [
                    ">=",
                    "4.7.1"
                ]
            ]
        }
    ],
    "lcname": "vulncheck-sdk"
}
        
Elapsed time: 0.44879s