Skip to main content

CLI Usage

Run H2 Scanner locally from the command line.

Installation

pip install h2-scanner

Or run directly:

python -m h2_scanner --path .

Basic Usage

h2-scan --path /path/to/project

Options

OptionDescriptionDefault
--pathPath to scan.
--scan-secretsEnable secretstrue
--scan-dependenciesEnable depstrue
--scan-containersEnable Dockertrue
--scan-sastEnable SASTtrue
--scan-iacEnable IaCtrue
--fail-onFail thresholdcritical
--outputOutput formatmarkdown
--api-keyPro API key-
--ignore-fileIgnore file path.h2ignore

Examples

Scan current directory

h2-scan

Scan specific path

h2-scan --path ./src

Output as JSON

h2-scan --output json > results.json

Output as SARIF

h2-scan --output sarif > results.sarif

Fail on high severity

h2-scan --fail-on high

Secrets only

h2-scan --scan-secrets true \
--scan-dependencies false \
--scan-containers false \
--scan-sast false \
--scan-iac false