Fix -ignore-unscored-cves
This commit is contained in:
		@@ -52,7 +52,7 @@ func (w EMailWriter) Write(rs ...models.ScanResult) (err error) {
 | 
			
		||||
				subject = fmt.Sprintf("%s%s %s",
 | 
			
		||||
					conf.EMail.SubjectPrefix,
 | 
			
		||||
					r.ServerInfo(),
 | 
			
		||||
					r.CveSummary(config.Conf.IgnoreUnscoredCves))
 | 
			
		||||
					r.CveSummary())
 | 
			
		||||
			}
 | 
			
		||||
			message = formatFullPlainText(r)
 | 
			
		||||
			if err := sender.Send(subject, message); err != nil {
 | 
			
		||||
@@ -74,7 +74,7 @@ One Line Summary
 | 
			
		||||
 | 
			
		||||
		subject := fmt.Sprintf("%s %s",
 | 
			
		||||
			conf.EMail.SubjectPrefix,
 | 
			
		||||
			totalResult.CveSummary(config.Conf.IgnoreUnscoredCves),
 | 
			
		||||
			totalResult.CveSummary(),
 | 
			
		||||
		)
 | 
			
		||||
		return sender.Send(subject, message)
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
@@ -66,6 +66,7 @@ func FillCveInfos(rs []models.ScanResult, dir string) ([]models.ScanResult, erro
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	//TODO remove debug code
 | 
			
		||||
	for _, r := range filled {
 | 
			
		||||
		pp.Printf("filled: %d\n", len(r.ScannedCves))
 | 
			
		||||
	}
 | 
			
		||||
@@ -75,11 +76,11 @@ func FillCveInfos(rs []models.ScanResult, dir string) ([]models.ScanResult, erro
 | 
			
		||||
		filtered = append(filtered, r.FilterByCvssOver(c.Conf.CvssScoreOver))
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	//TODO remove debug code
 | 
			
		||||
	for _, r := range filtered {
 | 
			
		||||
		pp.Printf("filtered: %d\n", len(r.ScannedCves))
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// TODO Sort
 | 
			
		||||
	return filtered, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -159,7 +159,7 @@ func msgText(r models.ScanResult) string {
 | 
			
		||||
	return fmt.Sprintf("%s\n%s\n>%s",
 | 
			
		||||
		notifyUsers,
 | 
			
		||||
		serverInfo,
 | 
			
		||||
		r.CveSummary(config.Conf.IgnoreUnscoredCves))
 | 
			
		||||
		r.CveSummary())
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func toSlackAttachments(scanResult models.ScanResult) (attaches []*attachment) {
 | 
			
		||||
 
 | 
			
		||||
@@ -72,7 +72,7 @@ func formatOneLineSummary(rs ...models.ScanResult) string {
 | 
			
		||||
		if len(r.Errors) == 0 {
 | 
			
		||||
			cols = []interface{}{
 | 
			
		||||
				r.FormatServerName(),
 | 
			
		||||
				r.CveSummary(config.Conf.IgnoreUnscoredCves),
 | 
			
		||||
				r.CveSummary(),
 | 
			
		||||
				r.Packages.FormatUpdatablePacksSummary(),
 | 
			
		||||
			}
 | 
			
		||||
		} else {
 | 
			
		||||
@@ -96,7 +96,7 @@ func formatShortPlainText(r models.ScanResult) string {
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	vulns := r.ScannedCves
 | 
			
		||||
	if !config.Conf.IgnoreUnscoredCves {
 | 
			
		||||
	if config.Conf.IgnoreUnscoredCves {
 | 
			
		||||
		vulns = vulns.FindScoredVulns()
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -163,7 +163,7 @@ func formatFullPlainText(r models.ScanResult) string {
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	vulns := r.ScannedCves
 | 
			
		||||
	if !config.Conf.IgnoreUnscoredCves {
 | 
			
		||||
	if config.Conf.IgnoreUnscoredCves {
 | 
			
		||||
		vulns = vulns.FindScoredVulns()
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user