一个用于 CPE(通用平台枚举 2.3) 的 Go 库
go-cpe 是 CPE 命名与匹配算法的一种实现,如 NIST IR 7695 和 7696 所述。
有关参考 Java 实现,请参阅:https://cpe.mitre.org/specification/CPE_Reference_Implementation_Sep2011.zipx
可以通过常规的 go get 完成安装:
$ go get github.com/knqyf263/go-cpe/...
参见示例
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