VulnCheck API
Project description
The VulnCheck SDK For Python
Bring the VulnCheck API to your Python applications.
Installation
# From PyPi
pip install vulncheck-sdk
[!IMPORTANT] Windows users may need to enable Long Path Support
Resources
Quickstart
import vulncheck_sdk
import os
# 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
import vulncheck_sdk
from vulncheck_sdk.models.v3controllers_purl_response_data import (
V3controllersPurlResponseData,
)
import os
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
import vulncheck_sdk
import os
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
import requests
import vulncheck_sdk
import os
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
import vulncheck_sdk
import os
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
import vulncheck_sdk
import os
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
import vulncheck_sdk
import os
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 for details.
Security
If you discover any security related issues, please create an issue.
Sponsorship
Development of this project is sponsored by VulnCheck learn more about us!
License
Apache License 2.0. Please see License File for more information.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file vulncheck_sdk-0.0.35.tar.gz.
File metadata
- Download URL: vulncheck_sdk-0.0.35.tar.gz
- Upload date:
- Size: 769.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
685ffcb7d14fddcf563cb610bd4c607ef04f5f3a04df2c60be146f813e9b31aa
|
|
| MD5 |
a2a6724bc5830c74ca1d172fd7815b64
|
|
| BLAKE2b-256 |
bf96cefb1883d6745ad6a7a3512190e0fd330927e3b18d71fc94fa05f237d57d
|
Provenance
The following attestation bundles were made for vulncheck_sdk-0.0.35.tar.gz:
Publisher:
release.yml on vulncheck-oss/sdk-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
vulncheck_sdk-0.0.35.tar.gz -
Subject digest:
685ffcb7d14fddcf563cb610bd4c607ef04f5f3a04df2c60be146f813e9b31aa - Sigstore transparency entry: 753499560
- Sigstore integration time:
-
Permalink:
vulncheck-oss/sdk-python@d7b358036299945818490236eeccf300d6a67f01 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/vulncheck-oss
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@d7b358036299945818490236eeccf300d6a67f01 -
Trigger Event:
push
-
Statement type:
File details
Details for the file vulncheck_sdk-0.0.35-py3-none-any.whl.
File metadata
- Download URL: vulncheck_sdk-0.0.35-py3-none-any.whl
- Upload date:
- Size: 2.3 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3cc67c7e0152b20a6d51e2414ac7b0e65dee74cb5b3b53465f52e7eaa16354dd
|
|
| MD5 |
c5abee364922ef1f218f9b3dce51af1c
|
|
| BLAKE2b-256 |
50d334070a67b037d01316da0fbdea8ddd9838332022de0c2ab40b5320e37283
|
Provenance
The following attestation bundles were made for vulncheck_sdk-0.0.35-py3-none-any.whl:
Publisher:
release.yml on vulncheck-oss/sdk-python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
vulncheck_sdk-0.0.35-py3-none-any.whl -
Subject digest:
3cc67c7e0152b20a6d51e2414ac7b0e65dee74cb5b3b53465f52e7eaa16354dd - Sigstore transparency entry: 753499570
- Sigstore integration time:
-
Permalink:
vulncheck-oss/sdk-python@d7b358036299945818490236eeccf300d6a67f01 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/vulncheck-oss
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@d7b358036299945818490236eeccf300d6a67f01 -
Trigger Event:
push
-
Statement type: