services

package
v1.1.0-pocketbase Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type NVDResponse

type NVDResponse struct {
	ResultsPerPage  int    `json:"resultsPerPage"`
	StartIndex      int    `json:"startIndex"`
	TotalResults    int    `json:"totalResults"`
	Format          string `json:"format"`
	Version         string `json:"version"`
	Timestamp       string `json:"timestamp"`
	Vulnerabilities []struct {
		CVE struct {
			ID               string `json:"id"`
			SourceIdentifier string `json:"sourceIdentifier"`
			Published        string `json:"published"`
			LastModified     string `json:"lastModified"`
			VulnStatus       string `json:"vulnStatus"`
			Descriptions     []struct {
				Lang  string `json:"lang"`
				Value string `json:"value"`
			} `json:"descriptions"`
			Metrics struct {
				CVSSMetricV2 []struct {
					Source   string `json:"source"`
					Type     string `json:"type"`
					CVSSData struct {
						Version               string  `json:"version"`
						VectorString          string  `json:"vectorString"`
						BaseScore             float64 `json:"baseScore"`
						AccessVector          string  `json:"accessVector"`
						AccessComplexity      string  `json:"accessComplexity"`
						Authentication        string  `json:"authentication"`
						ConfidentialityImpact string  `json:"confidentialityImpact"`
						IntegrityImpact       string  `json:"integrityImpact"`
						AvailabilityImpact    string  `json:"availabilityImpact"`
					} `json:"cvssData"`
					BaseSeverity        string  `json:"baseSeverity"`
					ExploitabilityScore float64 `json:"exploitabilityScore"`
					ImpactScore         float64 `json:"impactScore"`
				} `json:"cvssMetricV2"`
				CVSSMetricV3 []struct {
					Source   string `json:"source"`
					Type     string `json:"type"`
					CVSSData struct {
						Version               string  `json:"version"`
						VectorString          string  `json:"vectorString"`
						BaseScore             float64 `json:"baseScore"`
						BaseSeverity          string  `json:"baseSeverity"`
						AttackVector          string  `json:"attackVector"`
						AttackComplexity      string  `json:"attackComplexity"`
						PrivilegesRequired    string  `json:"privilegesRequired"`
						UserInteraction       string  `json:"userInteraction"`
						Scope                 string  `json:"scope"`
						ConfidentialityImpact string  `json:"confidentialityImpact"`
						IntegrityImpact       string  `json:"integrityImpact"`
						AvailabilityImpact    string  `json:"availabilityImpact"`
					} `json:"cvssData"`
					ExploitabilityScore float64 `json:"exploitabilityScore"`
					ImpactScore         float64 `json:"impactScore"`
				} `json:"cvssMetricV3"`
			} `json:"metrics"`
			Weaknesses []struct {
				Source      string `json:"source"`
				Type        string `json:"type"`
				Description []struct {
					Lang  string `json:"lang"`
					Value string `json:"value"`
				} `json:"description"`
			} `json:"weaknesses"`
			Configurations []struct {
				Nodes []struct {
					Operator string `json:"operator"`
					Negate   bool   `json:"negate"`
					CPEMatch []struct {
						Vulnerable      bool   `json:"vulnerable"`
						Criteria        string `json:"criteria"`
						MatchCriteriaID string `json:"matchCriteriaId"`
					} `json:"cpeMatch"`
				} `json:"nodes"`
			} `json:"configurations"`
			References []struct {
				URL    string `json:"url"`
				Source string `json:"source"`
			} `json:"references"`
		} `json:"cve"`
	} `json:"vulnerabilities"`
}

NVDResponse represents the response from NVD API

type SecurityDataDownloader

type SecurityDataDownloader struct {
	// contains filtered or unexported fields
}

SecurityDataDownloader handles downloading and updating security datasets

func NewSecurityDataDownloader

func NewSecurityDataDownloader(logger *log.Logger) *SecurityDataDownloader

NewSecurityDataDownloader creates a new security data downloader

func (*SecurityDataDownloader) CheckForUpdates

func (s *SecurityDataDownloader) CheckForUpdates(ctx context.Context, dataSource string, lastUpdate time.Time) (bool, *time.Time, error)

CheckForUpdates checks if there are updates available for security datasets

func (*SecurityDataDownloader) DownloadATTACKDataset

func (s *SecurityDataDownloader) DownloadATTACKDataset(ctx context.Context) ([]models.ATTACKTechnique, []models.ATTACKTactic, error)

DownloadATTACKDataset downloads the MITRE ATT&CK dataset

func (*SecurityDataDownloader) DownloadIncrementalNVD

func (s *SecurityDataDownloader) DownloadIncrementalNVD(ctx context.Context, lastUpdate time.Time) ([]models.NVDCVE, error)

DownloadIncrementalNVD downloads only new CVEs since last update

func (*SecurityDataDownloader) DownloadNVDDataset

func (s *SecurityDataDownloader) DownloadNVDDataset(ctx context.Context) ([]models.NVDCVE, error)

DownloadNVDDataset downloads the complete NVD dataset

func (*SecurityDataDownloader) DownloadOWASPDataset

func (s *SecurityDataDownloader) DownloadOWASPDataset(ctx context.Context) ([]models.OWASPProcedure, error)

DownloadOWASPDataset downloads OWASP security testing procedures and guidelines

func (*SecurityDataDownloader) GetDataSize

func (s *SecurityDataDownloader) GetDataSize() map[string]interface{}

GetDataSize estimates the size of security datasets

type SecurityRetrievalService

type SecurityRetrievalService struct {
	// contains filtered or unexported fields
}

SecurityRetrievalService handles intelligent retrieval and summarization of security data

func NewSecurityRetrievalService

func NewSecurityRetrievalService(securityRepo repository.SecurityRepositoryInterface, logger *log.Logger) *SecurityRetrievalService

NewSecurityRetrievalService creates a new security retrieval service

func (*SecurityRetrievalService) QuerySecurityData

QuerySecurityData performs intelligent querying across security datasets

type SecurityUpdateService

type SecurityUpdateService struct {
	// contains filtered or unexported fields
}

SecurityUpdateService handles intelligent updates to security datasets

func NewSecurityUpdateService

func NewSecurityUpdateService(
	downloader *SecurityDataDownloader,
	securityRepo repository.SecurityRepositoryInterface,
	logger *log.Logger,
) *SecurityUpdateService

NewSecurityUpdateService creates a new security update service

func (*SecurityUpdateService) CheckAndUpdate

func (s *SecurityUpdateService) CheckAndUpdate(ctx context.Context, strategy UpdateStrategy) error

CheckAndUpdate checks for updates and performs intelligent update for a specific data source

func (*SecurityUpdateService) CheckAndUpdateAll

func (s *SecurityUpdateService) CheckAndUpdateAll(ctx context.Context) error

CheckAndUpdateAll checks for updates and performs intelligent updates for all data sources

func (*SecurityUpdateService) ForceFullUpdate

func (s *SecurityUpdateService) ForceFullUpdate(ctx context.Context) error

ForceFullUpdate forces a complete update of all data sources

type UpdateStrategy

type UpdateStrategy struct {
	DataSource      string
	CheckInterval   time.Duration
	ForceFullUpdate bool
	MaxAge          time.Duration
}

UpdateStrategy defines how to handle updates for each data source

func GetDefaultUpdateStrategies

func GetDefaultUpdateStrategies() []UpdateStrategy

GetDefaultUpdateStrategies returns default update strategies for all data sources

Jump to

Keyboard shortcuts

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