Skip to main content

CLI and client library for BugProve

Project description

BugProve API client

About

BugProve is an automated firmware analysis platform to identify known and zero-day vulnerabilities and to support your compliance needs. As of now, this package contains a CLI interface and a library to call all actions supported by the BugProve public API.

How to install?

You can install bugprove with pip or another Python package manager of your choice:

pip install bugprove

Getting started

CLI

You can use the package directly from the command line to start new scans and wait for scans to finish, facilitating integration with CI/CD pipelines. A valid BugProve API key is required to be set using the BUGPROVE_API_KEY environment variable before commands can be issued.

For example, to start a new scan for the firmware.bin file in the current directory, simply run:

bugprove scan firmware.bin

Check out bugprove scan --help to see the list of options available.

Library

If you wish to interact with other parts of BugProve's public API, you can use the package as a Python library in your own scripts. The library has both high-level and low-level primitives to support interacting with the API.

from io import open
from pathlib import Path

from bugprove.client import BugProveClient, ScanIndirectUploadRequest
from bugprove.internal.models.upload_type import UploadType


async def upload_and_generate_report(input_path: Path, output_path: Path):
    async with BugProveClient() as ctx:
        # Upload a file to scan
        with open(input_path, mode="rb") as input_stream:
            request = ScanIndirectUploadRequest(name="Firmware", upload_type=UploadType.FIRMWARE)
            scan = await ctx.upload_and_scan(input_stream, request)
        await ctx.wait_for_scan(scan.id)

        # List findings
        findings = await ctx.scans.list_findings(scan.id)
        for finding in findings:
            print(f"[{finding.digest}] {finding.short_description}")

        # Generate PDF report
        report = await ctx.reports.create_report(scan.id)
        await ctx.wait_for_report(scan.id, report.revision)
        download = await ctx.reports.download_report(scan.id, report.revision)
        with open(output_path, mode="wb") as output_stream:
            await ctx.download_file(download, output_stream)

In this example code, the API client will try to obtain an API key from the BUGPROVE_API_KEY environment variable. You can also specify the API key explicitly when constructing the client:

    async with BugProveClient(api_key="<API key>") as ctx:

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bugprove-1.0.0.tar.gz (44.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bugprove-1.0.0-py3-none-any.whl (99.4 kB view details)

Uploaded Python 3

File details

Details for the file bugprove-1.0.0.tar.gz.

File metadata

  • Download URL: bugprove-1.0.0.tar.gz
  • Upload date:
  • Size: 44.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.5

File hashes

Hashes for bugprove-1.0.0.tar.gz
Algorithm Hash digest
SHA256 3715ba684e83ed2aa2852120ae4842fed6994f30738c5d767315f88260ae0bad
MD5 384134653695fbe1f4b80d8ccc3a9cd8
BLAKE2b-256 d09accc96c58ed36eb1ea89aa7d5b18c285c4953a8cca209debcfd7108f7fd9c

See more details on using hashes here.

File details

Details for the file bugprove-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: bugprove-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 99.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.5

File hashes

Hashes for bugprove-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e4311614a65af7ab28913ca597df88468a2b9c358d009a9e1bc4a97c61baa008
MD5 684a8619cc8e8691fc6031ee45319da3
BLAKE2b-256 c110aa58511f2aa2326c1af8b0f9ad56e7e08f8989a8849bbb6edcd1441ac7e4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page