127 lines
3.7 KiB
Go
127 lines
3.7 KiB
Go
package msrcgo
|
|
|
|
import (
|
|
"encoding/json"
|
|
"io"
|
|
"time"
|
|
)
|
|
|
|
// DecodeUpdate takes an io.Reader and returns the decoded Update struct
|
|
func DecodeUpdate(r io.Reader) (u *Update, err error) {
|
|
u = new(Update)
|
|
err = json.NewDecoder(r).Decode(u)
|
|
return
|
|
}
|
|
|
|
// Update represents the MSRC Updates
|
|
type Update struct {
|
|
OdataContext string `json:"@odata.context"`
|
|
Value []struct {
|
|
ID string `json:"ID"`
|
|
Alias string `json:"Alias"`
|
|
DocumentTitle string `json:"DocumentTitle"`
|
|
Severity interface{} `json:"Severity"`
|
|
InitialReleaseDate time.Time `json:"InitialReleaseDate"`
|
|
CurrentReleaseDate time.Time `json:"CurrentReleaseDate"`
|
|
CvrfURL string `json:"CvrfUrl"`
|
|
} `json:"value"`
|
|
}
|
|
|
|
// DecodeCVRF takes an io.Reader and returns the decoded CVRF struct
|
|
func DecodeCVRF(r io.Reader) (cvrf *CVRF, err error) {
|
|
cvrf = new(CVRF)
|
|
err = json.NewDecoder(r).Decode(cvrf)
|
|
return
|
|
}
|
|
|
|
// CVRF represents a single Security Bulletin
|
|
type CVRF struct {
|
|
DocumentTitle struct {
|
|
Value string `json:"Value"`
|
|
} `json:"DocumentTitle"`
|
|
DocumentType struct {
|
|
Value string `json:"Value"`
|
|
} `json:"DocumentType"`
|
|
DocumentPublisher struct {
|
|
ContactDetails struct {
|
|
Value string `json:"Value"`
|
|
} `json:"ContactDetails"`
|
|
IssuingAuthority struct {
|
|
Value string `json:"Value"`
|
|
} `json:"IssuingAuthority"`
|
|
Type int `json:"Type"`
|
|
} `json:"DocumentPublisher"`
|
|
DocumentTracking struct {
|
|
Identification struct {
|
|
ID struct {
|
|
Value string `json:"Value"`
|
|
} `json:"ID"`
|
|
Alias struct {
|
|
Value string `json:"Value"`
|
|
} `json:"Alias"`
|
|
} `json:"Identification"`
|
|
Status int `json:"Status"`
|
|
Version string `json:"Version"`
|
|
RevisionHistory []struct {
|
|
Number string `json:"Number"`
|
|
Date string `json:"Date"`
|
|
Description struct {
|
|
Value string `json:"Value"`
|
|
} `json:"Description"`
|
|
} `json:"RevisionHistory"`
|
|
InitialReleaseDate string `json:"InitialReleaseDate"`
|
|
CurrentReleaseDate string `json:"CurrentReleaseDate"`
|
|
} `json:"DocumentTracking"`
|
|
DocumentNotes []struct {
|
|
Title string `json:"Title"`
|
|
Audience string `json:"Audience"`
|
|
Type int `json:"Type"`
|
|
Ordinal string `json:"Ordinal"`
|
|
Value string `json:"Value"`
|
|
} `json:"DocumentNotes"`
|
|
ProductTree struct {
|
|
FullProductName []struct {
|
|
ProductID string `json:"ProductID"`
|
|
Value string `json:"Value"`
|
|
} `json:"FullProductName"`
|
|
} `json:"ProductTree"`
|
|
Vulnerability []struct {
|
|
Title struct {
|
|
Value string `json:"Value"`
|
|
} `json:"Title"`
|
|
Notes []struct {
|
|
Type int `json:"Type"`
|
|
Value string `json:"Value"`
|
|
} `json:"Notes"`
|
|
DiscoveryDateSpecified bool `json:"DiscoveryDateSpecified"`
|
|
ReleaseDateSpecified bool `json:"ReleaseDateSpecified"`
|
|
CVE string `json:"CVE"`
|
|
ProductStatuses []struct {
|
|
ProductID []string `json:"ProductID"`
|
|
Type int `json:"Type"`
|
|
} `json:"ProductStatuses"`
|
|
CVSSScoreSets []struct {
|
|
BaseScore float64 `json:"BaseScore"`
|
|
TemporalScore float64 `json:"TemporalScore"`
|
|
Vector string `json:"Vector"`
|
|
ProductID []string `json:"ProductID"`
|
|
} `json:"CVSSScoreSets"`
|
|
Remediations []struct {
|
|
Description struct {
|
|
Value string `json:"Value"`
|
|
} `json:"Description"`
|
|
URL string `json:"URL"`
|
|
ProductID []string `json:"ProductID"`
|
|
Type int `json:"Type"`
|
|
DateSpecified bool `json:"DateSpecified"`
|
|
AffectedFiles []interface{} `json:"AffectedFiles"`
|
|
} `json:"Remediations"`
|
|
Acknowledgments []struct {
|
|
Name []struct {
|
|
Value string `json:"Value"`
|
|
} `json:"Name"`
|
|
URL []string `json:"URL"`
|
|
} `json:"Acknowledgments"`
|
|
Ordinal string `json:"Ordinal"`
|
|
} `json:"Vulnerability"`
|
|
}
|