Documentation
¶
Overview ¶
Package vulndb reads and writes netcap.sqlite, the vulnerability and exploit database shared by the Go and Rust implementations.
The file format is specified in SCHEMA.md next to this file. Both implementations must build identical queries from the same inputs, so the query construction below is part of the format, not an implementation detail.
Index ¶
- Constants
- Variables
- func MatchExpr(terms ...string) string
- func Phrase(term string) string
- type Builder
- type CPEMatch
- type Configuration
- type DB
- func (d *DB) Close() error
- func (d *DB) ExploitCandidates(vendor, product, version string) ([]Exploit, error)
- func (d *DB) Exploits(vendor, product, version string) ([]Exploit, error)
- func (d *DB) Meta() (map[string]string, error)
- func (d *DB) Path() string
- func (d *DB) References(id string) ([]Reference, error)
- func (d *DB) Vulnerabilities(vendor, product, version string) ([]Vulnerability, error)
- func (d *DB) VulnerabilityCandidates(vendor, product, version string) ([]Vulnerability, error)
- type Exploit
- type Identity
- type Node
- type Reference
- type Vulnerability
Constants ¶
const ( // FileName is the database file inside the netcap dbs directory. FileName = "netcap.sqlite" // Format identifies the file in its meta table. Format = "netcap-vulndb" // SchemaVersion is bumped on any incompatible table or query change. SchemaVersion = 2 // MaxHits caps the results of one lookup, matching bleve's default // search size used by netcap v0.9.x. MaxHits = 10 )
Variables ¶
var ErrSchema = errors.New("vulndb: unsupported database schema")
ErrSchema reports a file that is not a netcap.sqlite of this schema.
Functions ¶
Types ¶
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
Builder writes a new database to a temporary file and publishes it with a rename on Finish, so readers never see a partial file.
func (*Builder) AddExploit ¶
AddExploit inserts e; a repeated ID keeps the first entry.
func (*Builder) AddVulnerability ¶
func (b *Builder) AddVulnerability(v Vulnerability) error
AddVulnerability inserts v; a repeated ID keeps the first entry.
type CPEMatch ¶
type CPEMatch struct {
Vulnerable bool `json:"vulnerable"`
Criteria string `json:"criteria"`
StartIncluding string `json:"versionStartIncluding,omitempty"`
StartExcluding string `json:"versionStartExcluding,omitempty"`
EndIncluding string `json:"versionEndIncluding,omitempty"`
EndExcluding string `json:"versionEndExcluding,omitempty"`
}
type Configuration ¶
type DB ¶
type DB struct {
// contains filtered or unexported fields
}
DB is a read-only handle.
func (*DB) ExploitCandidates ¶
ExploitCandidates returns unverified Exploit-DB text-search candidates containing every non-empty phrase of vendor, product and version.
func (*DB) Exploits ¶
Exploit associations require a CVE whose CPE applicability matches this software.
func (*DB) References ¶
References returns links for a CVE, or [] for a schema-1 database without the optional capability/table. Unknown capability versions are not interpreted.
func (*DB) Vulnerabilities ¶
func (d *DB) Vulnerabilities(vendor, product, version string) ([]Vulnerability, error)
func (*DB) VulnerabilityCandidates ¶
func (d *DB) VulnerabilityCandidates(vendor, product, version string) ([]Vulnerability, error)
VulnerabilityCandidates returns unverified text-search candidates containing every non-empty phrase of vendor and product and whose version list contains version exactly. Without a text term or a version nothing is returned.
type Exploit ¶
type Exploit struct {
ID string
File string
Description string
Date string
Author string
Type string
Platform string
Port string
CVEs []string
MatchStatus string
}
Exploit is one Exploit-DB entry. File is relative to the exploitdb folder.
type Identity ¶
type Identity struct{ Part, Vendor, Product, Version string }
func CanonicalSoftwareIdentity ¶ added in v0.16.3
CanonicalSoftwareIdentity exposes the same explicit aliases for audit deduplication.
type Reference ¶
type Reference struct {
URL string `json:"url"`
Source string `json:"source"`
Tags []string `json:"tags"`
}
Reference is NVD link metadata, never downloaded content.
func NormalizeReferences ¶
NormalizeReferences retains absolute HTTP(S) links with a host and no credentials, whitespace, controls or malformed escapes. Attribution is opaque.
type Vulnerability ¶
type Vulnerability struct {
ID string
Description string
Severity string
V2Score string
AccessVector string
AttackComplexity string
ConfidentialityImpact string
IntegrityImpact string
AvailabilityImpact string
BaseScore float64
BaseSeverity string
Versions []string
References []Reference `json:"references"`
Configurations []Configuration
MatchStatus string
}
Vulnerability is one NVD entry.