Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 29 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ pip install vulncheck-sdk
## Quickstart

```python
import json
import urllib.request
import vulncheck_sdk
import os
Expand All @@ -56,6 +57,7 @@ TOKEN = os.environ["VULNCHECK_API_TOKEN"] # Remember to store your token secure
# Now let's create a configuration object
configuration = vulncheck_sdk.Configuration()
configuration.api_key["Bearer"] = TOKEN
configuration.ignore_operation_servers = True

# Pass that config object to our API client and now...
with vulncheck_sdk.ApiClient(configuration) as api_client:
Expand All @@ -77,10 +79,13 @@ with vulncheck_sdk.ApiClient(configuration) as api_client:
print(cve)

# Download a Backup
backup_client = vulncheck_sdk.BackupApi(api_client)
index = "initial-access"
api_response = endpoints_client.backup_index_get(index)
raw = backup_client.backup_index_get_without_preload_content(index)
response_data = json.loads(raw.read())
download_url = response_data["data"][0]["url"]
file_path = f"{index}.zip"
with urllib.request.urlopen(api_response.data[0].url) as response:
with urllib.request.urlopen(download_url) as response:
with open(file_path, "wb") as file:
file.write(response.read())

Expand All @@ -98,6 +103,7 @@ with vulncheck_sdk.ApiClient(configuration) as api_client:

```python
import asyncio
import json
import os
import aiohttp
import vulncheck_sdk.aio as vcaio
Expand All @@ -107,13 +113,15 @@ TOKEN = os.environ.get("VULNCHECK_API_TOKEN")

configuration = vcaio.Configuration()
configuration.api_key["Bearer"] = TOKEN
configuration.ignore_operation_servers = True


async def run_vulnerability_checks():
# Use 'async with' to manage the ApiClient connection pool
async with vcaio.ApiClient(configuration) as api_client:
endpoints_client = vcaio.EndpointsApi(api_client)
indices_client = vcaio.IndicesApi(api_client)
backup_client = vcaio.BackupApi(api_client)

# --- PURL Search ---
# 'await' the coroutine to get results
Expand All @@ -138,11 +146,12 @@ async def run_vulnerability_checks():

# --- Download Backup (Async) ---
index_name = "initial-access"
# 'await' the coroutine to get results
backup_response = await endpoints_client.backup_index_get(index_name)
# 'await' the coroutine to get raw response bytes
raw = await backup_client.backup_index_get_without_preload_content(index_name)
response_data = json.loads(await raw.read())

if backup_response.data:
download_url = backup_response.data[0].url
if response_data.get("data"):
download_url = response_data["data"][0]["url"]
file_path = f"{index_name}.zip"

print(f"Downloading backup from {download_url}...")
Expand Down Expand Up @@ -314,6 +323,7 @@ if __name__ == "__main__":
Download the backup for an index

```python
import json
import urllib.request
import vulncheck_sdk
import os
Expand All @@ -322,16 +332,19 @@ TOKEN = os.environ["VULNCHECK_API_TOKEN"]

configuration = vulncheck_sdk.Configuration()
configuration.api_key["Bearer"] = TOKEN
configuration.ignore_operation_servers = True

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

index = "initial-access"

api_response = endpoints_client.backup_index_get(index)
raw = backup_client.backup_index_get_without_preload_content(index)
response_data = json.loads(raw.read())
download_url = response_data["data"][0]["url"]

file_path = f"{index}.zip"
with urllib.request.urlopen(api_response.data[0].url) as response:
with urllib.request.urlopen(download_url) as response:
with open(file_path, "wb") as file:
file.write(response.read())
```
Expand All @@ -341,6 +354,7 @@ with vulncheck_sdk.ApiClient(configuration) as api_client:

```python
import asyncio
import json
import os
import urllib.request
import vulncheck_sdk.aio as vcaio
Expand All @@ -350,6 +364,7 @@ TOKEN = os.environ.get("VULNCHECK_API_TOKEN")

configuration = vcaio.Configuration()
configuration.api_key["Bearer"] = TOKEN
configuration.ignore_operation_servers = True


def download_sync(url, file_path):
Expand All @@ -365,23 +380,19 @@ def download_sync(url, file_path):
async def main():
# Use 'async with' to manage the connection life-cycle
async with vcaio.ApiClient(configuration) as api_client:
endpoints_client = vcaio.EndpointsApi(api_client)
backup_client = vcaio.BackupApi(api_client)
index = "initial-access"

# 'await' the coroutine to get the actual response data
api_response = await endpoints_client.backup_index_get(index)

if not api_response.data:
print("No backup URL found.")
return
# 'await' the coroutine to get the raw response bytes
raw = await backup_client.backup_index_get_without_preload_content(index)
response_data = json.loads(await raw.read())
download_url = response_data["data"][0]["url"]

download_url = api_response.data[0].url
file_path = f"{index}.zip"

print(f"Downloading {index} via urllib (offloaded to thread)...")

# Use asyncio.to_thread to run the blocking call safely
# 'await' the coroutine to get the actual response data
await asyncio.to_thread(download_sync, download_url, file_path)

print(f"Successfully saved to {file_path}")
Expand Down
1 change: 1 addition & 0 deletions docs/AdvisoryASRG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Name | Type | Description | Notes
**problem_type** | **str** | | [optional]
**references** | **List[str]** | | [optional]
**title** | **str** | | [optional]
**updated_at** | **str** | | [optional]
**url** | **str** | | [optional]

## Example
Expand Down
1 change: 1 addition & 0 deletions docs/AdvisoryApacheArrow.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Name | Type | Description | Notes
**date_added** | **str** | | [optional]
**summary** | **str** | | [optional]
**title** | **str** | | [optional]
**updated_at** | **str** | | [optional]
**url** | **str** | | [optional]

## Example
Expand Down
1 change: 1 addition & 0 deletions docs/AdvisoryApacheSuperset.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Name | Type | Description | Notes
**cve** | **List[str]** | | [optional]
**date_added** | **str** | | [optional]
**title** | **str** | | [optional]
**updated_at** | **str** | | [optional]
**url** | **str** | | [optional]

## Example
Expand Down
9 changes: 4 additions & 5 deletions docs/AdvisoryCISAAlert.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,17 @@ Name | Type | Description | Notes
**affected_products** | **str** | | [optional]
**alert_id** | **str** | | [optional]
**archived** | **bool** | | [optional]
**cve** | **List[str]** | | [optional]
**cveexploited_itw** | **bool** | | [optional]
**cve_exploited_itw** | **bool** | | [optional]
**cvss** | **str** | | [optional]
**date_added** | **str** | | [optional]
**icsa** | **bool** | | [optional]
**icsma** | **bool** | | [optional]
**mitigations** | **str** | | [optional]
**release_date** | **str** | | [optional]
**title** | **str** | | [optional]
**updated_at** | **str** | | [optional]
**url** | **str** | | [optional]
**vendor** | **str** | | [optional]
**cve** | **List[str]** | | [optional]
**date_added** | **str** | | [optional]
**updated_at** | **str** | | [optional]

## Example

Expand Down
31 changes: 31 additions & 0 deletions docs/AdvisoryCustomCPE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# AdvisoryCustomCPE

advisory.CustomCPE

## Properties

Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**mcpeapplicability** | [**AdvisoryMCPEApplicability**](AdvisoryMCPEApplicability.md) | | [optional]
**string_value** | **str** | | [optional]

## Example

```python
from vulncheck_sdk.models.advisory_custom_cpe import AdvisoryCustomCPE

# TODO update the JSON string below
json = "{}"
# create an instance of AdvisoryCustomCPE from a JSON string
advisory_custom_cpe_instance = AdvisoryCustomCPE.from_json(json)
# print the JSON string representation of the object
print(AdvisoryCustomCPE.to_json())

