diff options
| author | s <[email protected]> | 2025-11-13 22:25:02 -0500 |
|---|---|---|
| committer | s <[email protected]> | 2025-11-13 22:25:02 -0500 |
| commit | 07662d9403eb85b39e1ffcf91014bbf36efd1c5a (patch) | |
| tree | 1181435223899bae039a947c5fc4fdeec085f91b /cmd/breachforum.go | |
| parent | 239936e87183a10a33ce593709eb16c92a04af98 (diff) | |
| download | dborg-1.0.1.tar.gz dborg-1.0.1.zip | |
refactor: break down large osint.go file into separate command modules and add helper functionsv1.0.1
Diffstat (limited to 'cmd/breachforum.go')
| -rw-r--r-- | cmd/breachforum.go | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/cmd/breachforum.go b/cmd/breachforum.go new file mode 100644 index 0000000..366092c --- /dev/null +++ b/cmd/breachforum.go @@ -0,0 +1,39 @@ +package cmd + +import ( + "git.db.org.ai/dborg/internal/formatter" + "git.db.org.ai/dborg/internal/models" + "github.com/spf13/cobra" +) + +var breachforumCmd = &cobra.Command{ + Use: "breachforum [search]", + Short: "Search BreachForum data", + Long: `Search breachdetect index for BreachForum messages and detections`, + Args: cobra.ExactArgs(1), + RunE: runBreachForumSearch, +} + +func init() { + rootCmd.AddCommand(breachforumCmd) + breachforumCmd.Flags().IntP("max_hits", "m", 10, "Maximum number of hits to return") +} + +func runBreachForumSearch(cmd *cobra.Command, args []string) error { + c, err := newUnauthenticatedClient() + if err != nil { + return err + } + + params := &models.BreachForumSearchParams{ + Search: args[0], + } + params.MaxHits, _ = cmd.Flags().GetInt("max_hits") + + response, err := c.SearchBreachForum(params) + if err != nil { + return err + } + + return formatter.FormatBreachForumResults(response, IsJSONOutput()) +} |
