mirror of
https://github.com/davidallendj/magellan.git
synced 2025-12-20 03:27:03 -07:00
ADd secure, remove username and password
Signed-off-by: Ben McDonald <ben.mcdonald@hpe.com>
This commit is contained in:
parent
4cfd48da63
commit
488ad241f6
2 changed files with 10 additions and 12 deletions
17
pkg/scan.go
17
pkg/scan.go
|
|
@ -1,6 +1,7 @@
|
|||
package magellan
|
||||
|
||||
import (
|
||||
"crypto/tls"
|
||||
"fmt"
|
||||
"math"
|
||||
"net"
|
||||
|
|
@ -34,8 +35,7 @@ type ScanParams struct {
|
|||
DisableProbing bool
|
||||
Verbose bool
|
||||
Debug bool
|
||||
Username string
|
||||
Password string
|
||||
Insecure bool
|
||||
}
|
||||
|
||||
// ScanForAssets() performs a net scan on a network to find available services
|
||||
|
|
@ -71,8 +71,12 @@ func ScanForAssets(params *ScanParams) []RemoteAsset {
|
|||
{Type: "JAWS", Path: "/jaws/monitor/outlets"},
|
||||
}
|
||||
|
||||
transport := &http.Transport{
|
||||
TLSClientConfig: &tls.Config{InsecureSkipVerify: params.Insecure},
|
||||
}
|
||||
probeClient := &http.Client{
|
||||
Timeout: time.Duration(params.Timeout) * time.Second,
|
||||
Timeout: time.Duration(params.Timeout) * time.Second,
|
||||
Transport: transport,
|
||||
}
|
||||
|
||||
var wg sync.WaitGroup
|
||||
|
|
@ -92,8 +96,6 @@ func ScanForAssets(params *ScanParams) []RemoteAsset {
|
|||
if params.Verbose {
|
||||
log.Debug().Err(err).Msgf("failed to connect to host")
|
||||
}
|
||||
// NOTE: This was wg.Done() and return in the original, but that stops the whole worker.
|
||||
// Continuing allows the worker to process other hosts in its queue.
|
||||
continue
|
||||
}
|
||||
if !params.DisableProbing {
|
||||
|
|
@ -106,11 +108,6 @@ func ScanForAssets(params *ScanParams) []RemoteAsset {
|
|||
continue
|
||||
}
|
||||
|
||||
// Add authentication for JAWS endpoints if credentials are provided
|
||||
if probe.Type == "JAWS" && params.Username != "" && params.Password != "" {
|
||||
req.SetBasicAuth(params.Username, params.Password)
|
||||
}
|
||||
|
||||
res, err := probeClient.Do(req)
|
||||
if err == nil && res != nil && res.StatusCode == http.StatusOK {
|
||||
res.Body.Close()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue