1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
|
package cmd
import (
"encoding/json"
"fmt"
"git.db.org.ai/dborg/internal/client"
"git.db.org.ai/dborg/internal/config"
"git.db.org.ai/dborg/internal/models"
"git.db.org.ai/dborg/internal/utils"
"github.com/spf13/cobra"
)
var osintCmd = &cobra.Command{
Use: "osint",
Short: "OSINT tools and searches",
Long: `Open Source Intelligence tools for username, email, and other searches`,
}
var osintUsernameCmd = &cobra.Command{
Use: "username [username]",
Short: "Check username availability across websites",
Long: `Check username availability across hundreds of websites using WhatsMyName dataset`,
Args: cobra.ExactArgs(1),
RunE: runOsintUsernameCheck,
}
var osintBSSIDCmd = &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: 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,
}
var osintFilesCmd = &cobra.Command{
Use: "files [url]",
Short: "Search open directory files",
Long: `Search for files in open directories using various filters (free OSINT endpoint)`,
Args: cobra.ExactArgs(1),
RunE: runOsintFilesSearch,
}
func init() {
rootCmd.AddCommand(osintCmd)
osintCmd.AddCommand(osintUsernameCmd)
osintCmd.AddCommand(osintBSSIDCmd)
osintCmd.AddCommand(osintBreachForumCmd)
osintCmd.AddCommand(osintFilesCmd)
osintUsernameCmd.Flags().StringSliceP("sites", "s", []string{}, "Specific sites to check (comma-separated)")
osintUsernameCmd.Flags().BoolP("fuzzy", "f", false, "Enable fuzzy validation mode")
osintUsernameCmd.Flags().IntP("max_tasks", "m", 50, "Maximum concurrent tasks")
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")
osintFilesCmd.Flags().StringP("filename", "n", "", "Search term to match in filenames")
osintFilesCmd.Flags().StringP("extension", "e", "", "Filter by file extension(s) - comma-separated (e.g., pdf,doc,txt)")
osintFilesCmd.Flags().StringP("exclude", "x", "html,HTML", "Exclude file extension(s) - comma-separated")
osintFilesCmd.Flags().IntP("size", "s", 10, "Number of results to return (max 40)")
osintFilesCmd.Flags().IntP("from", "f", 0, "Starting offset for pagination")
}
func runOsintUsernameCheck(cmd *cobra.Command, args []string) error {
cfg := config.New()
c, err := client.NewUnauthenticated(cfg)
if err != nil {
return err
}
params := &models.USRSXParams{
Username: args[0],
}
params.Sites, _ = cmd.Flags().GetStringSlice("sites")
params.Fuzzy, _ = cmd.Flags().GetBool("fuzzy")
params.MaxTasks, _ = cmd.Flags().GetInt("max_tasks")
err = c.CheckUsernameStream(params, func(result json.RawMessage) error {
fmt.Println(string(result))
return nil
})
if err != nil {
return err
}
return nil
}
func runOsintBSSIDLookup(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.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 utils.PrintJSON(response)
}
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
}
return utils.PrintJSON(response)
}
func runOsintFilesSearch(cmd *cobra.Command, args []string) error {
cfg := config.New()
c, err := client.NewUnauthenticated(cfg)
if err != nil {
return err
}
params := &models.OpenDirectorySearchParams{
URL: args[0],
}
params.Filename, _ = cmd.Flags().GetString("filename")
params.Extension, _ = cmd.Flags().GetString("extension")
params.Exclude, _ = cmd.Flags().GetString("exclude")
params.Size, _ = cmd.Flags().GetInt("size")
params.From, _ = cmd.Flags().GetInt("from")
response, err := c.SearchOpenDirectoryFiles(params)
if err != nil {
return err
}
return utils.PrintJSON(response)
}
|