CLI Reference

Complete reference for the scanrook CLI. All subcommands, flags, defaults, environment variables, and example invocations.

Global flags

These flags apply to all subcommands.

FlagDescriptionDefault
--cache-dir <DIR>Cache directory for API results and SBOMs~/.scanrook/cache
--yara <FILE>YARA rules file for deep scans(none)
--nvd-api-key <KEY>NVD API key for enrichment$NVD_API_KEY
--api-base <URL>ScanRook API base URL for CLI auth/limitshttps://scanrook.io
--api-key <KEY>ScanRook API key (overrides saved config)(saved config)
--progressEmit progress events to stderrfalse
--progress-file <FILE>Write NDJSON progress events to a file(none)
--log-format <text|json>Log output format for stderr progresstext
--log-level <error|warn|info|debug>Log verbosity thresholdinfo

scanrook scan

Smart scan: auto-detect file type (container tar, source tar, ISO, or binary) and produce a report. Accepts either a local file path or a Docker/OCI image reference.

FlagDescriptionDefault
-f, --file <PATH>Path to file (tar/tar.gz/tar.bz2/iso/bin)(required unless --image)
--image <REF>Docker/OCI image reference to scan (e.g., alpine:3.20, ubuntu:latest). Pulls and saves the image automatically.(required unless --file)
--format <json|text>Output formatjson
--out <PATH>Output file for JSON format(stdout)
--refsInclude references in reportfalse
--mode <light|deep>Scan mode (deep enables YARA if available)light
--oval-redhat <PATH>Red Hat OVAL XML for fixed checks in RPM scans(none)
Example (local file)
scanrook scan --file ./myapp.tar --mode deep --format json --out report.json
Example (image reference)
scanrook scan --image alpine:3.20 --format json --out report.json

scanrook container

Scan a container image from a saved tar archive.

FlagDescriptionDefault
-t, --tar <PATH>Path to container tar(required)
--mode <light|deep>Scan modelight
--format <json|text>Output formattext
--out <PATH>Output file for JSON format(stdout)
--sbomGenerate SBOM using syft and include in reportfalse
--oval-redhat <PATH>Red Hat OVAL XML for fixed checks(none)
Example
scanrook container --tar ./image.tar --sbom --format json --out report.json

scanrook bin

Scan a binary file (ELF, PE, or Mach-O).

FlagDescriptionDefault
-p, --path <PATH>Path to binary file(required)
--format <json|text>Output formattext
--out <PATH>Output file for JSON format(stdout)
--mode <light|deep>Scan modelight
Example
scanrook bin --path ./myapp --format json --out report.json

scanrook source

Scan a source code tarball for dependency vulnerabilities.

FlagDescriptionDefault
-t, --tar <PATH>Path to source tarball(required)
--format <json|text>Output formattext
--out <PATH>Output file for JSON format(stdout)
Example
scanrook source --tar ./project.tar.gz --format json --out report.json

scanrook license

Detect the software license of a file or project directory.

FlagDescriptionDefault
-p, --path <PATH>Path to file or directory to scan for license(required)
Example
scanrook license --path ./project/

scanrook sbom import

Import an SBOM (CycloneDX JSON, SPDX JSON, or Syft JSON) and enrich with vulnerability data.

FlagDescriptionDefault
-f, --file <PATH>Path to SBOM JSON(required)
--format <json|text>Output formatjson
--out <PATH>Output file(stdout)
--mode <light|deep>Scan modelight
--refsInclude references in reportfalse
Example
scanrook sbom import --file ./sbom.cdx.json --format json --out sbom-report.json

scanrook sbom diff

Compare two SBOM snapshots to track package changes over time.

FlagDescriptionDefault
--baseline <PATH>Baseline SBOM JSON path(required)
--current <PATH>Current SBOM JSON path(required)
--jsonEmit JSON diff outputfalse
--out <PATH>Output file(stdout)
Example
scanrook sbom diff --baseline ./sbom-prev.json --current ./sbom-new.json --json --out diff.json

scanrook sbom policy

Check an SBOM diff against a policy file. Exits with code 1 if the policy is violated.

FlagDescriptionDefault
--policy <PATH>Path to policy file (YAML or JSON)(required)
--diff <PATH>Path to diff JSON from sbom diff --json(required)
--report <PATH>Path to current scan report JSON (optional, used for severity checks)(none)
Example
scanrook sbom policy --policy ./policy.yaml --diff ./diff.json --report ./report.json

