diff --git a/session/modules/net_recon.go b/session/modules/net_recon.go index 39797709..db515520 100644 --- a/session/modules/net_recon.go +++ b/session/modules/net_recon.go @@ -99,17 +99,27 @@ func (d *Discovery) Start() error { } if n_gw_shared > 0 { - log.Warningf("WARNING: %d endpoints share the same MAC of the gateway, there're might be some IP isolation going on.\n", n_gw_shared) + a := "" + b := "" + if n_gw_shared == 1 { + a = "" + b = "s" + } else { + a = "s" + b = "" + } + + log.Warningf("WARNING: Found %d endpoint%s which share%s the same MAC of the gateway (%s), there're might be some IP isolation going on, skipping.\n", n_gw_shared, a, b, d.Session.Gateway.HwAddress) } // refresh target pool - for ip, mac := range new { - d.Session.Targets.AddIfNotExist(ip, mac) - } - for ip, mac := range rem { d.Session.Targets.Remove(ip, mac) } + + for ip, mac := range new { + d.Session.Targets.AddIfNotExist(ip, mac) + } } d.before = d.current diff --git a/session/targets.go b/session/targets.go index ffc0ce7c..882f8cfa 100644 --- a/session/targets.go +++ b/session/targets.go @@ -56,22 +56,23 @@ func (tp *Targets) Has(ip string) bool { return false } -func (tp *Targets) AddIfNotExist(ip, mac string) { +func (tp *Targets) AddIfNotExist(ip, mac string) *net.Endpoint { tp.lock.Lock() defer tp.lock.Unlock() if tp.shouldIgnore(ip) { - return + return nil } if t, found := tp.Targets[mac]; found { - t.IpAddress = ip - return + return t } e := net.NewEndpoint(ip, mac) log.Infof("[%snew%s] %s\n", core.GREEN, core.RESET, e) tp.Targets[mac] = e + + return nil } type tSorter []*net.Endpoint