aboutsummaryrefslogtreecommitdiff
path: root/cmd/cisa.go
blob: 9a8788987cebf427de8d05c1a04da4026969a851 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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)
  },
}