Add -report-text option, Fix small bug of report in japanese

This commit is contained in:
kota kanbe
2016-05-30 12:15:42 +09:00
parent 9ae42d647c
commit 86f9e5ce96
9 changed files with 123 additions and 40 deletions

View File

@@ -54,6 +54,7 @@ type ScanCmd struct {
reportSlack bool
reportMail bool
reportJSON bool
reportText bool
askSudoPassword bool
askKeyPassword bool
@@ -81,6 +82,7 @@ func (*ScanCmd) Usage() string {
[-report-json]
[-report-mail]
[-report-slack]
[-report-text]
[-http-proxy=http://192.168.0.1:8080]
[-ask-sudo-password]
[-ask-key-password]
@@ -136,6 +138,11 @@ func (p *ScanCmd) SetFlags(f *flag.FlagSet) {
false,
fmt.Sprintf("Write report to JSON files (%s/results/current)", wd),
)
f.BoolVar(&p.reportText,
"report-text",
false,
fmt.Sprintf("Write report to text files (%s/results/current)", wd),
)
f.BoolVar(
&p.askKeyPassword,
@@ -221,7 +228,7 @@ func (p *ScanCmd) Execute(_ context.Context, f *flag.FlagSet, _ ...interface{})
// report
reports := []report.ResultWriter{
report.TextWriter{},
report.StdoutWriter{},
report.LogrusWriter{},
}
if p.reportSlack {
@@ -233,6 +240,9 @@ func (p *ScanCmd) Execute(_ context.Context, f *flag.FlagSet, _ ...interface{})
if p.reportJSON {
reports = append(reports, report.JSONWriter{})
}
if p.reportText {
reports = append(reports, report.TextFileWriter{})
}
c.Conf.DBPath = p.dbpath
c.Conf.CveDictionaryURL = p.cveDictionaryURL