Skip to content

Reflex tools

Experimental

Tested against recorded tool output only so far; the API may change in minor releases.

Wrappers for the standalone Reflex Rust CLIs. Install the tools as described in Installation.

tools

Thin wrappers around the standalone Reflex Rust CLIs.

Each tool is a separate project, installed with cargo install --git https://github.com/reflex-hs/<name> (they are not on crates.io yet); hwntools runs it with --json and parses the result into dataclasses:

  • fwsift.scan - firmware rootfs / image triage
  • bootlint.audit - U-Boot env, FIT/DTB, kernel config audit
  • baudhound.analyze - UART detection in logic-analyzer captures
  • mcpwarden.scan - MCP server config / tool metadata audit

Binaries are found via $HWNTOOLS_<NAME>, PATH or ~/.cargo/bin.

SEVERITIES module-attribute

SEVERITIES: tuple[Severity, ...] = ('info', 'low', 'medium', 'high', 'critical')

Finding dataclass

Finding(tool: str, rule_id: str, severity: str, message: str, title: str = '', path: str | None = None, line: int | None = None, offset: int | None = None, location: str | None = None, evidence: str | None = None, raw: Mapping[str, Any] = dict())

One finding from any tool, normalised to common fields. raw keeps the original.

to_dict

to_dict() -> dict[str, Any]

The normalised fields as a dict (without raw).

Report dataclass

Report(tool: str, version: str, findings: list[Finding], raw: dict[str, Any], exit_code: int = 0)

Common report shape. Tool-specific subclasses add more fields.

max_severity property

max_severity: str | None

The highest severity among the findings, or None without findings.

counts

counts() -> dict[str, int]

Findings per severity (all five keys present).

at_least

at_least(severity: str) -> list[Finding]

Findings at or above severity.

ToolError

ToolError(message: str, returncode: int | None = None, stderr: str = '')

Bases: HwnError

An external tool failed (bad input, I/O error, invalid output).

find_tool

find_tool(name: str) -> str

Locate the name binary.

Order: $HWNTOOLS_<NAME> (path to the executable), PATH, ~/.cargo/bin. Raises ToolNotFoundError with an install hint.

severity_rank

severity_rank(sev: str) -> int

Position of sev in info < low < medium < high < critical (-1 if unknown).

fwsift

Wrapper for fwsift: static triage of an extracted rootfs or a raw firmware image.

https://github.com/reflex-hs/fwsift (cargo install --git https://github.com/reflex-hs/fwsift)

Component dataclass

Component(name: str, version: str, kind: str, purl: str, cpe: str | None, paths: list[str], vulnerabilities: list[str])

A software component found in the rootfs (SBOM entry), with its version and identifiers.

ImageSignature dataclass

ImageSignature(offset: int, kind: str, description: str, size: int | None)

A signature found in a raw image during image triage.

FwsiftReport dataclass

FwsiftReport(tool: str, version: str, findings: list[Finding], raw: dict[str, Any], exit_code: int = 0, rootfs: str | None = None, image: str | None = None, summary: dict[str, int] = dict(), components: list[Component] = list(), signatures: list[ImageSignature] = list(), hardening: dict[str, int] = dict(), stats: dict[str, int] = dict())

Bases: Report

Result of scan: findings plus components, image signatures, ELF hardening stats.

parse

parse(data: dict[str, Any], exit_code: int = 0) -> FwsiftReport

Build a FwsiftReport from fwsift's --json document.

scan

scan(target: str | PathLike[str], osv: bool = False, image: str | PathLike[str] | None = None, min_severity: str | None = None, max_file_size_mib: int | None = None, extra_args: tuple[str, ...] = (), timeout: float | None = None) -> FwsiftReport

Run fwsift <target> --json.

target is an extracted rootfs directory or a raw image file (signature triage only). image adds a raw image to triage next to a rootfs directory. osv=True queries api.osv.dev for known vulnerabilities (network access).

bootlint

Wrapper for bootlint: audit U-Boot env, FIT/DTB/DTS and kernel configs.

https://github.com/reflex-hs/bootlint (cargo install --git https://github.com/reflex-hs/bootlint)

Score dataclass

Score(value: int, passed: int, total: int)

bootlint's overall score for one analysed file.

BootlintFile dataclass

BootlintFile(path: str, kind: str | None, findings: list[Finding], details: list[str] = list(), score: Score | None = None, error: str | None = None)

One analysed file: its detected type, score and findings, or the error that stopped it.

BootlintReport dataclass

BootlintReport(tool: str, version: str, findings: list[Finding], raw: dict[str, Any], exit_code: int = 0, files: list[BootlintFile] = list(), summary: dict[str, int] = dict())

Bases: Report

Result of audit.

errors property

errors: list[BootlintFile]

Files that bootlint could not analyse.

parse

parse(data: dict[str, Any], exit_code: int = 0) -> BootlintReport

Build a BootlintReport from bootlint's --json document.

audit

audit(paths: str | PathLike[str] | Iterable[str | PathLike[str]], type: str = 'auto', env_size: int | str | None = None, env_offset: int | str | None = None, min_severity: str | None = None, timeout: float | None = None) -> BootlintReport

Run bootlint <paths> --json.

type is auto, env, env-bin, fit, dtb or kconfig. Files that fail to parse are reported in BootlintReport.errors instead of raising.

baudhound

Wrapper for baudhound: find the UART and its settings in a logic-analyzer capture.

https://github.com/reflex-hs/baudhound (cargo install --git https://github.com/reflex-hs/baudhound)

Candidate dataclass

Candidate(baud: float, standard: int | None, framing: str, inverted: bool, frames: int, framing_errors: int, parity_errors: int, printable_ratio: float, phase_error: float | None, score: float)

One baud rate / framing hypothesis for a channel, with its score and error counts.

UartResult dataclass

UartResult(baud: float, standard: int | None, framing: str, inverted: bool, frames: int, framing_errors: int, parity_errors: int, printable_ratio: float, phase_error: float | None, score: float, measured_baud: float | None = None, nonstandard: bool = False, bytes: int = 0, errors: int = 0)

Bases: Candidate

The selected UART settings for a channel. Use baudrate for the rate to configure.

baudrate property

baudrate: int

Standard rate if snapped, else the rounded estimate.

Channel dataclass

Channel(file: str, index: int, name: str, role: str, edges: int, idle_high: bool, note: str | None, uart: UartResult | None, candidates: list[Candidate], clock: dict[str, Any] | None, text: str | None, findings: list[Finding])

One logic-analyzer channel: its detected role, the UART result if any and decoded text.

BaudhoundReport dataclass

BaudhoundReport(tool: str, version: str, findings: list[Finding], raw: dict[str, Any], exit_code: int = 0, channels: list[Channel] = list())

Bases: Report

Result of analyze.

uarts property

uarts: list[Channel]

Channels on which a UART was detected.

best property

best: Channel | None

The most likely target TX channel (uart-tx first, then by score).

parse

parse(data: dict[str, Any], exit_code: int = 0) -> BaudhoundReport

Build a BaudhoundReport from baudhound's --json document.

analyze

analyze(capture: str | PathLike[str] | Iterable[str | PathLike[str]], samplerate: str | int | None = None, channels: Iterable[str | int] = (), baud: int | None = None, framing: str | None = None, top: int | None = None, fmt: str | None = None, unitsize: int | None = None, timeout: float | None = None) -> BaudhoundReport

Run baudhound <capture> --json.

capture is a sigrok .sr, a sigrok/Saleae CSV export or raw samples (then samplerate, e.g. "24M", is required).

mcpwarden

Wrapper for mcpwarden: audit MCP server configs, tool metadata and server source.

Edge-AI devices increasingly ship MCP (Model Context Protocol) servers; this scans the configs and tool descriptions pulled from a device or a project.

https://github.com/reflex-hs/mcpwarden (cargo install --git https://github.com/reflex-hs/mcpwarden)

McpwardenReport dataclass

McpwardenReport(tool: str, version: str, findings: list[Finding], raw: dict[str, Any], exit_code: int = 0, summary: dict[str, Any] = dict(), configs: list[dict[str, Any]] = list(), warnings: list[str] = list())

Bases: Report

Result of scan.

parse

parse(data: dict[str, Any], exit_code: int = 0) -> McpwardenReport

Build a McpwardenReport from mcpwarden scan --json output.

scan

scan(paths: PathArg | Iterable[PathArg] | None = None, tools: PathArg | Iterable[PathArg] | None = None, source: PathArg | Iterable[PathArg] | None = None, min_severity: str | None = None, ignore: Iterable[str] = (), discover: bool = False, timeout: float | None = None) -> McpwardenReport

Run mcpwarden scan ... --json --fail-on none.

paths are MCP config files or project dirs, tools saved tools/list JSON files, source server source dirs/files. With no inputs mcpwarden would scan the local user's own MCP configs; that only happens when discover=True is passed explicitly.