Skip to content

Commit e51f1fb

Browse files
committed
Add include flag
1 parent 4e8a4e0 commit e51f1fb

2 files changed

Lines changed: 12 additions & 3 deletions

File tree

cmd/scan.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ var (
2626
disableProbing bool
2727
disableCache bool
2828
format string
29+
include []string
2930
)
3031

3132
// The `scan` command is usually the first step to using the CLI tool.
@@ -141,6 +142,7 @@ var ScanCmd = &cobra.Command{
141142
Verbose: verbose,
142143
Debug: debug,
143144
Insecure: insecure,
145+
Include: include,
144146
})
145147

146148
switch format {
@@ -215,6 +217,7 @@ func init() {
215217
ScanCmd.Flags().BoolVar(&insecure, "insecure", false, "Skip TLS certificate verification during probe")
216218
ScanCmd.Flags().StringVarP(&format, "format", "F", "db", "Output format (db, json, yaml)")
217219
ScanCmd.Flags().StringVarP(&outputPath, "output", "o", "", "Output file path (for json/yaml formats)")
220+
ScanCmd.Flags().StringSliceVar(&include, "include", []string{"bmcs"}, "Asset types to scan for (bmcs, pdus)")
218221

219222
checkBindFlagError(viper.BindPFlag("scan.ports", ScanCmd.Flags().Lookup("port")))
220223
checkBindFlagError(viper.BindPFlag("scan.scheme", ScanCmd.Flags().Lookup("scheme")))

pkg/scan.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ type ScanParams struct {
3636
Verbose bool
3737
Debug bool
3838
Insecure bool
39+
Include []string
3940
}
4041

4142
// ScanForAssets() performs a net scan on a network to find available services
@@ -66,9 +67,14 @@ func ScanForAssets(params *ScanParams) []RemoteAsset {
6667

6768
probesToRun := []struct {
6869
Type, Path string
69-
}{
70-
{Type: "Redfish", Path: "/redfish/v1/"},
71-
{Type: "JAWS", Path: "/jaws/monitor/outlets"},
70+
}{}
71+
for _, item := range params.Include {
72+
if item == "bmcs" {
73+
probesToRun = append(probesToRun, struct{ Type, Path string }{Type: "Redfish", Path: "/redfish/v1/"})
74+
}
75+
if item == "pdus" {
76+
probesToRun = append(probesToRun, struct{ Type, Path string }{Type: "JAWS", Path: "/jaws/monitor/outlets"})
77+
}
7278
}
7379

7480
transport := &http.Transport{

0 commit comments

Comments
 (0)