gotrivy

package module
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2024 License: MIT Imports: 8 Imported by: 0

README

GoTrivy

Build Status Go Report Card Docs License

gotrivy is a Golang helper for github.com/aquasecurity/trivy (reference).

The primary purpose of this library is currently to create XSLX reports from a JSON report file. Trivy provides reports in Table and JSON formats, along with a custom Template capability. This libary provides an additional XLSX option via github.com/grokify/gocharts. This can be run from the CLI as cmd/gotrivy/main.go or it can be done programmatically by inspecting the code of that file.

gotrivy.Report is an extension of github.com/aquasecurity/trivy/pkg/types.Report.

Installation

go install github.com/grokify/gotrivy/cmd/gotrivy

Usage

gotrivy -i <path-to-report.json> [-o path-to-report.xlsx]

If an output file isn't provided, a default output filename and path is used setting the filename to the original filename with a .xlsx suffix in the current directory.

Recipe

The following is an example of scanning a local image:

% docker image ls
REPOSITORY                       TAG       IMAGE ID       CREATED        SIZE
grokify/ringcentral-permahooks   v0.2.3    af80576e5e7d   6 months ago   640MB
% trivy image -f json grokify/ringcentral-permahooks > trivy-report.json
% gotrivy -i trivy-report.json -o trivy-report.xlsx

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrReportNotLoaded = errors.New("report not loaded")

Functions

func DetectedVulnerabilitiesTable

func DetectedVulnerabilitiesTable(vulns []types.DetectedVulnerability) (*table.Table, error)

Types

type Report

type Report struct {
	*types.Report
}

Report is an extended struct for `github.com/aquasecurity/trivy/pkg/types.Report`.

func ReadFile

func ReadFile(filename string) (*Report, error)

func (*Report) ByLibraryHistogramSets added in v0.3.0

func (r *Report) ByLibraryHistogramSets() (*histogram.HistogramSets, error)

func (*Report) BySeverityHistogramSet added in v0.4.0

func (r *Report) BySeverityHistogramSet() (*histogram.HistogramSet, error)

func (*Report) ByYearHistogramSets added in v0.4.0

func (r *Report) ByYearHistogramSets() (*histogram.HistogramSets, error)

func (*Report) ResultsCount

func (r *Report) ResultsCount() int

func (*Report) SeverityCounts

func (r *Report) SeverityCounts() map[string]uint

SeverityCounts returns the number of vulnerabiltiies detected by severity.

func (*Report) TableSet

func (r *Report) TableSet(addDates bool) (*table.TableSet, error)

func (*Report) VulnerabiliesTable

func (r *Report) VulnerabiliesTable(addDates bool) (*table.Table, error)

VulnerabiliesTable returns a table of vulnerabilities with a column for result set. It is formatted with Markdown links which can be rendered in XLSX using `github.com/grokify/gocharts/data/table`.

func (*Report) VulnerabilityCount

func (r *Report) VulnerabilityCount() int

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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