Documentation ¶
Index ¶
- func DoRequestWithRetry(req *http.Request, client *http.Client, logger zerolog.Logger) (*http.Response, error)
- type Block
- type CSVUtils
- type CSVUtilsInterface
- type CVE
- type DepList
- type FakeCVEParam
- type MongoUtils
- func (mu MongoUtils) CVEExists(cveId string, ctx context.Context, collection *mongo.Collection) (bool, error)
- func (mu MongoUtils) CreateCVE(cve *CVE, ctx context.Context, collection *mongo.Collection) error
- func (mu MongoUtils) DisconnectMongoClient(client *mongo.Client, ctx context.Context) error
- func (mu MongoUtils) FindCVE(product string, ctx context.Context, collection *mongo.Collection) (CVE, error)
- func (mu MongoUtils) GetAllCVEs(ctx context.Context, collection *mongo.Collection) ([]CVE, error)
- func (mu MongoUtils) GetMongoClient() (*mongo.Client, context.Context, error)
- func (mu MongoUtils) GetMongoCollection(client mongo.Client, database, collection string) *mongo.Collection
- func (mu MongoUtils) GetUniqueDependencies(ctx context.Context, collection *mongo.Collection) ([]CVE, error)
- func (mu MongoUtils) RemoveAllCVEs(product string, ctx context.Context, collection *mongo.Collection) error
- type MongoUtilsInterface
- type NVDNistResponse
- type NVDNistResponseCVE
- type NVDNistResponseCVEItem
- type NVDNistResponseCVEMetrics
- type NVDNistUtils
- type NVDNistUtilsInterface
- type Payload
- type SlackUtils
- type SlackUtilsInterface
- type Text
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CSVUtilsInterface ¶
type CVE ¶
type CVE struct { ID primitive.ObjectID `bson:"_id"` CreatedAt time.Time `bson:"created_at"` UpdatedAt time.Time `bson:"updated_at"` Vendor string `bson:"vendor"` Product string `bson:"product"` Severity string `bson:"severity"` CVEId string `bson:"cve_id"` Description string `bson:"description"` Score float64 }
type FakeCVEParam ¶
type MongoUtils ¶
func NewMongoUtils ¶
func NewMongoUtils(dbUri string, logger zerolog.Logger) MongoUtils
func (MongoUtils) CVEExists ¶
func (mu MongoUtils) CVEExists(cveId string, ctx context.Context, collection *mongo.Collection) (bool, error)
func (MongoUtils) CreateCVE ¶
func (mu MongoUtils) CreateCVE(cve *CVE, ctx context.Context, collection *mongo.Collection) error
func (MongoUtils) DisconnectMongoClient ¶
func (MongoUtils) FindCVE ¶
func (mu MongoUtils) FindCVE(product string, ctx context.Context, collection *mongo.Collection) (CVE, error)
func (MongoUtils) GetAllCVEs ¶
func (mu MongoUtils) GetAllCVEs(ctx context.Context, collection *mongo.Collection) ([]CVE, error)
func (MongoUtils) GetMongoClient ¶
func (MongoUtils) GetMongoCollection ¶
func (mu MongoUtils) GetMongoCollection(client mongo.Client, database, collection string) *mongo.Collection
func (MongoUtils) GetUniqueDependencies ¶
func (mu MongoUtils) GetUniqueDependencies(ctx context.Context, collection *mongo.Collection) ([]CVE, error)
func (MongoUtils) RemoveAllCVEs ¶
func (mu MongoUtils) RemoveAllCVEs(product string, ctx context.Context, collection *mongo.Collection) error
type MongoUtilsInterface ¶
type MongoUtilsInterface interface { GetMongoClient() (*mongo.Client, context.Context, error) DisconnectMongoClient(client *mongo.Client, ctx context.Context) error GetMongoCollection(client mongo.Client, database, collection string) *mongo.Collection CreateCVE(cve *CVE, ctx context.Context, collection *mongo.Collection) error GetUniqueDependencies(ctx context.Context, collection *mongo.Collection) ([]CVE, error) FindCVE(product string, ctx context.Context, collection *mongo.Collection) (CVE, error) RemoveAllCVEs(product string, ctx context.Context, collection *mongo.Collection) error CVEExists(cveId string, ctx context.Context, collection *mongo.Collection) (bool, error) GetAllCVEs(ctx context.Context, collection *mongo.Collection) ([]CVE, error) }
type NVDNistResponse ¶
type NVDNistResponse 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 []NVDNistResponseCVEItem `json:"vulnerabilities"` }
type NVDNistResponseCVE ¶
type NVDNistResponseCVE 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 []NVDNistResponseCVEMetrics `json:"cvssMetricV2,omitempty"` CvssMetricV3 []NVDNistResponseCVEMetrics `json:"cvssMetricV31,omitempty"` } `json:"metrics"` }
type NVDNistResponseCVEItem ¶
type NVDNistResponseCVEItem struct {
CVE NVDNistResponseCVE `json:"cve"`
}
func GenerateFakeCVE ¶
func GenerateFakeCVE(params []FakeCVEParam) []NVDNistResponseCVEItem
type NVDNistUtils ¶
func NewNVDNistUtils ¶
func NewNVDNistUtils(nvdNistApiKey string) NVDNistUtils
func (NVDNistUtils) GetCVEs ¶
func (nvd NVDNistUtils) GetCVEs(vendor, product string, logger zerolog.Logger) ([]NVDNistResponseCVEItem, error)
type NVDNistUtilsInterface ¶
type NVDNistUtilsInterface interface {
GetCVEs(vendor, product string, logger zerolog.Logger) ([]NVDNistResponseCVEItem, error)
}
type SlackUtils ¶
func NewSlackUtils ¶
func NewSlackUtils(webhookUrl string) SlackUtils
func (SlackUtils) SendNewCVENotification ¶
func (s SlackUtils) SendNewCVENotification(product, cveId, description, severity string, score float64) error
type SlackUtilsInterface ¶
Click to show internal directories.
Click to hide internal directories.