Skip to content
KitploitKITPLOIT
工具博客
提交
工具博客
提交

黑客、渗透测试和网络安全工具,武装您的安全武器库!

Kitploit 是一个黑客、网络安全和渗透测试工具的目录。发现最新的项目更新,查找漏洞、分析系统、自动化测试并加强你的安全。

··订阅源·联系·隐私·© 2026 Kitploit

工具目录

分类

查看所有分类
Loading categories
cyclonedx-cli — 用于生成、分析、合并、差异比较、验证、签名和转换 CycloneDX SBOM 的 CLI,支持 JSON、XML、Protobuf、CSV 和 SPDX 格式。 | Kitploit
工具/GitHubGitHub/cyclonedx/cyclonedx-cli
防御工具密码学DevSecOps实用工具与框架供应链安全
GitHubcyclonedx/cyclonedx-cli

cyclonedx-cli

用于生成、分析、合并、差异比较、验证、签名和转换 CycloneDX SBOM 的 CLI,支持 JSON、XML、Protobuf、CSV 和 SPDX 格式。

查看仓库
533813天前Kitploit 审核通过

最受欢迎

查看全部 →

发现我们社区最常用的工具。

探索所有工具

浏览我们的工具集合

查看所有工具 →
分享
网站

Docker Image License Website Slack Invite Group Discussion Twitter

root@kitploit:~
   ______           __                 ____ _  __    ________    ____
  / ____/_  _______/ /___  ____  ___  / __ \ |/ /   / ____/ /   /  _/
 / /   / / / / ___/ / __ \/ __ \/ _ \/ / / /   /   / /   / /    / /
/ /___/ /_/ / /__/ / /_/ / / / /  __/ /_/ /   |   / /___/ /____/ /
\____/\__, /\___/_/\____/_/ /_/\___/_____/_/|_|   \____/_____/___/
     /____/

Usage:
  cyclonedx [command] [options]

Options:
  --version         Show version information
  -?, -h, --help    Show help and usage information

Commands:
  add                         Add information to a BOM (currently supports files)
  analyze                     Analyze a BOM file
  convert                     Convert between different BOM formats
  diff <from-file> <to-file>  Generate a BOM diff
  keygen                      Generates an RSA public/private key pair for BOM signing
  merge                       Merge two or more BOMs
  sign                        Sign a BOM or file
  validate                    Validate a BOM
  verify                      Verify signatures in a BOM

CycloneDX CLI 工具目前支持 BOM 分析、修改、差异比较、合并、格式转换、签名和验证。

支持在 CycloneDX XML、JSON、Protobuf、CSV 和 SPDX JSON v2.3 之间进行转换。

可以从发布页面下载二进制文件。

注意:CycloneDX CLI 工具专为自动化用例而构建。任何带有 --input-file 选项的命令都支持从 stdin 读取输入;同样,任何带有 --output-file 选项的命令都支持将输出写入 stdout。但是,您需要指定输入/输出格式。

例如:
cat bom.json | cyclonedx-cli convert --input-format json --output-format xml > bom.xml

命令

Add 命令

Add File 子命令

root@kitploit:~
files
  Add files to a BOM

Usage:
  cyclonedx add files [options]

Options:
  --input-file <input-file>                       Input BOM filename.
  --no-input                                      Use this option to indicate that there is no input BOM.
  --output-file <output-file>                     Output BOM filename, will write to stdout if no value provided.
  --input-format <autodetect|json|protobuf|xml>   Specify input file format.
  --output-format <autodetect|json|protobuf|xml>  Specify output file format.
  --base-path <base-path>                         Base path for directory to process (defaults to current working directory if omitted).
  --include <include>                             Apache Ant style path and file patterns to specify what to include (defaults to all files, separate patterns with a space).
  --exclude <exclude>                             Apache Ant style path and file patterns to specify what to exclude (defaults to none, separate patterns with a space).

示例

