Skip to content

Commit 2d3bae6

Browse files
sw33tLieclaude
andcommitted
add --platform flag to all db get subcommands
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 8925677 commit 2d3bae6

6 files changed

Lines changed: 10 additions & 7 deletions

File tree

cmd/get.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ var getCmd = &cobra.Command{
1616
Short: "Extract specific scope types from the database based on format",
1717
}
1818

19-
func getAndPrintTargets(targetType string, aggressive bool) error {
19+
func getAndPrintTargets(cmd *cobra.Command, targetType string, aggressive bool) error {
2020
dbURL, err := GetDBConnectionString()
2121
if err != nil {
2222
return err
@@ -28,7 +28,10 @@ func getAndPrintTargets(targetType string, aggressive bool) error {
2828
}
2929
defer db.Close()
3030

31-
entries, err := db.ListEntries(context.Background(), storage.ListOptions{})
31+
platform, _ := cmd.Flags().GetString("platform")
32+
entries, err := db.ListEntries(context.Background(), storage.ListOptions{
33+
Platform: platform,
34+
})
3235
if err != nil {
3336
return err
3437
}
@@ -60,4 +63,5 @@ func getAndPrintTargets(targetType string, aggressive bool) error {
6063

6164
func init() {
6265
dbCmd.AddCommand(getCmd)
66+
getCmd.PersistentFlags().String("platform", "all", "Limit results to a specific platform (h1, bc, it, ywh, immunefi). Default: all platforms.")
6367
}

cmd/get_cidrs.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ var getCIDRsCmd = &cobra.Command{
66
Use: "cidrs",
77
Short: "Get all targets that are CIDR ranges or IP ranges",
88
RunE: func(cmd *cobra.Command, args []string) error {
9-
return getAndPrintTargets("cidrs", false)
9+
return getAndPrintTargets(cmd, "cidrs", false)
1010
},
1111
}
1212

cmd/get_domains.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ var getDomainsCmd = &cobra.Command{
77
Short: "Get all targets that are domains (including wildcards)",
88
RunE: func(cmd *cobra.Command, args []string) error {
99
aggressive, _ := cmd.Flags().GetBool("aggressive")
10-
return getAndPrintTargets("domains", aggressive)
10+
return getAndPrintTargets(cmd, "domains", aggressive)
1111
},
1212
}
1313

cmd/get_ips.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ var getIPsCmd = &cobra.Command{
66
Use: "ips",
77
Short: "Get all targets that are IP addresses",
88
RunE: func(cmd *cobra.Command, args []string) error {
9-
return getAndPrintTargets("ips", false)
9+
return getAndPrintTargets(cmd, "ips", false)
1010
},
1111
}
1212

cmd/get_urls.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ var getURLsCmd = &cobra.Command{
66
Use: "urls",
77
Short: "Get all targets that are URLs",
88
RunE: func(cmd *cobra.Command, args []string) error {
9-
return getAndPrintTargets("urls", false)
9+
return getAndPrintTargets(cmd, "urls", false)
1010
},
1111
}
1212

cmd/get_wildcards.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ var getWildcardsCmd = &cobra.Command{
1919

2020
func init() {
2121
getWildcardsCmd.Flags().BoolP("aggressive", "a", false, "Extract root domains from all URL targets in addition to wildcards.")
22-
getWildcardsCmd.Flags().String("platform", "all", "Limit results to a specific platform (e.g. h1, bugcrowd, intigriti).")
2322
getWildcardsCmd.Flags().StringP("output", "o", "t", "Output flags. Supported: t (target), u (program URL). Example: -o tu")
2423
getWildcardsCmd.Flags().StringP("delimiter", "d", " ", "Delimiter to use between output fields.")
2524
getCmd.AddCommand(getWildcardsCmd)

0 commit comments

Comments
 (0)