> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cystack.net/llms.txt
> Use this file to discover all available pages before exploring further.

# CLIリファレンス

> 有効化、スキャン、レポート、Web UI、検出、更新、自動化のコマンドを説明します

VulnScan CLIは、Web UIと同じスキャンエンジンを使用します。自動化、スケジュールジョブ、CIやセキュリティパイプライン、繰り返し可能な分析、オフライン準備、レポートの自動出力に利用できます。対話的なトリアージとチーム作業にはWeb UIを使い、安定した手順をCLIで自動化する方法を推奨します。

## コマンド一覧

| コマンド | 用途 |
| - | - |
| `activate` | ライセンスキーまたはオフライン認証ファイルで有効化します。 |
| `license` | 現在のライセンス状態と上限を表示します。 |
| `fingerprint` | オフライン認証に必要なホストIDを表示します。 |
| `deactivate` | 現在のマシンからライセンス認証を解除します。 |
| `web` | Web UIサーバーを起動します。 |
| `scan` | 脆弱性スキャンを実行し、CSV、JSON、PDFを出力します。 |
| `subdomain` | ドメインのサブドメインを列挙します。 |
| `prep-offline` | 制限付き環境向けにスキャナーデータと脆弱性インテリジェンスを準備します。 |
| `update` | 対応環境でVulnScanアプリケーションとデータを更新します。 |
| `version` | バージョン情報を表示します。 |

## 共通オプション

| オプション | 内容 |
| - | - |
| `-c, --config` | 設定ファイルのパス。標準値は`./configs/default.yaml`です。 |
| `--log-level` | `debug`、`info`、`warn`、`error`のログレベル。 |
| `-v, --verbose` | 詳細な出力を有効にします。 |

CLIのスキャン結果を同じワークスペースデータベースへ表示する場合は、Web UIとCLIで同じ設定ファイルを使用します。

## 有効化

オンライン認証:

```bash theme={null}
vulnscan license activate --key CYSTACK-XXXX-XXXX-XXXX-XXXX
```

オフライン認証:

```bash theme={null}
vulnscan fingerprint
vulnscan activate --file activation.dat
```

| オプション | 内容 |
| - | - |
| `--license` | CyStackから提供されたライセンスキー。 |
| `--file` | CyStackから提供されたオフライン認証ファイル。 |

有効化後に`vulnscan license`を実行し、対象スコープ、有効期限、有効化数、利用可能な機能を確認します。

## ライセンス、ホストID、無効化

ライセンス状態を表示します。

```bash theme={null}
vulnscan license
```

ホストIDを表示します。

```bash theme={null}
vulnscan fingerprint
```

現在のマシンを無効化します。

```bash theme={null}
vulnscan deactivate
```

VulnScanを別のホストへ恒久的に移す前に無効化し、ライセンスポリシーに従って有効化枠を再利用できるようにします。

## Web UIを起動する

標準のローカルアドレスで起動します。

```bash theme={null}
vulnscan web
```

共有インターフェースとデータディレクトリを指定します。

```bash theme={null}
vulnscan web --bind 0.0.0.0:8080 --data-dir /var/lib/cystack-vulnscan
```

| オプション | 内容 |
| - | - |
| `--bind` | Web UIサーバーのアドレスとポート。 |
| `--data-dir` | データベース、レポート、ライセンス、実行ファイルを保存するワークスペースディレクトリ。 |

初回起動時は、表示されたURLを開いて最初の管理者アカウントを作成します。

## スキャン

`scan`コマンドは、検出、フィンガープリント、脆弱性検査、情報付加、重複排除、リスクスコア計算、保存、レポート出力を行います。

### 一つのターゲットをスキャンする

```bash theme={null}
vulnscan scan --target https://app.example.com --output ./reports --format json,csv --lang en
```

### 複数のターゲットをスキャンする

```bash theme={null}
vulnscan scan --target https://app.example.com --target https://api.example.com --output ./reports --format json,csv
```

### ターゲットファイルを使う

`targets.txt`を作成します。

```text theme={null}
https://app.example.com
https://api.example.com
203.0.113.21
203.0.113.0/28
```

実行します。

```bash theme={null}
vulnscan scan --target-file ./targets.txt --output ./reports --format json,csv
```

### サブドメインを含める

