vulndb

package
v0.0.0-...-c937b9e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 17, 2015 License: MIT, MIT Imports: 7 Imported by: 0

README

vulndb-go

Go SDK to access the vulnerability database

Installation

go get github.com/vulndb/vulndb-go

Usage

Load vulndb data from binary data and link to package

package main

import (
	"github.com/vulndb/vulndb-go/bindata"
	"log"
	"fmt"
)

func main() {
	vulns, err := bindata.LoadFromBin()
	if err != nil {
		log.Fatal(err)
	}
	for _, vuln := range vulns.FilterBySeverity("high") {
		fmt.Printf("%2d. %-52.50s [%s]\n", vuln.Id, vuln.Title, vuln.Severity)
	}
}

Contributing

Send your pull requests with improvements and bug fixes, making sure that all tests PASS:


    $ cd vulndb-go
    $ make tools # update required tools
    $ make
    Test packages
    PASS
    ok  	github.com/vulndb/vulndb-go/bindata	0.026s
    Run vet
    Check formats

Updating the database

This package embeds the vulnerability database in the bindata directory. To update the database with new information follow these steps:

    # Update the database
    make update-db

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MultiLine

type MultiLine []string

func (MultiLine) String

func (m MultiLine) String() string

func (*MultiLine) UnmarshalJSON

func (m *MultiLine) UnmarshalJSON(data []byte) error

type Reference

type Reference struct {
	Url   string `json:"url"`
	Title string `json:"title"`
}

type Vuln

type Vuln struct {
	Id          int              `json:"id"`
	Title       string           `json:"title"`
	Description MultiLine        `json:"description"`
	Severity    string           `json:"severity"`
	Tags        []string         `json:"tags,omitempty"`
	References  []Reference      `json:"references"`
	Wasc        []string         `json:"wasc,omitempty"`
	Cwe         []string         `json:"cwe,omitempty"`
	OwaspTop10  map[string][]int `json:"owasp_top_10,omitempty"`
	Fix         VulnFix          `json:"fix"`

	// filename is taken from file name
	Filename string
}

type VulnFix

type VulnFix struct {
	Guidance MultiLine `json:"guidance"`
	Effort   int       `json:"effort"`
}

type VulnList

type VulnList []*Vuln

func LoadFromDir

func LoadFromDir(root string) (VulnList, error)

get all vulnerabilities from the vulndb directory

func (VulnList) FilterBySeverity

func (s VulnList) FilterBySeverity(severity string) VulnList

Get all vulnerabilites filtered by severity

func (VulnList) FilterByTag

func (s VulnList) FilterByTag(tag string) VulnList

Get all vulnerabilites filtered by tag

func (VulnList) GetById

func (s VulnList) GetById(id int) *Vuln

Get vulnerability by id

func (VulnList) Len

func (s VulnList) Len() int

Len is part of sort.Interface.

func (VulnList) Less

func (s VulnList) Less(i, j int) bool

Less is part of sort.Interface. It is implemented by comparing Id

func (VulnList) Swap

func (s VulnList) Swap(i, j int)

Swap is part of sort.Interface.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL