| 1 |
package main |
| 2 |
|
| 3 |
import ( |
| 4 |
"fmt" |
| 5 |
|
| 6 |
"github.com/knqyf263/go-cpe/common" |
| 7 |
"github.com/knqyf263/go-cpe/matching" |
| 8 |
"github.com/knqyf263/go-cpe/naming" |
| 9 |
) |
| 10 |
|
| 11 |
func main() { |
| 12 |
wfn, err := naming.UnbindURI("cpe:/a:microsoft:internet_explorer%01%01%01%01:8%02:beta") |
| 13 |
if err != nil { |
| 14 |
fmt.Println(err) |
| 15 |
return |
| 16 |
} |
| 17 |
wfn2, err := naming.UnbindFS(`cpe:2.3:a:microsoft:internet_explorer:8.0.6001:beta:*:*:*:*:*:*`) |
| 18 |
if err != nil { |
| 19 |
fmt.Println(err) |
| 20 |
return |
| 21 |
} |
| 22 |
fmt.Println(wfn, wfn2) |
| 23 |
fmt.Println(matching.IsDisjoint(wfn, wfn2)) // false |
| 24 |
fmt.Println(matching.IsEqual(wfn, wfn2)) // false |
| 25 |
fmt.Println(matching.IsSubset(wfn, wfn2)) // false |
| 26 |
fmt.Println(matching.IsSuperset(wfn, wfn2)) // true |
| 27 |
|
| 28 |
wfn3 := common.NewWellFormedName() |
| 29 |
wfn3.Set("part", "a") |
| 30 |
wfn3.Set("vendor", "microsoft") |
| 31 |
wfn3.Set("product", "internet_explorer????") |
| 32 |
wfn3.Set("version", "8\\.0\\.6001") |
| 33 |
fmt.Println(naming.BindToURI(wfn3)) // cpe:/a:microsoft:internet_explorer%01%01%01%01:8.0.6001 |
| 34 |
fmt.Println(naming.BindToFS(wfn3)) // cpe:2.3:a:microsoft:internet_explorer????:8.0.6001:*:*:*:*:*:*:* |
| 35 |
} |