Skip to content

Unofficial but convenient Go wrapper around the NVD REST JSON API

License

Notifications You must be signed in to change notification settings

pandatix/nvdapi

Repository files navigation

NVD API

reference go report codecov CI

The NVD API is an unofficial Go wrapper around the NVD API.

Supports:

How to use

The following shows how to basically use the wrapper to get all the CVEs for a given keyword.

package main

import (
	"fmt"
	"log"
	"net/http"

	"github.com/Pandatix/nvdapi"
)

func main() {
	// Configure and issue the request
	params := nvdapi.GetCVEsParams{
		Keyword: str("gitea"),
	}
	resp, err := nvdapi.GetCVEs(&http.Client{}, params)
	if err != nil {
		log.Fatal(err)
	}

	// Make sure there are CVE items
	if resp.Result.CVEItems == nil {
		return
	}

	for _, item := range *resp.Result.CVEItems {
		fmt.Println(item.CVE.CVEDataMeta.ID)
	}
}

func str(str string) *string {
	return &str
}

How to contribute

Please read first the code of conduct.

To contribute, please refers to the contribution guide.

Contact

To provide feedbacks or submitting an issue, please file and issue. In case it's regarding a security issue, refers to the Security guide.