refactor: VulnDict (#1183)

This commit is contained in:
Kota Kanbe
2021-02-25 10:13:51 +09:00
committed by GitHub
parent 2cdeef4ffe
commit 518f4dc039
11 changed files with 261 additions and 479 deletions

View File

@@ -138,18 +138,18 @@ func (p *TuiCmd) Execute(_ context.Context, f *flag.FlagSet, _ ...interface{}) s
}
util.Log.Infof("Loaded: %s", dir)
util.Log.Info("Validating db config...")
if !c.Conf.ValidateOnReportDB() {
return subcommands.ExitUsageError
}
for _, cnf := range []config.VulnSrcConf{
for _, cnf := range []config.VulnDictInterface{
&c.Conf.CveDict,
&c.Conf.OvalDict,
&c.Conf.Gost,
&c.Conf.Exploit,
&c.Conf.Metasploit,
} {
if err := cnf.Validate(); err != nil {
util.Log.Errorf("Failed to validate VulnDict: %+v", err)
return subcommands.ExitFailure
}
if err := cnf.CheckHTTPHealth(); err != nil {
util.Log.Errorf("Run as server mode before reporting: %+v", err)
return subcommands.ExitFailure