<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/a4/0a/839053184f78d3fc15534e4c1994fa29f7a3982073579252f5455a549520/vulncheck_sdk-0.0.7.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.7",
"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": "",
"digests": {
"blake2b_256": "9e15f5bcb1841607d8195801bf228ef1c68086971f5d4c4abb54d09320feab85",
"md5": "a7478ad1566bea02384879a5712fce86",
"sha256": "657e283d4bb1d790ba3a86c08f579d8334126498d2be9d2ec2ad0e48f32188df"
},
"downloads": -1,
"filename": "vulncheck_sdk-0.0.7-py3-none-any.whl",
"has_sig": false,
"md5_digest": "a7478ad1566bea02384879a5712fce86",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.8",
"size": 1793057,
"upload_time": "2025-01-03T17:29:09",
"upload_time_iso_8601": "2025-01-03T17:29:09.275787Z",
"url": "https://files.pythonhosted.org/packages/9e/15/f5bcb1841607d8195801bf228ef1c68086971f5d4c4abb54d09320feab85/vulncheck_sdk-0.0.7-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "a40a839053184f78d3fc15534e4c1994fa29f7a3982073579252f5455a549520",
"md5": "6c0ecd486472b4496bc8f1d4a6f81455",
"sha256": "d3b0c22977bf968b18a5bb8f1e02cf30748e239ad0cc10f7635d736477497b44"
},
"downloads": -1,
"filename": "vulncheck_sdk-0.0.7.tar.gz",
"has_sig": false,
"md5_digest": "6c0ecd486472b4496bc8f1d4a6f81455",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.8",
"size": 340174,
"upload_time": "2025-01-03T17:29:12",
"upload_time_iso_8601": "2025-01-03T17:29:12.286286Z",
"url": "https://files.pythonhosted.org/packages/a4/0a/839053184f78d3fc15534e4c1994fa29f7a3982073579252f5455a549520/vulncheck_sdk-0.0.7.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-01-03 17:29:12",
"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": [
[
">=",
"1.25.3"
],
[
"<",
"3.0.0"
]
]
},
{
"name": "python_dateutil",
"specs": [
[
">=",
"2.8.2"
]
]
},
{
"name": "pydantic",
"specs": [
[
">=",
"2"
]
]
},
{
"name": "typing-extensions",
"specs": [
[
">=",
"4.7.1"
]
]
}
],
"lcname": "vulncheck-sdk"
}