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/bssid.go | |
| parent | 239936e87183a10a33ce593709eb16c92a04af98 (diff) | |
| download | dborg-07662d9403eb85b39e1ffcf91014bbf36efd1c5a.tar.gz dborg-07662d9403eb85b39e1ffcf91014bbf36efd1c5a.zip | |
refactor: break down large osint.go file into separate command modules and add helper functionsv1.0.1
Diffstat (limited to 'cmd/bssid.go')
| -rw-r--r-- | cmd/bssid.go | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/cmd/bssid.go b/cmd/bssid.go new file mode 100644 index 0000000..7a9e4c0 --- /dev/null +++ b/cmd/bssid.go @@ -0,0 +1,43 @@ +package cmd + +import ( + "git.db.org.ai/dborg/internal/formatter" + "git.db.org.ai/dborg/internal/models" + "github.com/spf13/cobra" +) + +var bssidCmd = &cobra.Command{ + Use: "bssid [bssid]", + Short: "Lookup WiFi access point location by BSSID", + Long: `Lookup geographic location of a WiFi access point by its BSSID (MAC address) using Apple's location services`, + Args: cobra.ExactArgs(1), + RunE: runBSSIDLookup, +} + +func init() { + rootCmd.AddCommand(bssidCmd) + bssidCmd.Flags().BoolP("all", "a", false, "Show all related results instead of exact match only") + bssidCmd.Flags().BoolP("google", "g", false, "Include Google Maps URL for the location") + bssidCmd.Flags().BoolP("osm", "o", false, "Include OpenStreetMap URL for the location") +} + +func runBSSIDLookup(cmd *cobra.Command, args []string) error { + c, err := newUnauthenticatedClient() + if err != nil { + return err + } + + params := &models.BSSIDParams{ + BSSID: args[0], + } + params.All, _ = cmd.Flags().GetBool("all") + params.Google, _ = cmd.Flags().GetBool("google") + params.OSM, _ = cmd.Flags().GetBool("osm") + + response, err := c.LookupBSSID(params) + if err != nil { + return err + } + + return formatter.FormatBSSIDResults(*response, IsJSONOutput()) +} |