生成源代码 BOM,排除 Git 仓库目录:
cyclonedx-cli add files --no-input --output-format json --exclude /.git/**

将 bin 目录中的构建输出文件添加到现有 BOM:
cyclonedx-cli add files --input-file bom.json --output-format json --base-path bin

Analyze 命令

root@kitploit:~
analyze
  Analyze a BOM file

Usage:
  cyclonedx analyze [options]

Options:
  --input-file <input-file>                      Input BOM filename, will read from stdin if no value provided.
  --input-format <autodetect|json|protobuf|xml>  Specify input file format.
  --output-format <json|text>                    Specify output format (defaults to text).
  --multiple-component-versions                  Report components that have multiple versions in use.

示例

报告以不同版本被多次包含的组件:
cyclonedx-cli analyze --input-file sbom.xml --multiple-component-versions

Convert 命令

root@kitploit:~
convert
  Convert between different BOM formats

Usage:
  cyclonedx convert [options]

Options:
  --input-file <input-file>                                    Input BOM filename, will read from stdin if no value provided.
  --output-file <output-file>                                  Output BOM filename, will write to stdout if no value provided.
  --input-format <autodetect|csv|json|protobuf|spdxjson|xml>   Specify input file format.
  --output-format <autodetect|csv|json|protobuf|spdxjson|xml>  Specify output file format.
  --output-version <v1_0|v1_1|v1_2|v1_3|v1_4|v1_5|v1_6|v1_7>   Specify output BOM specification version. (ignored for CSV and SPDX formats)

示例

从 XML 格式转换为 JSON 格式:
cyclonedx-cli convert --input-file sbom.xml --output-file sbom.json

从 XML 格式转换为 JSON 格式,并将输出通过管道传递给其他工具:
cyclonedx-cli convert --input-file sbom.xml --output-format json | grep "somthing"

CSV 格式

CSV 格式是 BOM 中组件列表的一种有限表示形式。

其目的是为用户提供一种简单的方式,以便在简单的使用场景中生成和使用 BOM,包括简单的数据迁移场景。

唯一必填字段是组件的 name 和 version 字段。其他字段可以留空,也可以省略对应列。

example.csv

SPDX 格式

在 SPDX 和 CycloneDX 格式之间进行转换可能会导致某些信息丢失。转换功能由 CycloneDX.Spdx.Interop 库提供,该库是 CycloneDX .NET 库项目的一部分。

有关哪些信息会丢失的更多详情,请参阅 CycloneDX .NET 库项目页面。

Diff 命令

root@kitploit:~
diff
  Generate a BOM diff

Usage:
  cyclonedx diff <from-file> <to-file> [options]

Arguments:
  <from-file>  From BOM filename.
  <to-file>    To BOM filename.

Options:
  --from-format <autodetect|json|protobuf|xml>  Specify from file format.
  --to-format <autodetect|json|protobuf|xml>    Specify to file format.
  --output-format <json|text>                   Specify output format (defaults to text).
  --component-versions                          Report component versions that have been added, removed or modified.

示例

报告发生版本变化的组件:
cyclonedx-cli diff sbom-from.xml sbom-to.xml --component-versions

Keygen 命令

root@kitploit:~
keygen
  Generates an RSA public/private key pair for BOM signing

Usage:
  cyclonedx keygen [options]

Options:
  --private-key-file <private-key-file>  Filename for generated private key file (defaults to "private.key")
  --public-key-file <public-key-file>    Filename for generated public key file (defaults to "public.key")

Merge 命令

root@kitploit:~
merge
  Merge two or more BOMs

Usage:
  cyclonedx merge [options]

Options:
  --input-files <input-files>                                Input BOM filenames (separate filenames with a space).
  --output-file <output-file>                                Output BOM filename, will write to stdout if no value provided.
  --input-format <autodetect|json|protobuf|xml>              Specify input file format.
  --output-format <autodetect|json|protobuf|xml>             Specify output file format.
  --output-version <v1_0|v1_1|v1_2|v1_3|v1_4|v1_5|v1_6|v1_7> Specify output BOM specification version.
  --hierarchical                                             Perform a hierarchical merge.
  --group <group>                                            Provide the group of software the merged BOM describes.
  --name <name>                                              Provide the name of software the merged BOM describes (required for hierarchical merging).
  --version <version>                                        Provide the version of software the merged BOM describes (required for hierarchical merging).

注意:要执行分层合并,所有 BOM 都需要在 metadata component 元素中描述 BOM 的主题。

示例

合并两个 XML 格式的 BOM:
cyclonedx-cli merge --input-files sbom1.xml sbom2.xml --output-file sbom_all.xml

合并两个 BOM,并将输出通过管道传递给其他工具:
cyclonedx-cli merge --input-files sbom1.xml sbom2.xml --output-format json | grep "something"

Sign 命令

对 BOM 或文件进行签名

Sign Bom 子命令

root@kitploit:~
bom
  Sign the entire BOM document

Usage:
  cyclonedx sign bom <bom-file> [options]

Arguments:
  <bom-file>  BOM filename

Options:
  --key-file <key-file>  Signing key filename (RSA private key in PEM format, defaults to "private.key")

Sign File 子命令

root@kitploit:~
file
  Sign arbitrary files and generate a PKCS1 RSA SHA256 signature file

Usage:
  cyclonedx sign file <file> [options]

Arguments:
  <file>  Filename of the file the signature will be created for

Options:
  --key-file <key-file>              Signing key filename (RSA private key in PEM format, defaults to "private.key")
  --signature-file <signature-file>  Filename of the generated signature file (defaults to the filename with ".sig" appended)

Validate 命令

root@kitploit:~
validate
  Validate a BOM

Usage:
  cyclonedx validate [options]

Options:
  --input-file <input-file>                                  Input BOM filename, will read from stdin if no value provided.
  --input-format <autodetect|json|xml>                       Specify input file format.
  --input-version <v1_0|v1_1|v1_2|v1_3|v1_4|v1_5|v1_6|v1_7>  Specify input file specification version (defaults to v1.7)
  --fail-on-errors                                           Fail on validation errors (return a non-zero exit code)

示例

验证 BOM 并返回非零退出码(方便自动“中断”构建等)
cyclonedx-cli validate --input-file sbom.xml --fail-on-errors

Verify 命令

验证 BOM 和文件的签名

Verify All 子命令

root@kitploit:~
all
  Verify all signatures in a BOM

Usage:
  cyclonedx verify all <bom-file> [options]

Arguments:
  <bom-file>  BOM filename

Options:
  --key-file <key-file>  Public key filename (RSA public key in PEM format, defaults to "public.key")

Verify File 子命令

root@kitploit:~
file
  Verifies a PKCS1 RSA SHA256 signature file for an arbitrary file

Usage:
  cyclonedx verify file <file> [options]

Arguments:
  <file>  File the signature file is for

Options:
  --key-file <key-file>              Public key filename (RSA public key in PEM format, defaults to "public.key")
  --signature-file <signature-file>  Signature file to be verified (defaults to the filename with ".sig" appended)

Docker 镜像

CycloneDX CLI 工具也可以使用 docker 运行:docker run cyclonedx/cyclonedx-cli。

Homebrew

对于 Linux 和 MacOS,可以通过 CycloneDX Homebrew tap 安装 CLI:

root@kitploit:~
brew install cyclonedx/cyclonedx/cyclonedx-cli

支持的平台

官方支持的构建可用于以下平台:

  • Windows x64 (win-x64)
  • Linux x64 (linux-x64)
  • Linux musl x64 (linux-musl-x64, includes Alpine Linux)
  • MacOS x64 (osx-x64)

社区支持的构建可用于以下平台:

  • Windows x86 (win-x86)
  • Windows ARM x64 (win-arm64)
  • Linux ARM (linux-arm)
  • Linux ARM x64 (linux-arm64)
  • MacOS ARM x64 (osx-arm64)

需要 .NET Core 运行时依赖项。

对于 Windows,这些依赖项应已预装。

对于 Ubuntu,这些依赖项包括 libc6、libgcc1、libgssapi-krb5-2、libicu66、libssl1.1、libstdc++6 和 zlib1g。

使用 gron 进行临时搜索和分析

gron 将 JSON 转换为离散的赋值,使您可以更轻松地使用 grep 查找所需内容,并查看其绝对 '路径'。

为了方便,CycloneDX CLI Docker 镜像中包含了 gron。

以下示例用法可列出所有组件名称和版本

root@kitploit:~
$ gron bom-1.2.json | grep -E "(components\[[[:digit:]]*\].name)|(components\[[[:digit:]]*\].version)"

json.components[0].name = "tomcat-catalina";
json.components[0].version = "9.0.14";
json.components[1].name = "mylibrary";
json.components[1].version = "1.0.0";

或者使用 XML 格式的 BOM 执行相同操作

root@kitploit:~
$ cyclonedx convert --input-file bom.xml --output-format json | gron | grep -E "(components\[[[:digit:]]*\].name)|(components\[[[:digit:]]*\].version)"

json.components[0].name = "tomcat-catalina";
json.components[0].version = "9.0.14";
json.components[1].name = "mylibrary";
json.components[1].version = "1.0.0";

有关 gron 用法的更多详情,请参阅 gron 项目页面。

有关 grep 用法的更多详情,请参阅 grep 手册页。

许可证

根据 Apache 2.0 许可证的条款,允许修改和重新分发。完整许可证请参阅 LICENSE 文件。

贡献

欢迎提交 Pull Request。但请先阅读 CycloneDX 贡献指南。

要在本地构建和测试解决方案,您需要安装 .NET 8。标准的命令如 dotnet build 和 dotnet test 均可正常工作。

通常期望 Pull Request 包含相关测试。每次 Pull Request 都会在 Windows、MacOS 和 Linux 上自动运行测试。构建警告将导致构建失败。

如果您在调试某个在您无法访问的平台上失败的测试时遇到问题,请告知我们。

下载工具