From 7c0f4b692c3b712bf4a0da3bbac008ff75c405de Mon Sep 17 00:00:00 2001 From: s Date: Mon, 10 Nov 2025 08:31:32 -0500 Subject: feat: add x replies/search commands and improve api key validation --- cmd/osint.go | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'cmd/osint.go') diff --git a/cmd/osint.go b/cmd/osint.go index eb1ec50..33b5416 100644 --- a/cmd/osint.go +++ b/cmd/osint.go @@ -159,10 +159,9 @@ func runOsintUsernameCheck(cmd *cobra.Command, args []string) error { } func runOsintBSSIDLookup(cmd *cobra.Command, args []string) error { - apiKey, _ := cmd.Flags().GetString("api-key") - cfg := config.New().WithAPIKey(apiKey) + cfg := config.New() - c, err := client.New(cfg) + c, err := client.NewUnauthenticated(cfg) if err != nil { return err } @@ -183,10 +182,9 @@ func runOsintBSSIDLookup(cmd *cobra.Command, args []string) error { } func runOsintBreachForumSearch(cmd *cobra.Command, args []string) error { - apiKey, _ := cmd.Flags().GetString("api-key") - cfg := config.New().WithAPIKey(apiKey) + cfg := config.New() - c, err := client.New(cfg) + c, err := client.NewUnauthenticated(cfg) if err != nil { return err } @@ -231,6 +229,9 @@ func runOsintFilesSearch(cmd *cobra.Command, args []string) error { func runOsintBucketsSearch(cmd *cobra.Command, args []string) error { apiKey, _ := cmd.Flags().GetString("api-key") + if apiKey == "" { + return fmt.Errorf("API key required for buckets endpoint") + } cfg := config.New().WithAPIKey(apiKey) c, err := client.New(cfg) @@ -252,6 +253,9 @@ func runOsintBucketsSearch(cmd *cobra.Command, args []string) error { func runOsintBucketFilesSearch(cmd *cobra.Command, args []string) error { apiKey, _ := cmd.Flags().GetString("api-key") + if apiKey == "" { + return fmt.Errorf("API key required for bucket files endpoint") + } cfg := config.New().WithAPIKey(apiKey) c, err := client.New(cfg) @@ -276,6 +280,9 @@ func runOsintBucketFilesSearch(cmd *cobra.Command, args []string) error { func runOsintShortlinksSearch(cmd *cobra.Command, args []string) error { apiKey, _ := cmd.Flags().GetString("api-key") + if apiKey == "" { + return fmt.Errorf("API key required for shortlinks endpoint") + } cfg := config.New().WithAPIKey(apiKey) c, err := client.New(cfg) @@ -302,6 +309,9 @@ func runOsintShortlinksSearch(cmd *cobra.Command, args []string) error { func runOsintGeoSearch(cmd *cobra.Command, args []string) error { apiKey, _ := cmd.Flags().GetString("api-key") + if apiKey == "" { + return fmt.Errorf("API key required for geo endpoint (costs 1 credit)") + } cfg := config.New().WithAPIKey(apiKey) c, err := client.New(cfg) -- cgit v1.2.3