From 17ec8b07a7c7a257af40417276f38175a8177dcf Mon Sep 17 00:00:00 2001 From: jose-angel gomez-lopez Date: Mon, 26 May 2025 10:15:00 +0200 Subject: [PATCH] #92 making sure that the argument of net.ParseIP is a pure IP address (x.x.x.x), without any prefix --- pkg/collect.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pkg/collect.go b/pkg/collect.go index 69fe951..ba47d9a 100644 --- a/pkg/collect.go +++ b/pkg/collect.go @@ -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