scanrook db

Manage the local vulnerability cache.

db status

Show local cache path and size.

Example
scanrook db status

db check

Check local cache, remote source connectivity, and PostgreSQL cache health.

Example
scanrook db check

db sources

List vulnerability data sources ScanRook uses (active and planned).

FlagDescriptionDefault
--jsonEmit JSON outputfalse
Example
scanrook db sources --json

db clear

Remove local cache contents.

Example
scanrook db clear

db update

Refresh selected source caches. Optionally warm up with an artifact scan.

FlagDescriptionDefault
--source <all|nvd|osv|redhat>Source to refreshall
-f, --file <PATH>Optional artifact path for scan-driven warm-up(none)
--mode <light|deep>Scan mode if --file is provideddeep
--cve <ID>Optional CVE ID seed for NVD/OSV/Red Hat refresh(none)
--errata <ID>Optional Red Hat errata ID seed (e.g. RHSA-2022:8162)(none)
Example
scanrook db update --source all --file ./myapp.tar

db download

Download and pre-warm local vulnerability DB/cache for an artifact.

FlagDescriptionDefault
-f, --file <PATH>Artifact path to prefetch advisories for(required)
--mode <light|deep>Scan mode during prefetchdeep
Example
scanrook db download --file ./myapp.tar

db warm

Pre-warm local cache by scanning an artifact.

FlagDescriptionDefault
-f, --file <PATH>Artifact path for warm-up(required)
--mode <light|deep>Scan mode during warm-updeep
Example
scanrook db warm --file ./myapp.tar

scanrook benchmark

Benchmark ScanRook against Trivy and Grype on the same artifact.

FlagDescriptionDefault
-f, --file <PATH>Artifact path (tar/iso/bin)(required)
--out-dir <DIR>Output directory for summary.csv and tool JSON outputsbenchmark-out
--profile <warm|cold|no-cache>Benchmark profilewarm
Example
scanrook benchmark --file ./myapp.tar --profile cold --out-dir ./bench-results

scanrook diff

Diff CVE IDs between a ScanRook report and another scanner's output.

FlagDescriptionDefault
--ours <PATH>ScanRook report JSON path(required)
--against <PATH>Other report JSON path (Trivy/Grype/ScanRook)(required)
--out <PATH>Optional JSON output for full diff details(none)
Example
scanrook diff --ours ./scanrook-report.json --against ./trivy-report.json --out diff.json

scanrook auth

Authentication and local CLI credential management.

auth login

Save an API key or start the device authorization flow.

FlagDescriptionDefault
--api-key <KEY>API key to save(device flow)
--api-base <URL>API base URLhttps://scanrook.io
Example
scanrook auth login --api-key sr_live_abc123

auth logout

Remove stored API key from local configuration.

Example
scanrook auth logout

Other commands

Identity, limits, and configuration management.

scanrook whoami

Show current caller identity against the ScanRook API.

FlagDescriptionDefault
--jsonEmit JSON outputfalse
Example
scanrook whoami --json

scanrook limits

Show cloud-enrichment limit status and remaining quota.

FlagDescriptionDefault
--jsonEmit JSON outputfalse
Example
scanrook limits

scanrook config set

Set a config value. Key-value pairs are persisted to the local config file.

Example
scanrook config set telemetry.opt_in true

Environment variables

All SCANNER_* environment variables recognized by the CLI.

VariablePurposeDefault
NVD_API_KEYNVD API key for enrichment (also via --nvd-api-key flag)--
DATABASE_URLPostgreSQL connection string for CVE caching--
SCANNER_CACHEOverride cache directory~/.scanrook/cache
SCANNER_SKIP_CACHESet to 1 to disable file caching(unset)
SCANNER_NVD_ENRICHToggle NVD enrichment (0 to disable)1
SCANNER_OSV_ENRICHToggle OSV enrichment (0 to disable)1
SCANNER_FORCE_IPV4Force IPv4 for outbound HTTP requeststrue
SCANNER_LOG_FORMATLog format for progress outputtext
SCANNER_LOG_LEVELMinimum log level for progress outputinfo
SCANNER_PROGRESS_STDERREmit progress events to stderr(auto)
SCANNER_PROGRESS_COMPACTUse compact live panel for interactive terminals(auto)
SCANNER_PROGRESS_MAX_LINESMax lines shown in compact progress panel8