mirror of
https://github.com/davidallendj/magellan.git
synced 2025-12-20 03:27:03 -07:00
#92 making sure that the argument of net.ParseIP is a pure IP address (x.x.x.x), without any prefix
This commit is contained in:
parent
fcfe76295e
commit
17ec8b07a7
1 changed files with 7 additions and 2 deletions
|
|
@ -167,9 +167,14 @@ func CollectInventory(assets *[]RemoteAsset, params *CollectParams) ([]map[strin
|
|||
|
||||
// optionally, add the MACAddr property if we find a matching IP
|
||||
// from the correct ethernet interface
|
||||
mac, err := FindMACAddressWithIP(config, net.ParseIP(sr.Host))
|
||||
host := sr.Host
|
||||
str_protocol := "https://"
|
||||
if strings.Contains(host, str_protocol) {
|
||||
host = strings.TrimPrefix(sr.Host, str_protocol)
|
||||
}
|
||||
mac, err := FindMACAddressWithIP(config, net.ParseIP(host))
|
||||
if err != nil {
|
||||
log.Warn().Err(err).Msgf("failed to find MAC address with IP '%s'", sr.Host)
|
||||
log.Warn().Err(err).Msgf("failed to find MAC address with IP '%s'", host)
|
||||
}
|
||||
if mac != "" {
|
||||
data["MACAddr"] = mac
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue