Hi, I have a piece of code that retrieves data in a json format but for some reason he shows me everything but… the publish_date and update_date information, i suspect maybe something to do with my type but well if anyone can help:
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"log"
"net/http"
)
type Cve struct {
Cve_id string
Cwe_id int
Summary string
Exploit_count int
publish_date string
update_date string
url string
}
func main() {
//get cve list
res, err := http.Get("http://www.cvedetails.com/json-feed.php?numrows=10&vendor_id=0&product_id=0&version_id=0&hasexp=0&opec=0&opov=0&opcsrf=0&opfileinc=0&opgpriv=0&opsqli=0&opxss=0&opdirt=0&opmemc=0&ophttprs=0&opbyp=0&opginf=0&opdos=0&orderby=3&cvssscoremin=5")
if err != nil {
log.Fatal(err)
}
//read the results to a variable
data, err := ioutil.ReadAll(res.Body)
res.Body.Close()
if err != nil {
log.Fatal(err)
}
var cves []Cve
err = json.Unmarshal(data, &cves)
for i := 0; i < len(cves); i++ {
fmt.Println(cves[i].Cve_id)
fmt.Println(cves[i].Exploit_count)
fmt.Println(cves[i].Summary)
fmt.Println(string(cves[i].publish_date))
}
}
Output
CVE-2016-5821
0
Huawei HiSuite before 4.0.4.204_ove (Out of China) and before 4.0.4.301 (China) use a weak ACL (FILE_WRITE_DATA for BUILTIN\Users) for the HiSuite service directory, which allows local users to gain SYSTEM privileges via a Trojan horse (1) SspiCli.dll or (2) USERENV.dll file or possibly other unspecified DLL files.
➜ cve git:(master) ✗