mirror of
https://github.com/davidallendj/magellan.git
synced 2025-12-20 03:27:03 -07:00
Fixed '--subnet' flag not adding hosts to scan
This commit is contained in:
parent
0c30d4dc3a
commit
dd829cd10e
4 changed files with 43 additions and 26 deletions
17
cmd/scan.go
17
cmd/scan.go
|
|
@ -78,26 +78,17 @@ var scanCmd = &cobra.Command{
|
|||
}
|
||||
|
||||
// generate a slice of all hosts to scan from subnets
|
||||
targetHosts = append(targetHosts, magellan.GenerateHostsWithSubnet(subnet, &subnetMask, ports, scheme)...)
|
||||
}
|
||||
|
||||
// convert everything into full addresses for scanning
|
||||
for _, host := range hosts {
|
||||
var targets []string
|
||||
for _, port := range ports {
|
||||
_ = port
|
||||
targets = append(targets, host)
|
||||
}
|
||||
targetHosts = append(targetHosts, targets)
|
||||
subnetHosts := magellan.GenerateHostsWithSubnet(subnet, &subnetMask, ports, scheme)
|
||||
targetHosts = append(targetHosts, subnetHosts...)
|
||||
}
|
||||
|
||||
// if there are no target hosts, then there's nothing to do
|
||||
if len(targetHosts) <= 0 {
|
||||
log.Warn().Msg("nothing to do (no target hosts)")
|
||||
log.Warn().Msg("nothing to do (no valid target hosts)")
|
||||
return
|
||||
} else {
|
||||
if len(targetHosts[0]) <= 0 {
|
||||
log.Warn().Msg("nothing to do (no target hosts)")
|
||||
log.Warn().Msg("nothing to do (no valid target hosts)")
|
||||
return
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue