core

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 4, 2025 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TemplatesDefaultDirectory = path.Join(userHomeDir, "verdex-templates")

Templates

View Source
var TemplatesOfficialOrganization = "verdexlab"
View Source
var TemplatesOfficialRepository = "verdex"

Functions

func CheckIfCliUpdateIsAvailable

func CheckIfCliUpdateIsAvailable(config *Config)

Check if a Verdex CLI update is available and render message

func GetVerdexVersion

func GetVerdexVersion() string

Get Verdex CLI version

func LogBanner

func LogBanner()

Render Verdex banner

func ProxifyRequest added in v1.0.0

func ProxifyRequest(request *http.Request)

func RandomAlphaString

func RandomAlphaString(length int) string

Generate a random string (a-z) of given length

func SetupLogging

func SetupLogging()

Setup logger formatting

Types

type CVE added in v0.1.0

type CVE struct {
	ID                 string   `json:"id"`
	Description        string   `json:"description"`
	CvssScore          float32  `json:"cvss_score"`
	EpssScore          float32  `json:"epss_score"`
	IsKEV              bool     `json:"is_kev"`
	VulnerableVersions []string `json:"vulnerable_versions"`
	PublishedAt        string   `json:"published_at"`
}

type Cache

type Cache struct {
	Config   *Config                  `yaml:"-"`
	Releases CacheReleases            `yaml:"releases"`
	Products map[string]*CacheProduct `yaml:"products"`
}

func GetCache

func GetCache(config *Config) *Cache

Get cache from ".cache" file

func (*Cache) Save

func (cache *Cache) Save()

Write cache content to ".cache" file

type CacheProduct added in v0.1.0

type CacheProduct struct {
	Versions CacheProductVersions `yaml:"versions"`
}

type CacheProductVersions added in v0.1.0

type CacheProductVersions struct {
	List        []string `yaml:"list"`
	RefreshedAt int64    `yaml:"refreshed-at"`
}

type CacheReleases

type CacheReleases struct {
	Cli       CacheReleasesCli       `yaml:"cli"`
	Templates CacheReleasesTemplates `yaml:"templates"`
}

type CacheReleasesCli

type CacheReleasesCli struct {
	Latest      string `yaml:"latest"`
	Current     string `yaml:"current"`
	RefreshedAt int64  `yaml:"refreshed-at"`
}

type CacheReleasesTemplates

type CacheReleasesTemplates struct {
	Latest      string `yaml:"latest"`
	Current     string `yaml:"current"`
	RefreshedAt int64  `yaml:"refreshed-at"`
}

type Config

type Config struct {
	TemplatesSource       TemplatesSource
	TemplatesOrganization string
	TemplatesRepository   string
	TemplatesDirectory    string
	TemplatesFS           fs.FS
	TemplatesRelease      string
	Verbose               bool
	Test                  bool
	TestVersion           string
	TestSession           bool
}

type Detection

type Detection struct {
	StartedAt             time.Time
	EndedAt               time.Time
	Target                string
	Product               string
	Variables             map[string]string
	TotalRequests         uint
	Success               bool
	PossibleVersions      []*semver.Version
	Vulnerable            bool
	CVEs                  []*CVE
	UpdateRecommendations *DetectionUpdateRecommendations `json:"update_recommendations,omitempty"`
}

type DetectionUpdateRecommendations added in v0.1.0

type DetectionUpdateRecommendations struct {
	WithoutVulnerabilities         *string `json:"without_vulnerabilities"`
	WithoutCriticalVulnerabilities *string `json:"without_critical_vulnerabilities"`
}

type Environment

type Environment string
const (
	EnvironmentDevelopment      Environment = "development"
	EnvironmentReleaseDocker    Environment = "release-docker"
	EnvironmentReleaseGoInstall Environment = "release-go-install"
	EnvironmentReleaseBinary    Environment = "release-binary"
	EnvironmentReleaseWasmJS    Environment = "release-wasmjs"
)

func GetEnvironment

func GetEnvironment() Environment

type Execution

type Execution struct {
	Config          Config
	Targets         []string
	TargetsListPath string
	Product         string
	TestVersion     string
	OutputJsonPath  string
	Detections      []*Detection
}

func ParseFlags

func ParseFlags() *Execution

Parse CLI arguments

func (*Execution) NewDetection

func (execution *Execution) NewDetection(target string) *Detection

type TemplatesSource

type TemplatesSource string
const (
	TemplatesSourceGitHubOfficial TemplatesSource = "github-official"
	TemplatesSourceLocalDirectory TemplatesSource = "local-directory"
)

Jump to

Keyboard shortcuts

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