mirror of
https://github.com/bettercap/bettercap
synced 2025-07-13 00:23:49 -07:00
fix: ignoring broadcast macs on osx
This commit is contained in:
parent
0e86cf4394
commit
8ee4cad421
1 changed files with 6 additions and 2 deletions
|
@ -140,7 +140,7 @@ func (lan *LAN) Remove(ip, mac string) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (lan *LAN) shouldIgnore(ip string) bool {
|
func (lan *LAN) shouldIgnore(ip, mac string) bool {
|
||||||
// skip our own address
|
// skip our own address
|
||||||
if ip == lan.Interface.IpAddress {
|
if ip == lan.Interface.IpAddress {
|
||||||
return true
|
return true
|
||||||
|
@ -153,6 +153,10 @@ func (lan *LAN) shouldIgnore(ip string) bool {
|
||||||
if strings.HasSuffix(ip, ".255") {
|
if strings.HasSuffix(ip, ".255") {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
// skip broadcast macs
|
||||||
|
if strings.ToLower(mac) == "ff:ff:ff:ff:ff:ff" {
|
||||||
|
return true
|
||||||
|
}
|
||||||
// skip everything which is not in our subnet (multicast noise)
|
// skip everything which is not in our subnet (multicast noise)
|
||||||
addr := net.ParseIP(ip)
|
addr := net.ParseIP(ip)
|
||||||
return lan.Interface.Net.Contains(addr) == false
|
return lan.Interface.Net.Contains(addr) == false
|
||||||
|
@ -188,7 +192,7 @@ func (lan *LAN) AddIfNew(ip, mac string) *Endpoint {
|
||||||
lan.Lock()
|
lan.Lock()
|
||||||
defer lan.Unlock()
|
defer lan.Unlock()
|
||||||
|
|
||||||
if lan.shouldIgnore(ip) {
|
if lan.shouldIgnore(ip, mac) {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue