Documentation
¶
Index ¶
- Variables
- func DB() (*sql.DB, error)
- func IPIntelSearch(indexName, country, asn, cidr, countryCode, hostname, id string) ([]IPEntry, *Stats, error)
- func ImportIndex(zipPath string, index string, progressCallback func(int)) (int64, error)
- func MetaByCVE(cve string) (*sdk.IndexVulncheckNvd2Response, error)
- func PURLSearch(indexName string, instance packageurl.PackageURL) ([]PurlEntry, *Stats, error)
- func SchemaVersionFor(index string) int
- type Column
- type IPEntry
- type PurlEntry
- type Schema
- type Stats
Constants ¶
This section is empty.
Variables ¶
var Schemas = []Schema{ { Fallback: true, Name: "fallback", Indices: []string{}, Columns: []Column{ {Name: "data", Type: "TEXT", Index: false, NotNull: true, IsJSON: true}, }, }, { Indices: []string{"vulncheck-nvd2"}, Name: "nvd", Results: true, Columns: []Column{ {Name: "id", Type: "TEXT", Index: true, NotNull: true}, {Name: "published", Type: "TEXT", Index: false, NotNull: false, IsJSON: false}, {Name: "vulncheckKEVExploitAdd", Type: "TEXT", Index: false, NotNull: false, IsJSON: false}, {Name: "metrics", Type: "TEXT", Index: false, NotNull: false, IsJSON: true}, {Name: "weaknesses", Type: "TEXT", Index: false, NotNull: false, IsJSON: true}, {Name: "description", Type: "TEXT", Index: false, NotNull: false, IsJSON: true}, }, }, { Indices: []string{"ipintel-3d", "ipintel-10d", "ipintel-30d"}, Name: "ipintel", Columns: []Column{ {Name: "ip", Type: "TEXT", Index: true, NotNull: true}, {Name: "country", Type: "TEXT", Index: true, NotNull: true}, {Name: "asn", Type: "TEXT", Index: true, NotNull: true}, {Name: "country_code", Type: "TEXT", Index: true, NotNull: true}, {Name: "hostnames", Type: "TEXT", Index: true, NotNull: false, IsJSON: true}, {Name: "type", Type: "TEXT", Index: false, NotNull: false, IsJSON: true}, {Name: "port", Type: "INTEGER", Index: false, NotNull: true}, {Name: "ssl", Type: "BOOLEAN", Index: false, NotNull: true}, {Name: "lastSeen", Type: "TEXT", Index: false, NotNull: true}, {Name: "city", Type: "TEXT", Index: false, NotNull: false}, {Name: "cve", Type: "TEXT", Index: false, NotNull: false, IsJSON: true}, {Name: "matches", Type: "TEXT", Index: false, NotNull: false, IsJSON: true}, {Name: "type_kind", Type: "TEXT", Index: false, NotNull: false}, {Name: "type_finding", Type: "TEXT", Index: false, NotNull: false}, {Name: "feed_ids", Type: "TEXT", Index: false, NotNull: false, IsJSON: true}, }, }, { Name: "purl PM", Version: 2, Indices: []string{ "cargo", "golang", "cocoapods", "hex", "npm", "gem", "pypi", "maven", "nuget", "composer", "hackage", "cran", "pub", "conan", "swift", "go", "dub", "elixir", "julia", "luarocks", "opam", "r", "vcpkg", }, Columns: []Column{ {Name: "name", Type: "TEXT", Index: false, NotNull: true}, {Name: "version", Type: "TEXT", Index: false, NotNull: true}, {Name: "purl", Type: "TEXT", Index: false, NotNull: true, IsJSON: true}, {Name: "licenses", Type: "TEXT", Index: false, NotNull: false, IsJSON: true}, {Name: "cves", Type: "TEXT", Index: false, NotNull: false, IsJSON: true}, {Name: "vulnerabilities", Type: "TEXT", Index: false, NotNull: false, IsJSON: true}, {Name: "research_attributes", Type: "TEXT", Index: false, NotNull: false, IsJSON: true}, {Name: purlKeyColumn, Type: "TEXT", Index: true, NotNull: false}, }, }, { Name: "purl OS", Version: 2, Indices: []string{ "alpine-purls", "rocky-purls", "debian-purls", "ubuntu-purls", }, Columns: []Column{ {Name: "name", Type: "TEXT", Index: false, NotNull: true}, {Name: "version", Type: "TEXT", Index: false, NotNull: true}, {Name: "purl", Type: "TEXT", Index: false, NotNull: true, IsJSON: true}, {Name: "licenses", Type: "TEXT", Index: false, NotNull: false, IsJSON: true}, {Name: "cves", Type: "TEXT", Index: false, NotNull: false, IsJSON: true}, {Name: "vulnerabilities", Type: "TEXT", Index: false, NotNull: false, IsJSON: true}, {Name: "research_attributes", Type: "TEXT", Index: false, NotNull: false, IsJSON: true}, {Name: purlKeyColumn, Type: "TEXT", Index: true, NotNull: false}, }, }, { Name: "cpecve", Indices: []string{"cpecve"}, Columns: []Column{ {Name: "vendor", Type: "TEXT", Index: true, NotNull: false}, {Name: "product", Type: "TEXT", Index: true, NotNull: false}, {Name: "version", Type: "TEXT", Index: true, NotNull: false}, {Name: "update", Type: "TEXT", Index: true, NotNull: false}, {Name: "edition", Type: "TEXT", Index: true, NotNull: false}, {Name: "language", Type: "TEXT", Index: true, NotNull: false}, {Name: "sw_edition", Type: "TEXT", Index: true, NotNull: false}, {Name: "target_sw", Type: "TEXT", Index: true, NotNull: false}, {Name: "target_hw", Type: "TEXT", Index: true, NotNull: false}, {Name: "other", Type: "TEXT", Index: true, NotNull: false}, {Name: "cpe23Uri", Type: "TEXT", Index: true, NotNull: false}, {Name: "cves", Type: "TEXT", Index: false, NotNull: false, IsJSON: true}, }, }, }
Functions ¶
func IPIntelSearch ¶
func ImportIndex ¶
ImportIndex loads the JSON files in a downloaded backup zip into the table for index, reading them straight out of the archive rather than extracting them to disk first. It returns the uncompressed size of the data imported.
func MetaByCVE ¶ added in v0.10.0
func MetaByCVE(cve string) (*sdk.IndexVulncheckNvd2Response, error)
func PURLSearch ¶
func PURLSearch(indexName string, instance packageurl.PackageURL) ([]PurlEntry, *Stats, error)
func SchemaVersionFor ¶ added in v1.4.0
SchemaVersionFor returns the table layout version this CLI expects for a synced index.
Types ¶
type IPEntry ¶
type IPEntry struct {
IP string `json:"ip"`
Port int `json:"port"`
SSL bool `json:"ssl"`
LastSeen string `json:"lastSeen"`
ASN string `json:"asn"`
Country string `json:"country"`
CountryCode string `json:"country_code"`
City string `json:"city"`
CVE []string `json:"cve"`
Matches []string `json:"matches"`
Hostnames []string `json:"hostnames"`
Type struct {
ID string `json:"id"`
Kind string `json:"kind"`
Finding string `json:"finding"`
} `json:"type"`
FeedIDs []string `json:"feed_ids"`
}
type PurlEntry ¶
type PurlEntry struct {
Name string `json:"name"`
Version string `json:"version"`
Purl []string `json:"purl"`
CVEs []string `json:"cves"`
Vulnerabilities []sdk.PurlVulnerability `json:"vulnerabilities"`
ResearchAttributes *sdk.PurlResearchAttributes `json:"research_attributes,omitempty"`
}
type Schema ¶
type Schema struct {
Indices []string
Name string
Fallback bool
Results bool // whether the JSON in each file is inside a "results" array
Columns []Column
// Version is bumped whenever the CLI starts relying on a change to the
// table layout. A cached index built at an older version is re-imported
// on the next sync even when the upstream backup has not changed.
Version int
}