Skip to main content

Simplified BriskSec Toolbox Wrapper SDK for Python - focused on output parsing and event generation

Project description

BriskSec Toolbox Wrapper SDK for Python

A simplified Python SDK for parsing security tool outputs and generating events and findings. The Go runtime handles all the complex wrapper logic, messaging, HTTP servers, and pub/sub functionality.

Philosophy

This SDK follows a simple philosophy:

  • Focus on parsing: Your Python code should only focus on parsing tool outputs
  • Let Go handle complexity: The Go runtime manages all wrapper infrastructure
  • Type generation: Use tools/typegen to generate Python types from Go structs

Installation

pip install -e .

Usage

Basic Parser

Create a parser by extending OutputParser:

from brisksec_toolbox_wrapper_sdk import OutputParser, Event, Finding

class MyToolParser(OutputParser):
    def parse_output(self, output: str, metadata=None):
        events = []
        findings = []
        
        # Parse your tool output here
        # Convert to events and findings
        
        return {
            "events": events,
            "findings": findings
        }

Events vs Findings

  • Events: Use for asset discovery (IPs, ports, domains, etc.)
  • Findings: Use for security vulnerabilities and issues

Example: Nmap Parser

from brisksec_toolbox_wrapper_sdk import OutputParser, AssetIPEvent, AssetPortEvent

class NmapParser(OutputParser):
    def parse_output(self, output: str, metadata=None):
        events = []
        # Parse XML and create events
        events.append(AssetIPEvent(ip="192.168.1.1"))
        events.append(AssetPortEvent(ip="192.168.1.1", port="80", protocol="tcp"))
        
        return {"events": events, "findings": []}

Type Generation

The Python types are auto-generated from Go structs using tools/typegen. To regenerate types:

cd tools/typegen
go run main.go

This ensures that Python types stay in sync with the Go runtime types.

Removed Complexity

In this simplified version, we removed:

  • Complex wrapper base classes
  • HTTP server logic (FastAPI/uvicorn)
  • Message handling infrastructure
  • Pub/sub logic
  • Command execution utilities

All of this is now handled by the Go runtime, making the Python SDK focused and lightweight.

Migration from v0.1.x

If you were using the old wrapper classes:

Old approach:

class MyWrapper(BaseWrapper):
    def handle_scan(self, message):
        # Complex message handling
        pass

New approach:

class MyParser(OutputParser):
    def parse_output(self, output, metadata=None):
        # Simple output parsing
        return {"events": [], "findings": []}

The Go runtime will call your parser and handle all the infrastructure.

Development

Running Tests

pytest tests/

Code Formatting

black .
isort .

Type Checking

mypy brisksec_toolbox_wrapper_sdk/

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

brisksec_toolbox_wrapper_sdk-0.2.0.tar.gz (7.4 kB view details)

Uploaded Source

Built Distribution

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

brisksec_toolbox_wrapper_sdk-0.2.0-py3-none-any.whl (9.8 kB view details)

Uploaded Python 3

File details

Details for the file brisksec_toolbox_wrapper_sdk-0.2.0.tar.gz.

File metadata

File hashes

Hashes for brisksec_toolbox_wrapper_sdk-0.2.0.tar.gz
Algorithm Hash digest
SHA256 3555f04deeb138333de58eafd57ba558dd003046c95b8b12eab86725510dd58c
MD5 8e30c148ed1dbf8795cae81cb7a90d01
BLAKE2b-256 c6274e1c1486588d2d2ad15319a19afdd2398450b0449d8809e918d146d0f22a

See more details on using hashes here.

Provenance

The following attestation bundles were made for brisksec_toolbox_wrapper_sdk-0.2.0.tar.gz:

Publisher: publish.yml on BriskStack/brisksec-toolbox-wrapper-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file brisksec_toolbox_wrapper_sdk-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for brisksec_toolbox_wrapper_sdk-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f9807f8b31425894cb959865f20bcb6ebd0eb21a1098e595b71cf560e3a75578
MD5 8b2abff78f25d84fb563be5fe7146d62
BLAKE2b-256 6969babbe54620f0f2720898951bf32b6a1db6a6fa3077f25f6639573a6e77f2

See more details on using hashes here.

Provenance

The following attestation bundles were made for brisksec_toolbox_wrapper_sdk-0.2.0-py3-none-any.whl:

Publisher: publish.yml on BriskStack/brisksec-toolbox-wrapper-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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