1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226
|
package oval
import (
"encoding/xml"
)
// Root : root object
type Root struct {
XMLName xml.Name `xml:"oval_definitions"`
Generator Generator `xml:"generator"`
Definitions Definitions `xml:"definitions"`
Tests Tests `xml:"tests"`
Objects Objects `xml:"objects"`
States States `xml:"states"`
}
// Generator : >generator
type Generator struct {
XMLName xml.Name `xml:"generator"`
ProductName string `xml:"product_name"`
ProductVersion string `xml:"product_version"`
SchemaVersion string `xml:"schema_version"`
Timestamp string `xml:"timestamp"`
}
// Definitions : >definitions
type Definitions struct {
XMLName xml.Name `xml:"definitions"`
Definitions []Definition `xml:"definition"`
}
// Definition : >definitions>definition
type Definition struct {
XMLName xml.Name `xml:"definition"`
ID string `xml:"id,attr"`
Class string `xml:"class,attr"`
Title string `xml:"metadata>title"`
Affecteds []Affected `xml:"metadata>affected"`
References []Reference `xml:"metadata>reference"`
Description string `xml:"metadata>description"`
Advisory Advisory `xml:"metadata>advisory"` // RedHat, Oracle, Ubuntu
Debian Debian `xml:"metadata>debian"` // Debian
Criteria Criteria `xml:"criteria"`
}
// Criteria : >definitions>definition>criteria
type Criteria struct {
XMLName xml.Name `xml:"criteria"`
Operator string `xml:"operator,attr"`
Criterias []Criteria `xml:"criteria"`
Criterions []Criterion `xml:"criterion"`
}
// Criterion : >definitions>definition>criteria>*>criterion
type Criterion struct {
XMLName xml.Name `xml:"criterion"`
Negate bool `xml:"negate,attr"`
TestRef string `xml:"test_ref,attr"`
Comment string `xml:"comment,attr"`
}
// Affected : >definitions>definition>metadata>affected
type Affected struct {
XMLName xml.Name `xml:"affected"`
Family string `xml:"family,attr"`
Platforms []string `xml:"platform"`
}
// Reference : >definitions>definition>metadata>reference
type Reference struct {
XMLName xml.Name `xml:"reference"`
Source string `xml:"source,attr"`
RefID string `xml:"ref_id,attr"`
RefURL string `xml:"ref_url,attr"`
}
// Advisory : >definitions>definition>metadata>advisory
// RedHat and Ubuntu OVAL
type Advisory struct {
XMLName xml.Name `xml:"advisory"`
Severity string `xml:"severity"`
Cves []Cve `xml:"cve"`
Bugzillas []Bugzilla `xml:"bugzilla"`
AffectedCPEList []string `xml:"affected_cpe_list>cpe"`
Refs []Ref `xml:"ref"` // Ubuntu Only
Bugs []Bug `xml:"bug"` // Ubuntu Only
Issued struct {
Date string `xml:"date,attr"`
} `xml:"issued"`
Updated struct {
Date string `xml:"date,attr"`
} `xml:"updated"`
}
// Ref : >definitions>definition>metadata>advisory>ref
// Ubuntu OVAL
type Ref struct {
XMLName xml.Name `xml:"ref"`
URL string `xml:",chardata"`
}
// Bug : >definitions>definition>metadata>advisory>bug
// Ubuntu OVAL
type Bug struct {
XMLName xml.Name `xml:"bug"`
URL string `xml:",chardata"`
}
// Cve : >definitions>definition>metadata>advisory>cve
// RedHat OVAL
type Cve struct {
XMLName xml.Name `xml:"cve"`
CveID string `xml:",chardata"`
Cvss2 string `xml:"cvss2,attr"`
Cvss3 string `xml:"cvss3,attr"`
Cwe string `xml:"cwe,attr"`
Impact string `xml:"impact,attr"`
Href string `xml:"href,attr"`
Public string `xml:"public,attr"`
}
// Bugzilla : >definitions>definition>metadata>advisory>bugzilla
// RedHat OVAL
type Bugzilla struct {
XMLName xml.Name `xml:"bugzilla"`
ID string `xml:"id,attr"`
URL string `xml:"href,attr"`
Title string `xml:",chardata"`
}
// Debian : >definitions>definition>metadata>debian
type Debian struct {
XMLName xml.Name `xml:"debian"`
MoreInfo string `xml:"moreinfo"`
Date string `xml:"date"`
}
// Tests : >tests
type Tests struct {
XMLName xml.Name `xml:"tests"`
LineTests []LineTest `xml:"line_test"`
Version55Tests []Version55Test `xml:"version55_test"`
}
// LineTest : >tests>line_test
type LineTest struct {
XMLName xml.Name `xml:"line_test"`
ID string `xml:"id,attr"`
StateOperator string `xml:"state_operator,attr"`
ObjectRefs []ObjectRef `xml:"object"`
StateRefs []StateRef `xml:"state"`
Comment string `xml:"comment,attr"`
}
// Version55Test : >tests>version55_test
type Version55Test struct {
XMLName xml.Name `xml:"version55_test"`
ID string `xml:"id,attr"`
StateOperator string `xml:"state_operator,attr"`
ObjectRefs []ObjectRef `xml:"object"`
StateRefs []StateRef `xml:"state"`
Comment string `xml:"comment,attr"`
}
// ObjectRef : >tests>line_test>object-object_ref
// : >tests>version55_test>object-object_ref
type ObjectRef struct {
XMLName xml.Name `xml:"object"`
ObjectRef string `xml:"object_ref,attr"`
}
// StateRef : >tests>line_test>state-state_ref
// : >tests>version55_test>state-state_ref
type StateRef struct {
XMLName xml.Name `xml:"state"`
StateRef string `xml:"state_ref,attr"`
}
// Objects : >objects
type Objects struct {
XMLName xml.Name `xml:"objects"`
LineObjects []LineObject `xml:"line_object"`
Version55Objects []Version55Object `xml:"version55_object"`
}
// LineObject : >objects>line_object
type LineObject struct {
XMLName xml.Name `xml:"line_object"`
ID string `xml:"id,attr"`
ShowSubcommands []string `xml:"show_subcommand"`
}
// Version55Object : >objects>version55_object
type Version55Object struct {
XMLName xml.Name `xml:"version55_object"`
ID string `xml:"id,attr"`
}
// States : >states
type States struct {
XMLName xml.Name `xml:"states"`
LineStates []LineState `xml:"line_state"`
Version55States []Version55State `xml:"version55_state"`
}
// LineState : >states>line_state
type LineState struct {
XMLName xml.Name `xml:"line_state"`
ID string `xml:"id,attr"`
ShowSubcommand string `xml:"show_subcommand"`
ConfigLine ConfigLine `xml:"config_line"`
}
// ConfigLine : >states>line_state>config_line
type ConfigLine struct {
XMLName xml.Name `xml:"config_line"`
Body string `xml:",chardata"`
Operation string `xml:"operation,attr"`
}
// Version55State : >states>version55_state
type Version55State struct {
XMLName xml.Name `xml:"version55_state"`
ID string `xml:"id,attr"`
VersionString string `xml:"version_string"`
}
|