VulnCheck CLI

CLI 指令

可搭配 VulnCheck CLI 使用的範例指令清單。

開始使用 VulnCheck CLI

列出您具有存取權限的所有索引

vulncheck indices browse

在所有索引中搜尋特定字詞 - 「nvd」

vulncheck indices browse nvd

瀏覽索引

vulncheck index browse vulncheck-kev

下載索引的備份

vulncheck backup download mitre-attack-cve

漏洞與漏洞利用情資指令

在索引中查詢 CVE

vulncheck index list exploits --cve cve-2024-3400

查詢與 CPE 相關的漏洞

vulncheck cpe "cpe:2.3:o:fortinet:fortios:*:*:*:*:*:*:*:*"

查詢與 PURL 相關的漏洞

vulncheck purl "pkg:pypi/aioxmpp@0.6.0"

從檔案或 stdin 批次查詢 PURL(v1.0.0+,使用伺服器端批次端點):

vulncheck purl --from-file purls.txt --json
cat purls.txt | vulncheck purl --json

批次查詢 CPE(v1.0.0+,於用戶端依序迴圈查詢):

vulncheck cpe --from-file cpes.txt --json

查詢索引中指定 pubstart 日期的紀錄清單

vulncheck index list vulncheck-kev --pubstartdate 2024-10-20

查詢索引中指定 pubend 日期的紀錄清單

vulncheck index list vulncheck-kev --pubenddate 2023-10-20

查詢索引中介於指定 pubstart 與 pubend 日期之間的紀錄清單

vulncheck index list vulncheck-kev --pubstartdate 2024-10-01 --pubenddate 2024-10-05

在 threat actors 索引中查詢威脅行為者

vulncheck index list threat-actors --threat_actor "Cozy Bear"

在 botnets 索引中查詢殭屍網路

vulncheck index list botnets --botnet "Kinsing"

在 ransomware 索引中查詢勒索軟體家族

vulncheck index list ransomware --ransomware Cactus

IP 情資指令

查詢與主機名稱相關的 IP

vulncheck index list ipintel-3d --hostname router.asus.com

查詢 IP 位址範圍

vulncheck index list ipintel-3d --cidr 100.20.0.0/14

查詢可能受某個 CVE 影響或確實受其影響的 IP

vulncheck index list ipintel-3d --cve CVE-2023-27350

在 IPIntel 索引中查詢與國家、ASN 及 ID 相關的 IP

vulncheck index list ipintel-3d --country=Sweden --asn=AS16509 --id=initial-access

查詢主機名稱包含「.gov」、可能受 CVE-2024-24919 影響,且地理位置位於美國的 IP

vulncheck index list ipintel-3d --hostname=.gov --country_code=US --cve=CVE-2024-24919

掃描指令

基本目錄掃描

vulncheck scan /path/to/directory

以 JSON 格式輸出掃描結果:stdout 僅輸出純 JSON,進度訊息則導向 stderr(v1.0.0+):

vulncheck scan /path/to/project --json
vulncheck scan /path/to/project --json | jq '.vulnerabilities | length'

掃描並將結果儲存至檔案

vulncheck scan /path/to/project --file

掃描並將結果儲存至自訂檔名

vulncheck scan /path/to/project --file --file-name security-report.json

掃描並包含 CPE 分析

vulncheck scan /path/to/project --include-cpes

不顯示提示/TUI 的掃描(無介面模式):使用 --json 時隱含啟用,也可明確指定:

vulncheck scan /path/to/project --no-interactive

離線掃描(需要已快取的索引)

vulncheck scan /path/to/project --offline

包含 CVE 中繼資料的離線掃描(需要 vulncheck-nvd2 索引)

vulncheck scan /path/to/project --offline --offline-meta

掃描現有的 SBOM 檔案,而非重新產生

vulncheck scan --sbom-input-file /path/to/existing-sbom.json

僅產生 SBOM,不執行漏洞掃描

vulncheck scan /path/to/project --sbom-only

產生 SBOM 並儲存至自訂檔案

vulncheck scan /path/to/project --sbom-only --sbom-output-file project-sbom.json

產生擴充版 SBOM(透過網路取得授權條款與套件中繼資料)

vulncheck scan /path/to/project --sbom-only --enrich all --sbom-output-file project-sbom.json

支援的範圍:all、golang、java、javascript、python。加上 - 前綴可排除(例如 all,-java)。無法與 --offline 或 --sbom-input-file 併用。

缺少索引時僅顯示警告(而非中止執行)的掃描

vulncheck scan /path/to/project --warn-on-index

搭配多個選項的完整掃描

vulncheck scan /path/to/project --include-cpes --json --file --file-name full-report.json --warn-on-index

Canary 情資指令

依 CVE 瀏覽 VulnCheck Canary 情資

vulncheck index browse vulncheck-canaries --cve CVE-2024-5276

依來源國家瀏覽 VulnCheck Canary 情資

vulncheck index browse vulncheck-canaries --src_country IR

依目的地國家瀏覽 VulnCheck Canary 情資

vulncheck index browse vulncheck-canaries --dst_country US

VulnCheck 掃描指令

掃描儲存庫中的漏洞

vulncheck scan ./npm-seven/

初始存取情資指令

列出 VulnCheck 初始存取情資中的所有 Snort 規則

vulncheck rule snort

列出 VulnCheck 初始存取情資中的所有 Suricata 規則

vulncheck rule suricata

列出 IP 情資中與特定標籤相關的所有 IP

vulncheck tag "vulncheck-c2"

NVD API 2.0 相容指令 (v1.3.0+)

每個 NVD API 2.0 相容端點各對應一個指令,每個 NVD 查詢參數各對應一個旗標。

以 NVD 發布的格式查詢 CVE

vulncheck nvd cves --cve-id CVE-2024-3400 --json

使用 cursor 逐頁瀏覽 CISA KEV 中的 CVE

vulncheck nvd cves --has-kev --results-per-page 100 --cursor "" --full --json | jq -r .nextCursor
vulncheck nvd cves --has-kev --results-per-page 100 --cursor <nextCursor> --json

查看 NVD 對某個 CVE 的分析如何變更

vulncheck nvd cvehistory --cve-id CVE-2024-3400 --json

將 CVE 的比對條件展開為 CPE 名稱

vulncheck nvd cpematch --cve-id CVE-2024-3400 --json

分頁與探索 (v1.0.0+)

自動分頁,將整個索引輸出為單一 JSON 陣列

vulncheck index list vulncheck-kev --json --all

明確指定權杖清單的分頁

vulncheck token list --json --limit 20 --page 2
vulncheck token list --json --all           # walk every page automatically

以 JSON 格式輸出完整的指令介面

vulncheck commands
vulncheck commands | jq '.root.subcommands[].name'
vulncheck commands | jq '.root.subcommands[] | select(.name=="scan") | .flags'

探測 CLI 版本與驗證狀態(代理程式前置步驟)

vulncheck version --json | jq -r .version
vulncheck auth status --json | jq -e '.authenticated'

權杖管理 (v1.0.0+)

列出權杖:純 JSON 輸出,不含資訊行前綴:

vulncheck token list --json

建立新權杖,並將密鑰擷取至 stderr:除非您選擇啟用,否則 --json 酬載絕不會包含原始密鑰:

vulncheck token create "ci-runner" --json 2> secret.txt
cat secret.txt   # vc_...

建立將密鑰嵌入 JSON 中的權杖(需選擇啟用,並自行負責重新導向):

vulncheck token create "ci-runner" --json --allow-token-on-stdout

移除權杖

vulncheck token remove <token-id> --json