```bash theme={null}
vulnscan scan --target example.com --include-subdomains --output ./reports --format json,csv
```

ライセンス対象のルートドメインで、外部アタックサーフェスを広く確認する場合に使用します。

### 認証が必要なWebをスキャンする

Cookieベースのセッション:

```bash theme={null}
vulnscan scan --target https://portal.example.com --cookie "session=REDACTED; tenant=acme" --output ./reports --format json,csv
```

BearerトークンまたはAPIキー:

```bash theme={null}
vulnscan scan --target https://api.example.com -H "Authorization: Bearer REDACTED" -H "X-Tenant: acme" --output ./reports --format json,csv
```

HTTP Basic認証:

```bash theme={null}
vulnscan scan --target https://staging.example.com --basic-auth "scanner:REDACTED" --output ./reports --format json,csv
```

専用のテストアカウントを使用し、評価方針で明示的に許可されていない限り、個人の管理者セッションは使用しないでください。

### レポートを生成する

CSVとJSON:

```bash theme={null}
vulnscan scan --target https://app.example.com --output ./reports --format csv,json
```

英語ラベルのPDF:

```bash theme={null}
vulnscan scan --target https://app.example.com --output ./reports --format pdf --lang en
```

対応環境でベトナム語ラベルのPDF:

```bash theme={null}
vulnscan scan --target https://app.example.com --output ./reports --format pdf --lang vi
```

### スキャンオプション

| オプション | 内容 |
| - | - |
| `--target` | 対象IP、CIDR、IP範囲、ドメイン、URL。複数回指定できます。 |
| `--target-file` | 1行に1ターゲットを記載したファイル。 |
| `--include-subdomains` | ドメインターゲットのサブドメインを検出して含めます。 |
| `--cookie` | 認証Webスキャンで使用するCookie文字列。 |
| `--basic-auth` | `user:password`形式のHTTP Basic認証情報。 |
| `-H, --header` | カスタムHTTPヘッダー。複数回指定できます。 |
| `-o, --output` | レポートファイルの出力ディレクトリ。 |
| `--format` | `json`、`csv`、`pdf`のレポート形式一覧。 |
| `--lang` | `en`または`vi`のレポート言語。 |

## サブドメイン検出

サブドメインを列挙します。

```bash theme={null}
vulnscan subdomain --target example.com
```

JSONで返します。

```bash theme={null}
vulnscan subdomain --target example.com --json
```

| オプション | 内容 |
| - | - |
| `--target` | 列挙するルートドメイン。 |
| `--json` | 検出結果をJSONで出力します。 |

広い範囲をスキャンする前にサブドメイン検出を行うと、スコープとターゲット数を把握できます。

## オフライン準備

オフライン環境または事前構築環境向けに、スキャナーデータと脆弱性インテリジェンスを準備します。

```bash theme={null}
vulnscan prep-offline
```

制限付きネットワークへ導入パッケージを持ち込む前に実行します。オフライン環境でも有効なライセンスと更新手順が必要です。

## 更新とバージョン

バージョンを表示します。

```bash theme={null}
vulnscan version
```

VulnScanを更新します。

```bash theme={null}
vulnscan update
```

本番スキャナーを更新する前に、組織の変更管理手順に従ってください。

## 自動化の例

### 毎晩の外部スキャン

```bash theme={null}
vulnscan scan --target-file ./production-targets.txt --include-subdomains --output ./nightly-reports --format json,csv --lang en
```

### CIセキュリティゲート

```bash theme={null}
vulnscan scan --target https://staging.example.com -H "Authorization: Bearer REDACTED" --output ./ci-reports --format json --log-level warn
```

### ベトナム語の顧客向けレポート

```bash theme={null}
vulnscan scan --target https://customer-portal.example.com --output ./customer-report --format pdf --lang vi
```

## CLI品質チェックリスト

* ライセンス対象だけをスキャンする。
* データの一貫性が必要な場合、CLI設定をWeb UIのワークスペースと合わせる。
* 繰り返し実行する自動化ではターゲットファイルを使用する。
* 認証スキャンには専用テストアカウントを使用する。
* 管理された出力ディレクトリにレポートを保存する。
* 連携にはJSON、修正管理にはCSVを使用する。
* 共同トリアージが必要なHigh以上の結果はWeb UIで確認する。


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.