unpack

command module
v0.3.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 12, 2026 License: Apache-2.0 Imports: 1 Imported by: 0

README

Unpack: The Dependency-Aware File Unpacker

Go Build and Test Go Report Card LICENSE

Unpack is a versatile CLI tool and library for analyzing software components. It goes beyond simple file extraction, providing deep insights into dependencies within codebases, artifacts, and Software Bills of Materials (SBOMs).

Whether you're a developer, security researcher, or compliance officer, Unpack helps you understand the composition of your software.

Key Features

  • Dependency Extraction: Analyzes source code to discover dependencies for various languages.
  • SBOM Parsing: Reads and understands major SBOM formats: SPDX 2.2, 2.3 and 3.0.1, and CycloneDX.
  • Multiple Output Formats: Displays dependencies as a visual tree or exports to standard SBOM formats.
  • Extensible Architecture: Easily extendable to support new languages and package managers.
  • Attestation Support: Wraps SBOM outputs in an in-toto attestation for verifiable supply chain security.

unpack is an experimental project. We are actively developing it and welcome feedback. Initial support focuses on Go, Rust, and NPM codebases, with more on the way. Dependency extraction from SBOMs is powered by the native protobom unserializers.


Installation

From Pre-releases

Pre-release binaries are available for Linux, macOS, and Windows.

Download the latest prerelease

From Source

To install the latest development version directly from the source, use the Go compiler:

go install github.com/carabiner-dev/unpack@main

Usage

Unpack provides two main commands: extract and sbom.

unpack extract: Analyze Source Code

Use extract to discover dependencies directly from a source code repository.

Example: Basic Tree View

# Analyze the codebase in the current directory and display a dependency tree
unpack extract .
pkg:golang/github.com/carabiner-dev/unpack@v0.1.0-pre3.1+0400cac1
  ├ pkg:golang/github.com/titanous/rocacheck@v0.0.0-20171023193734-afe73141d399
  ├ pkg:golang/google.golang.org/protobuf@v1.36.5
  │   ├ pkg:golang/github.com/google/go-cmp@v0.5.5
  ...

Example: Generate an SPDX SBOM

# Output the dependency graph as an SPDX 2.3 JSON file
unpack extract --format=spdx /path/to/your/code > my-project.spdx.json

# ...or as SPDX 3.0.1
unpack extract --format=spdx3 /path/to/your/code > my-project.spdx3.json

The output formats are:

--format Writes
tree an ASCII dependency tree (the default)
spdx SPDX 2.3, JSON
spdx3 SPDX 3.0.1, JSON-LD
cyclonedx, cdx CycloneDX 1.7, JSON

Example: Create a Signed Attestation

# Generate an SBOM and wrap it in a signed in-toto attestation.
# Attesting without naming a format writes SPDX 3.0.1.
unpack extract --attest /path/to/your/code

# ...or name the format yourself
unpack extract --attest --format=spdx /path/to/your/code

Attestations are made under the predicate type of what they carry: https://spdx.dev/Document/v3 for SPDX 3, https://spdx.dev/Document for SPDX 2, and https://cyclonedx.org/bom for CycloneDX.

unpack sbom: Process Existing SBOMs

Use sbom to read, convert, and re-export existing SBOM files.

# Read an SBOM and display its contents as a tree
unpack sbom -p /path/to/sbom.spdx.json

# Convert an SBOM to CycloneDX
unpack sbom -p /path/to/sbom.spdx.json --format=cyclonedx

# Convert an SPDX 2.3 SBOM to SPDX 3.0.1
unpack sbom -p /path/to/sbom.spdx.json --format=spdx3
unpack ls: List Discovered Codebases

Use ls to scan a directory and list the codebases found, along with their IDs. These IDs can then be used with the extract command.

Example: List codebases in a directory (table format)

# List all discovered codebases in the current directory
unpack ls .
ID                     LANGUAGE   PATH
golang:.               golang     .
npm:frontend           npm        frontend
rust:backend/api       rust       backend/api

Example: List codebases in JSON format

unpack ls --format=json /path/to/project

Example: List codebases ignoring specific patterns

unpack ls --ignore "*/testdata/*" --ignore "temp/" .

Supported Ecosystems

Unpack includes decomposers for four package ecosystems. See the decomposer documentation for details.

Ecosystem Lock file Manifest Remote enrichment
Go go.sum go.mod Go module proxy
Maven (none) pom.xml Maven Central
npm package-lock.json package.json (none)
Rust Cargo.lock Cargo.toml crates.io API

Support for more ecosystems is planned.

Contributing

We welcome contributions! Whether it's reporting a bug, suggesting a feature, or submitting a pull request, your feedback is valuable.

  • Open an Issue: If you find a problem or have an idea for an improvement, please open a new issue.
  • Pull Requests: Feel free to fork the repository and submit a pull request with your changes.

License

This tool and its libraries are released under the Apache 2.0 License and copyright by Carabiner Systems, Inc. See the LICENSE file for more details. Feel free to open issues to report problems or request features. Patches are welcome!

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
api
v1
Package image implements the unpacker that extracts dependency data from container images.
Package image implements the unpacker that extracts dependency data from container images.
internal
cmd
git
Package license provides SPDX license identifier normalization.
Package license provides SPDX license identifier normalization.
Package release implements the unpacker that decomposes software releases.
Package release implements the unpacker that decomposes software releases.
Package requirements collects a few implementations of the v1.Requirement interface.
Package requirements collects a few implementations of the v1.Requirement interface.
Package sbom implements the unpacker that reads dependency data from a software bill of materials.
Package sbom implements the unpacker that reads dependency data from a software bill of materials.
source
npm
Package system implements the unpacker that reads installed-package data from a "system" — the local machine, a container image, a VM image, etc.
Package system implements the unpacker that reads installed-package data from a "system" — the local machine, a container image, a VM image, etc.
apk
Package apk implements a SystemDecomposer that reads the installed-package database used by apk-based distributions (Alpine, Wolfi, ...).
Package apk implements a SystemDecomposer that reads the installed-package database used by apk-based distributions (Alpine, Wolfi, ...).
deb
Package deb implements a SystemDecomposer that reads the installed-package database used by dpkg-based distributions (Debian, Ubuntu, ...) and by distroless images, which ship the same database split into per-package files.
Package deb implements a SystemDecomposer that reads the installed-package database used by dpkg-based distributions (Debian, Ubuntu, ...) and by distroless images, which ship the same database split into per-package files.
internal/osrelease
Package osrelease reads the systemd os-release file from a system filesystem.
Package osrelease reads the systemd os-release file from a system filesystem.
rpm
Package rpm implements a SystemDecomposer that reads the installed-package database used by RPM-based distributions (RHEL, Fedora, openSUSE, ...).
Package rpm implements a SystemDecomposer that reads the installed-package database used by RPM-based distributions (RHEL, Fedora, openSUSE, ...).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL