/go-cpe

A Common Platform Enumeration 2.3 implementation for golang.

Primary LanguageGoMIT LicenseMIT

umisama/go-cpe Build Status

A Common Platform Enumeration 2.3 implementation for golang.

installation

go get github.com/umisama/go-cpe

usage

Simple example is here:

// Create new item with Setter functions.
item1 := cpe.NewItem(
item1.SetPart(cpe.Application)
item1.SetVendor(cpe.NewStringAttr("microsoft"))
item1.SetProduct(cpe.NewStringAttr("internet_explorer"))

// create new item with WFN.  You can use also other formats(url, formatted string and WFN).
item2, err := cpe.NewItemFromWfn(`wfn:[part="a",vendor="microsoft",product="internet_explorer",version="8\.0\.6001",update="beta"]`)
if err != nil {
        panic(err)
}
fmt.Println("Vendor :", item2.Vendor()

// Compare functions
fmt.Println("is relation superset between item1 and item2? : ", cpe.CheckSuperset(item1, item2))
fmt.Println("is relation equal between item1 and item2? : ", cpe.CheckEqual(item1, item2))
))

document

godoc.org

reference

license

under the MIT License.