Documentation
¶
Overview ¶
Package ovaltoosv converts OVAL vulnerability definitions to OSV format.
Installation ¶
go get github.com/jeffmendoza/ovaltoosv/ovaltoosv
Usage ¶
Create a converter, parse OVAL XML, convert to OSV, and retrieve the results:
c := ovaltoosv.NewConverter()
err := c.ParseOVAL(ovalXMLContent)
if err != nil {
// handle error
}
err = c.ConvertToOSV()
if err != nil {
// handle error
}
// Get JSON output as map of ID -> JSON bytes
jsonOutput, err := c.GetJSON()
if err != nil {
// handle error
}
for id, jsonBytes := range jsonOutput {
// write each vulnerability to a file, etc.
}
// Or access vulnerabilities directly as OSV schema objects
vulns := c.GetVulnerabilities()
for id, vuln := range vulns {
// work with osvschema.Vulnerability objects
}
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Converter ¶
type Converter struct {
// contains filtered or unexported fields
}
Converter converts OVAL vulnerability definitions to OSV format.
func (*Converter) ConvertToOSV ¶
ConvertToOSV converts the parsed OVAL data to OSV format.
func (*Converter) GetJSON ¶
GetJSON returns a map of vulnerability IDs to their JSON byte representations.
func (*Converter) GetVulnerabilities ¶
func (c *Converter) GetVulnerabilities() map[string]*osvschema.Vulnerability
GetVulnerabilities returns a map of vulnerability IDs to their OSV representations.
Click to show internal directories.
Click to hide internal directories.