summaryrefslogtreecommitdiffstats
path: root/cmd/osint.go
diff options
context:
space:
mode:
authors <[email protected]>2025-11-06 22:15:35 -0500
committers <[email protected]>2025-11-06 22:15:35 -0500
commit5f0e15788032951f215bda1df3b5ce1e55125f59 (patch)
tree79745064ecd7a38324520c8e9330c6f125a5fc2f /cmd/osint.go
parenteab6a1b6899413154f855abbd200ac775b22be75 (diff)
downloaddborg-5f0e15788032951f215bda1df3b5ce1e55125f59.tar.gz
dborg-5f0e15788032951f215bda1df3b5ce1e55125f59.zip
feat: add breachforum search command with api client integration
Diffstat (limited to 'cmd/osint.go')
-rw-r--r--cmd/osint.go39
1 files changed, 39 insertions, 0 deletions
diff --git a/cmd/osint.go b/cmd/osint.go
index 13c3c6e..49b94ab 100644
--- a/cmd/osint.go
+++ b/cmd/osint.go
@@ -32,10 +32,19 @@ var osintBSSIDCmd = &cobra.Command{
RunE: runOsintBSSIDLookup,
}
+var osintBreachForumCmd = &cobra.Command{
+ Use: "breachforum [search]",
+ Short: "Search BreachForum data",
+ Long: `Search breachdetect index for BreachForum messages and detections`,
+ Args: cobra.ExactArgs(1),
+ RunE: runOsintBreachForumSearch,
+}
+
func init() {
rootCmd.AddCommand(osintCmd)
osintCmd.AddCommand(osintUsernameCmd)
osintCmd.AddCommand(osintBSSIDCmd)
+ osintCmd.AddCommand(osintBreachForumCmd)
osintUsernameCmd.Flags().StringSliceP("sites", "s", []string{}, "Specific sites to check (comma-separated)")
osintUsernameCmd.Flags().BoolP("fuzzy", "f", false, "Enable fuzzy validation mode")
@@ -44,6 +53,8 @@ func init() {
osintBSSIDCmd.Flags().BoolP("all", "a", false, "Show all related results instead of exact match only")
osintBSSIDCmd.Flags().BoolP("google", "g", false, "Include Google Maps URL for the location")
osintBSSIDCmd.Flags().BoolP("osm", "o", false, "Include OpenStreetMap URL for the location")
+
+ osintBreachForumCmd.Flags().IntP("max_hits", "m", 10, "Maximum number of hits to return")
}
func runOsintUsernameCheck(cmd *cobra.Command, args []string) error {
@@ -103,3 +114,31 @@ func runOsintBSSIDLookup(cmd *cobra.Command, args []string) error {
fmt.Println(string(output))
return nil
}
+
+func runOsintBreachForumSearch(cmd *cobra.Command, args []string) error {
+ apiKey, _ := cmd.Flags().GetString("api-key")
+ cfg := config.New().WithAPIKey(apiKey)
+
+ c, err := client.New(cfg)
+ 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
+ }
+
+ output, err := json.MarshalIndent(response, "", " ")
+ if err != nil {
+ return fmt.Errorf("failed to format response: %w", err)
+ }
+
+ fmt.Println(string(output))
+ return nil
+}