diff options
| author | s <[email protected]> | 2025-11-09 14:26:42 -0500 |
|---|---|---|
| committer | s <[email protected]> | 2025-11-09 14:26:42 -0500 |
| commit | 65acee9a9b500c17b9426f80997401758ec326b1 (patch) | |
| tree | 358adc19e4099077d09f7d0001a3269a07a63da4 | |
| parent | f1070f0a2be928d188c418b59fcbc8e82d1a9367 (diff) | |
| download | dborg-65acee9a9b500c17b9426f80997401758ec326b1.tar.gz dborg-65acee9a9b500c17b9426f80997401758ec326b1.zip | |
feat: add osint geo search command for address information lookupv0.6.0
| -rw-r--r-- | cmd/osint.go | 40 | ||||
| -rw-r--r-- | internal/client/osint.go | 22 | ||||
| -rw-r--r-- | internal/models/osint.go | 9 |
3 files changed, 71 insertions, 0 deletions
diff --git a/cmd/osint.go b/cmd/osint.go index 6bb66c5..eb1ec50 100644 --- a/cmd/osint.go +++ b/cmd/osint.go @@ -70,6 +70,13 @@ var osintShortlinksCmd = &cobra.Command{ RunE: runOsintShortlinksSearch, } +var osintGeoCmd = &cobra.Command{ + Use: "geo", + Short: "Search for address information", + Long: `Returns address information including residents, property details, and demographics (costs 1 credit)`, + RunE: runOsintGeoSearch, +} + func init() { rootCmd.AddCommand(osintCmd) osintCmd.AddCommand(osintUsernameCmd) @@ -79,6 +86,7 @@ func init() { osintCmd.AddCommand(osintBucketsCmd) osintCmd.AddCommand(osintBucketFilesCmd) osintCmd.AddCommand(osintShortlinksCmd) + osintCmd.AddCommand(osintGeoCmd) osintUsernameCmd.Flags().StringSliceP("sites", "s", []string{}, "Specific sites to check (comma-separated)") osintUsernameCmd.Flags().BoolP("fuzzy", "f", false, "Enable fuzzy validation mode") @@ -112,6 +120,15 @@ func init() { osintShortlinksCmd.Flags().BoolP("regexp", "r", false, "Treat keywords as regular expression") osintShortlinksCmd.Flags().IntP("limit", "l", 100, "Number of results to return") osintShortlinksCmd.Flags().IntP("start", "t", 0, "Starting offset for pagination") + + osintGeoCmd.Flags().StringP("street", "s", "", "Street address") + osintGeoCmd.Flags().StringP("city", "c", "", "City") + osintGeoCmd.Flags().StringP("state", "t", "", "State (2-letter code)") + osintGeoCmd.Flags().StringP("zip", "z", "", "ZIP code") + osintGeoCmd.MarkFlagRequired("street") + osintGeoCmd.MarkFlagRequired("city") + osintGeoCmd.MarkFlagRequired("state") + osintGeoCmd.MarkFlagRequired("zip") } func runOsintUsernameCheck(cmd *cobra.Command, args []string) error { @@ -282,3 +299,26 @@ func runOsintShortlinksSearch(cmd *cobra.Command, args []string) error { return utils.PrintJSON(response) } + +func runOsintGeoSearch(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.GeoSearchParams{} + params.Street, _ = cmd.Flags().GetString("street") + params.City, _ = cmd.Flags().GetString("city") + params.State, _ = cmd.Flags().GetString("state") + params.Zip, _ = cmd.Flags().GetString("zip") + + response, err := c.SearchGeo(params) + if err != nil { + return err + } + + return utils.PrintJSON(response) +} diff --git a/internal/client/osint.go b/internal/client/osint.go index d7e795c..2ee10c6 100644 --- a/internal/client/osint.go +++ b/internal/client/osint.go @@ -184,3 +184,25 @@ func (c *Client) SearchShortlinks(params *models.ShortlinksSearchParams) (*model return &response, nil } + +func (c *Client) SearchGeo(params *models.GeoSearchParams) (*models.GeoSearchResponse, error) { + path := "/osint/geo" + + queryParams := url.Values{} + queryParams.Add("street", params.Street) + queryParams.Add("city", params.City) + queryParams.Add("state", params.State) + queryParams.Add("zip", params.Zip) + + data, err := c.Get(path, queryParams) + if err != nil { + return nil, err + } + + var response models.GeoSearchResponse + if err := json.Unmarshal(data, &response); err != nil { + return nil, fmt.Errorf("failed to parse geo search response: %w", err) + } + + return &response, nil +} diff --git a/internal/models/osint.go b/internal/models/osint.go index 950225d..d025836 100644 --- a/internal/models/osint.go +++ b/internal/models/osint.go @@ -90,3 +90,12 @@ type ShortlinksSearchResponse struct { Credits CreditsInfo `json:"credits"` Results interface{} `json:"results"` } + +type GeoSearchParams struct { + Street string + City string + State string + Zip string +} + +type GeoSearchResponse map[string]interface{} |
