
CPE(A Common Platform Enumeration 2.3)用のGoライブラリ
CPE(A Common Platform Enumeration 2.3) のための Go ライブラリです。
go-cpe は、NIST IR 7695 および 7696 に記述されている CPE 命名およびマッチングアルゴリズムの実装です。
参考となる Java 実装については、https://cpe.mitre.org/specification/CPE_Reference_Implementation_Sep2011.zipx を参照してください。
通常の go get でインストールできます:
$ go get github.com/knqyf263/go-cpe/...
example を参照してください。
package main
import (
"fmt"
"github.com/knqyf263/go-cpe/matching"
"github.com/knqyf263/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))
}
go get github.com/knqyf263/go-cpeMIT
Teppei Fukuda