# convert the object into a dict
advisory_custom_cpe_dict = advisory_custom_cpe_instance.to_dict()
# create an instance of AdvisoryCustomCPE from a dict
advisory_custom_cpe_from_dict = AdvisoryCustomCPE.from_dict(advisory_custom_cpe_dict)
```
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)


1 change: 1 addition & 0 deletions docs/AdvisoryFastly.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Name | Type | Description | Notes
**date_added** | **str** | | [optional]
**summary** | **str** | | [optional]
**title** | **str** | | [optional]
**updated_at** | **str** | | [optional]
**url** | **str** | | [optional]

## Example
Expand Down
1 change: 1 addition & 0 deletions docs/AdvisoryHaskellSADBAdvisory.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Name | Type | Description | Notes
**keywords** | **List[str]** | | [optional]
**references** | **Dict[str, List[str]]** | | [optional]
**related_vulns** | **List[str]** | | [optional]
**updated_at** | **str** | | [optional]

## Example

Expand Down
1 change: 1 addition & 0 deletions docs/AdvisoryMACert.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ Name | Type | Description | Notes
**risks_fr** | **str** | | [optional]
**solution_fr** | **str** | | [optional]
**title_fr** | **str** | | [optional]
**updated_at** | **str** | | [optional]
**url** | **str** | | [optional]

## Example
Expand Down
2 changes: 1 addition & 1 deletion docs/AdvisoryMCna.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ advisory.MCna
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**affected** | [**List[AdvisoryMAffected]**](AdvisoryMAffected.md) | | [optional]
**cpe_applicability** | [**List[AdvisoryMCPEApplicability]**](AdvisoryMCPEApplicability.md) | | [optional]
**cpe_applicability** | [**List[AdvisoryCustomCPE]**](AdvisoryCustomCPE.md) | | [optional]
**credits** | [**List[AdvisoryCredit]**](AdvisoryCredit.md) | | [optional]
**descriptions** | [**List[AdvisoryMDescriptions]**](AdvisoryMDescriptions.md) | | [optional]
**impacts** | [**List[AdvisoryImpact]**](AdvisoryImpact.md) | | [optional]
Expand Down
36 changes: 36 additions & 0 deletions docs/AdvisoryMaliciousVSCodeExts.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# AdvisoryMaliciousVSCodeExts

advisory.MaliciousVSCodeExts

## Properties

Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**date_added** | **str** | | [optional]
**name** | **str** | | [optional]
**publisher** | **str** | | [optional]
**type** | **str** | | [optional]
**updated_at** | **str** | the data in this feed comes from manual curation. so this will likely be omitted. | [optional]
**url** | **str** | | [optional]
**version** | **str** | | [optional]

## Example

```python
from vulncheck_sdk.models.advisory_malicious_vs_code_exts import AdvisoryMaliciousVSCodeExts

# TODO update the JSON string below
json = "{}"
# create an instance of AdvisoryMaliciousVSCodeExts from a JSON string
advisory_malicious_vs_code_exts_instance = AdvisoryMaliciousVSCodeExts.from_json(json)
# print the JSON string representation of the object
print(AdvisoryMaliciousVSCodeExts.to_json())

