mirror of
https://github.com/davidallendj/magellan.git
synced 2025-12-20 11:37:01 -07:00
Add include flag
Signed-off-by: Ben McDonald <ben.mcdonald@hpe.com>
This commit is contained in:
parent
c413dd5649
commit
96931cd8a3
2 changed files with 12 additions and 3 deletions
|
|
@ -26,6 +26,7 @@ var (
|
||||||
disableProbing bool
|
disableProbing bool
|
||||||
disableCache bool
|
disableCache bool
|
||||||
format string
|
format string
|
||||||
|
include []string
|
||||||
)
|
)
|
||||||
|
|
||||||
// The `scan` command is usually the first step to using the CLI tool.
|
// The `scan` command is usually the first step to using the CLI tool.
|
||||||
|
|
@ -141,6 +142,7 @@ var ScanCmd = &cobra.Command{
|
||||||
Verbose: verbose,
|
Verbose: verbose,
|
||||||
Debug: debug,
|
Debug: debug,
|
||||||
Insecure: insecure,
|
Insecure: insecure,
|
||||||
|
Include: include,
|
||||||
})
|
})
|
||||||
|
|
||||||
switch format {
|
switch format {
|
||||||
|
|
@ -215,6 +217,7 @@ func init() {
|
||||||
ScanCmd.Flags().BoolVar(&insecure, "insecure", false, "Skip TLS certificate verification during probe")
|
ScanCmd.Flags().BoolVar(&insecure, "insecure", false, "Skip TLS certificate verification during probe")
|
||||||
ScanCmd.Flags().StringVarP(&format, "format", "F", "db", "Output format (db, json, yaml)")
|
ScanCmd.Flags().StringVarP(&format, "format", "F", "db", "Output format (db, json, yaml)")
|
||||||
ScanCmd.Flags().StringVarP(&outputPath, "output", "o", "", "Output file path (for json/yaml formats)")
|
ScanCmd.Flags().StringVarP(&outputPath, "output", "o", "", "Output file path (for json/yaml formats)")
|
||||||
|
ScanCmd.Flags().StringSliceVar(&include, "include", []string{"bmcs"}, "Asset types to scan for (bmcs, pdus)")
|
||||||
|
|
||||||
checkBindFlagError(viper.BindPFlag("scan.ports", ScanCmd.Flags().Lookup("port")))
|
checkBindFlagError(viper.BindPFlag("scan.ports", ScanCmd.Flags().Lookup("port")))
|
||||||
checkBindFlagError(viper.BindPFlag("scan.scheme", ScanCmd.Flags().Lookup("scheme")))
|
checkBindFlagError(viper.BindPFlag("scan.scheme", ScanCmd.Flags().Lookup("scheme")))
|
||||||
|
|
|
||||||
12
pkg/scan.go
12
pkg/scan.go
|
|
@ -36,6 +36,7 @@ type ScanParams struct {
|
||||||
Verbose bool
|
Verbose bool
|
||||||
Debug bool
|
Debug bool
|
||||||
Insecure bool
|
Insecure bool
|
||||||
|
Include []string
|
||||||
}
|
}
|
||||||
|
|
||||||
// ScanForAssets() performs a net scan on a network to find available services
|
// ScanForAssets() performs a net scan on a network to find available services
|
||||||
|
|
@ -66,9 +67,14 @@ func ScanForAssets(params *ScanParams) []RemoteAsset {
|
||||||
|
|
||||||
probesToRun := []struct {
|
probesToRun := []struct {
|
||||||
Type, Path string
|
Type, Path string
|
||||||
}{
|
}{}
|
||||||
{Type: "Redfish", Path: "/redfish/v1/"},
|
for _, item := range params.Include {
|
||||||
{Type: "JAWS", Path: "/jaws/monitor/outlets"},
|
if item == "bmcs" {
|
||||||
|
probesToRun = append(probesToRun, struct{ Type, Path string }{Type: "Redfish", Path: "/redfish/v1/"})
|
||||||
|
}
|
||||||
|
if item == "pdus" {
|
||||||
|
probesToRun = append(probesToRun, struct{ Type, Path string }{Type: "JAWS", Path: "/jaws/monitor/outlets"})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
transport := &http.Transport{
|
transport := &http.Transport{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue