diff options
| author | Paul Duncan <pabs@pablotron.org> | 2022-03-18 00:37:17 -0400 | 
|---|---|---|
| committer | Paul Duncan <pabs@pablotron.org> | 2022-03-18 00:37:17 -0400 | 
| commit | cd6080a5ce7a1323defe9ca331fe0ba689366e18 (patch) | |
| tree | ac0f5356a2cfd43381d6ad52e44b3a3526938d30 | |
| parent | 8e0000829cdf78c88cce69ce93f19eafe796fda4 (diff) | |
| download | cvez-cd6080a5ce7a1323defe9ca331fe0ba689366e18.tar.xz cvez-cd6080a5ce7a1323defe9ca331fe0ba689366e18.zip | |
cmd: add cmd/cisa.go, refactor commands
| -rw-r--r-- | cmd/cisa.go | 29 | 
1 files changed, 29 insertions, 0 deletions
| diff --git a/cmd/cisa.go b/cmd/cisa.go new file mode 100644 index 0000000..9a87889 --- /dev/null +++ b/cmd/cisa.go @@ -0,0 +1,29 @@ +package cmd + +import ( +  "context" +  "github.com/spf13/cobra" +  "github.com/rs/zerolog/log" +  "os" +) + +var cisaSearchCmd = &cobra.Command{ +  Use:   "cisa", +  Args:  cobra.MinimumNArgs(1), +  Short: "Search CISA known exploited vulnerabilities catalog.", +  Long: `Search CISA known exploited vulnerabilities catalog.`, + +  Run: func(cmd *cobra.Command, args []string) { +    ctx := context.Background() + +    // search for CVEs +    rows, err := getDb().CisaSearch(ctx, getSearchQuery(args)) +    if err != nil { +      log.Error().Err(err).Msg("CveSearch") +      os.Exit(-1) +    } + +    // write rows to stdout +    jsonEncode(rows) +  }, +} | 
