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
| Option | Description | Default |
|---|---|---|
--path | Path to scan | . |
--scan-secrets | Enable secrets | true |
--scan-dependencies | Enable deps | true |
--scan-containers | Enable Docker | true |
--scan-sast | Enable SAST | true |
--scan-iac | Enable IaC | true |
--fail-on | Fail threshold | critical |
--output | Output format | markdown |
--api-key | Pro API key | - |
--ignore-file | Ignore 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