A Go library for CPE(A Common Platform Enumeration 2.3)
go-cpe
is a implementation of the CPE Naming and Matching algorithms, as described in NIST IRs 7695 and 7696.
For the reference Java implementation, see: https://cpe.mitre.org/specification/CPE_Reference_Implementation_Sep2011.zipx
Installation can be done with a normal go get:
$ go get github.com/st3rv04ka/go-cpe/...
See example
package main
import (
"fmt"
"github.com/st3rv04ka/go-cpe/matching"
"github.com/st3rv04ka/go-cpe/naming"
)
func main() {
wfn, err := naming.UnbindURI("cpe:/a:microsoft:internet_explorer%01%01%01%01:8%02:beta")
if err != nil {
fmt.Println(err)
return
}
wfn2, err := naming.UnbindFS(`cpe:2.3:a:microsoft:internet_explorer:8.0.6001:beta:*:*:*:*:*:*`)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(matching.IsDisjoint(wfn, wfn2))
fmt.Println(matching.IsEqual(wfn, wfn2))
fmt.Println(matching.IsSubset(wfn, wfn2))
fmt.Println(matching.IsSuperset(wfn, wfn2))
}
- fork a repository: github.com/st3rv04ka/go-cpe to github.com/you/repo
- get original code:
go get github.com/st3rv04ka/go-cpe
- work on original code
- add remote to your repo: git remote add myfork https://github.com/you/repo.git
- push your changes: git push myfork
- create a new Pull Request
MIT
Teppei Fukuda