# convert the object into a dict
advisory_malicious_vs_code_exts_dict = advisory_malicious_vs_code_exts_instance.to_dict()
# create an instance of AdvisoryMaliciousVSCodeExts from a dict
advisory_malicious_vs_code_exts_from_dict = AdvisoryMaliciousVSCodeExts.from_dict(advisory_malicious_vs_code_exts_dict)
```
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)


1 change: 1 addition & 0 deletions docs/AdvisoryNI.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Name | Type | Description | Notes
**ovewrview** | **str** | | [optional]
**references** | **List[str]** | | [optional]
**title** | **str** | | [optional]
**updated_at** | **str** | | [optional]
**url** | **str** | | [optional]

## Example
Expand Down
1 change: 1 addition & 0 deletions docs/AdvisoryPanasonic.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Name | Type | Description | Notes
**date_added** | **str** | | [optional]
**summary** | **str** | | [optional]
**title** | **str** | | [optional]
**updated_at** | **str** | | [optional]
**url** | **str** | | [optional]

## Example
Expand Down
1 change: 1 addition & 0 deletions docs/AdvisoryQualys.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Name | Type | Description | Notes
**date_added** | **str** | | [optional]
**exploits** | **List[str]** | | [optional]
**title** | **str** | | [optional]
**updated_at** | **str** | | [optional]
**url** | **str** | | [optional]

## Example
Expand Down
1 change: 1 addition & 0 deletions docs/AdvisorySSDAdvisory.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Name | Type | Description | Notes
**response_ref** | **str** | | [optional]
**summary** | **str** | | [optional]
**title** | **str** | | [optional]
**updated_at** | **str** | | [optional]

## Example

Expand Down
2 changes: 2 additions & 0 deletions docs/AdvisorySamba.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ Name | Type | Description | Notes
**issues** | **str** | | [optional]
**patches** | **List[str]** | | [optional]
**references** | **List[str]** | | [optional]
**updated_at** | **str** | | [optional]
**url** | **str** | | [optional]

## Example

Expand Down
1 change: 1 addition & 0 deletions docs/AdvisoryTI.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Name | Type | Description | Notes
**incident_id** | **str** | | [optional]
**summary** | **str** | | [optional]
**title** | **str** | | [optional]
**updated_at** | **str** | | [optional]
**url** | **str** | | [optional]

## Example
Expand Down
1 change: 1 addition & 0 deletions docs/AdvisoryTraneTechnology.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Name | Type | Description | Notes
**id** | **str** | | [optional]
**product** | **str** | | [optional]
**summary** | **str** | | [optional]
**updated_at** | **str** | | [optional]
**url** | **str** | | [optional]

## Example
Expand Down
1 change: 1 addition & 0 deletions docs/AdvisoryWithSecure.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Name | Type | Description | Notes
**date_added** | **str** | | [optional]
**summary** | **str** | | [optional]
**title** | **str** | | [optional]
**updated_at** | **str** | | [optional]
**url** | **str** | | [optional]

## Example
Expand Down
2 changes: 2 additions & 0 deletions docs/ApiInitialAccessArtifact.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ Name | Type | Description | Notes
**censys_legacy_raw_queries** | **List[str]** | CensysLegacyRawQueries are raw legacy queries for examining potential Internet-exposed devices & applications with Censys. | [optional]
**censys_queries** | **List[str]** | CensysQueries are queries for examining potential Internet-exposed devices & applications with Censys in URL form. | [optional]
**censys_raw_queries** | **List[str]** | CensysRawQueries are raw queries for examining potential Internet-exposed devices & applications with Censys. | [optional]
**chain** | **List[str]** | Chain can represent the chain of exploitation. | [optional]
**clone_sshurl** | **str** | CloneSSHURL is the git URL to clone the artifact with. | [optional]
**date_added** | **str** | DateAdded is when this artifact entry was first added to the InitialAccess data set. | [optional]
**driftnet_queries** | **List[str]** | DriftnetQueries are queries for examining Internet exposed services with Driftnet. | [optional]
Expand All @@ -28,6 +29,7 @@ Name | Type | Description | Notes
**nmap_script** | **bool** | NmapScript indicates whether or not an nmap script for scanning environment exists in this artifact. | [optional]
**pcap** | **bool** | PCAP indicates whether of not a package capture of the exploit PoC exploiting a vulnerable system exists in this artifact. | [optional]
**product** | **List[str]** | Product are the software that has the vulnerability. | [optional]
**related** | **List[str]** | Related is a set of related cves. | [optional]
**shodan_queries** | **List[str]** | ShodanQueries are queries for examining potential Internet-exposed devices & applications with Shodan in URL form. | [optional]
**shodan_raw_queries** | **List[str]** | ShodanRawQueries are raw queries for examining potential Internet-exposed devices & applications with Shodan. | [optional]
**sigma_rule** | **bool** | SigmaRule indicates whether or not a Sigma rule designed to detect the exploitation of the vulnerability over the network exists in this artifact. | [optional]
Expand Down
Loading
Loading