| 1 |
# go-cpe |
| 2 |
|
| 3 |
[](https://travis-ci.org/knqyf263/go-cpe) |
| 4 |
[](https://coveralls.io/github/knqyf263/go-cpe?branch=initial) |
| 5 |
[](https://goreportcard.com/report/github.com/knqyf263/go-cpe) |
| 6 |
[](https://godoc.org/github.com/knqyf263/go-cpe) |
| 7 |
[](/LICENSE) |
| 8 |
|
| 9 |
A Go library for [CPE(A Common Platform Enumeration 2.3)](https://cpe.mitre.org/specification/) |
| 10 |
|
| 11 |
`go-cpe` is a implementation of the CPE Naming and Matching algorithms, as described in NIST IRs [7695](https://csrc.nist.gov/publications/detail/nistir/7695/final) and [7696](https://csrc.nist.gov/publications/detail/nistir/7696/final). |
| 12 |
|
| 13 |
For the reference Java implementation, see: https://cpe.mitre.org/specification/CPE_Reference_Implementation_Sep2011.zipx |
| 14 |
|
| 15 |
# Installation and Usage |
| 16 |
|
| 17 |
Installation can be done with a normal go get: |
| 18 |
|
| 19 |
``` |
| 20 |
$ go get github.com/knqyf263/go-cpe/... |
| 21 |
``` |
| 22 |
|
| 23 |
## Compare |
| 24 |
See [example](/examples) |
| 25 |
|
| 26 |
``` |
| 27 |
package main |
| 28 |
|
| 29 |
import ( |
| 30 |
"fmt" |
| 31 |
|
| 32 |
"github.com/knqyf263/go-cpe/matching" |
| 33 |
"github.com/knqyf263/go-cpe/naming" |
| 34 |
) |
| 35 |
|
| 36 |
func main() { |
| 37 |
wfn, err := naming.UnbindURI("cpe:/a:microsoft:internet_explorer%01%01%01%01:8%02:beta") |
| 38 |
if err != nil { |
| 39 |
fmt.Println(err) |
| 40 |
return |
| 41 |
} |
| 42 |
wfn2, err := naming.UnbindFS(`cpe:2.3:a:microsoft:internet_explorer:8.0.6001:beta:*:*:*:*:*:*`) |
| 43 |
if err != nil { |
| 44 |
fmt.Println(err) |
| 45 |
return |
| 46 |
} |
| 47 |
fmt.Println(matching.IsDisjoint(wfn, wfn2)) |
| 48 |
fmt.Println(matching.IsEqual(wfn, wfn2)) |
| 49 |
fmt.Println(matching.IsSubset(wfn, wfn2)) |
| 50 |
fmt.Println(matching.IsSuperset(wfn, wfn2)) |
| 51 |
} |
| 52 |
``` |
| 53 |
|
| 54 |
# Contribute |
| 55 |
|
| 56 |
1. fork a repository: github.com/knqyf263/go-cpe to github.com/you/repo |
| 57 |
2. get original code: `go get github.com/knqyf263/go-cpe` |
| 58 |
3. work on original code |
| 59 |
4. add remote to your repo: git remote add myfork https://github.com/you/repo.git |
| 60 |
5. push your changes: git push myfork |
| 61 |
6. create a new Pull Request |
| 62 |
|
| 63 |
- see [GitHub and Go: forking, pull requests, and go-getting](http://blog.campoy.cat/2014/03/github-and-go-forking-pull-requests-and.html) |
| 64 |
|
| 65 |
---- |
| 66 |
|
| 67 |
# License |
| 68 |
MIT |
| 69 |
|
| 70 |
# Author |
| 71 |
Teppei Fukuda |