* feat(cti): add Cyber Threat Intelligence info * chore: replace io/ioutil as it is deprecated * chore: remove --format-csv in stdout writer * chore(deps): go get go-cti@v0.0.1 * feat(cti): update cti dict(support MITRE ATT&CK v11.1) * chore(deps): go get go-cti@master
48 lines
930 B
Go
48 lines
930 B
Go
package reporter
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/future-architect/vuls/models"
|
|
)
|
|
|
|
// StdoutWriter write to stdout
|
|
type StdoutWriter struct {
|
|
FormatFullText bool
|
|
FormatOneLineText bool
|
|
FormatList bool
|
|
}
|
|
|
|
//TODO support -format-jSON
|
|
|
|
// WriteScanSummary prints Scan summary at the end of scan
|
|
func (w StdoutWriter) WriteScanSummary(rs ...models.ScanResult) {
|
|
fmt.Printf("\n\n")
|
|
fmt.Println("Scan Summary")
|
|
fmt.Println("================")
|
|
fmt.Printf("%s\n", formatScanSummary(rs...))
|
|
}
|
|
|
|
func (w StdoutWriter) Write(rs ...models.ScanResult) error {
|
|
if w.FormatOneLineText {
|
|
fmt.Print("\n\n")
|
|
fmt.Println("One Line Summary")
|
|
fmt.Println("================")
|
|
fmt.Println(formatOneLineSummary(rs...))
|
|
fmt.Print("\n")
|
|
}
|
|
|
|
if w.FormatList {
|
|
for _, r := range rs {
|
|
fmt.Println(formatList(r))
|
|
}
|
|
}
|
|
|
|
if w.FormatFullText {
|
|
for _, r := range rs {
|
|
fmt.Println(formatFullPlainText(r))
|
|
}
|
|
}
|
|
return nil
|
|
}
|