Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:0sec labs 0 api scan

From Leeroopedia
Knowledge Sources
Domains Binary_Analysis, API, Reporting
Last Updated 2026-10-29 00:00 GMT

Overview

Concrete tool for the single embeddable binary scan entrypoint with versioned result serialization, provided by the 0verse api module.

Description

The scan function is the single embeddable entrypoint to the 0verse pipeline. It decompiles, analyzes, triages, prunes, confirms, and optionally patches a binary, returning a versioned ScanResult (contract v1.5). The process environment is never mutated, so concurrent embedded scans can select different backends safely. result_to_json, result_to_ndjson, and result_to_sarif serialize the result to standard formats.

Usage

Import this function when you need to run a full binary vulnerability scan programmatically. It is the public API used by the CLI (0verse scan), MCP integration, and fleet analysis.

Code Reference

Source Location

  • Repository: 0security
  • File: 0verse/src/zeroverse/api.py:L273-304 (scan), api.py:L350-423 (serializers)

Signature

def scan(
    path: str | Path,
    opts: ScanOptions | None = None,
) -> ScanResult:
    """Decompile + analyze path and return the versioned ScanResult."""

def result_to_json(result: ScanResult) -> str: ...
def result_to_ndjson(result: ScanResult) -> str: ...
def result_to_sarif(result: ScanResult) -> str: ...
def format_result(result: ScanResult, fmt: str) -> str: ...

@dataclass
class ScanOptions:
    backend: str | None = None      # ghidra | rizin | angr | auto
    bug_class: str | None = None    # filter to a single bug class
    llm: str | None = None          # provider: mock | auto | openai | anthropic...
    model: str | None = None        # model name
    confirm_binary: bool = True     # run dynamic confirmation
    profile: str | None = None      # review profile
    budget: dict | None = None      # budget config
    output_dir: str | None = None   # PoV script output
    execution_backend: str | None = None  # local | remote

@dataclass
class ScanResult:
    findings: list[dict]         # id, bug_class, severity, confirmed, hypothesis, pov_path, ...
    stages_run: list[str]
    terminal_state: str
    stage_outcomes: list[dict]

Import

from zeroverse.api import scan, ScanOptions, ScanResult
from zeroverse.api import result_to_json, result_to_ndjson, result_to_sarif, format_result

I/O Contract

Inputs

Name Type Required Description
path Path Yes Binary file to scan
opts ScanOptions No Backend, bug class, LLM, confirmation, budget, output config

Outputs

Name Type Description
return ScanResult Versioned (v1.5) scan result with findings, stages_run, terminal_state

Usage Examples

Basic scan

from zeroverse.api import scan, result_to_json

result = scan("./vulnerable_binary")
print(f"Findings: {len(result.findings)}")
for f in result.findings:
    print(f"  {f['bug_class']}: {f['function']} confirmed={f['confirmed']}")

# Serialize to JSON
print(result_to_json(result))

With options

from zeroverse.api import scan, ScanOptions, result_to_sarif

opts = ScanOptions(
    backend="ghidra",
    llm="mock",           # no API key needed
    confirm_binary=True,
    output_dir="./pov_scripts",
)
result = scan("./target", opts=opts)
sarif_output = result_to_sarif(result)

Related Pages

Implements Principle

Requires Environment

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment