mirror of
https://github.com/bettercap/bettercap
synced 2025-08-13 18:26:57 -07:00
fix: fixed a bug in net.show.meta which prevented info being printed if the selected ip was the gateway
This commit is contained in:
parent
4eead7eafa
commit
89cccf028a
1 changed files with 14 additions and 0 deletions
|
@ -80,6 +80,14 @@ func (lan *LAN) Get(mac string) (*Endpoint, bool) {
|
||||||
lan.Lock()
|
lan.Lock()
|
||||||
defer lan.Unlock()
|
defer lan.Unlock()
|
||||||
|
|
||||||
|
mac = NormalizeMac(mac)
|
||||||
|
|
||||||
|
if mac == lan.iface.HwAddress {
|
||||||
|
return lan.iface, true
|
||||||
|
} else if mac == lan.gateway.HwAddress {
|
||||||
|
return lan.gateway, true
|
||||||
|
}
|
||||||
|
|
||||||
if e, found := lan.hosts[mac]; found {
|
if e, found := lan.hosts[mac]; found {
|
||||||
return e, true
|
return e, true
|
||||||
}
|
}
|
||||||
|
@ -90,6 +98,12 @@ func (lan *LAN) GetByIp(ip string) *Endpoint {
|
||||||
lan.Lock()
|
lan.Lock()
|
||||||
defer lan.Unlock()
|
defer lan.Unlock()
|
||||||
|
|
||||||
|
if ip == lan.iface.IpAddress {
|
||||||
|
return lan.iface
|
||||||
|
} else if ip == lan.gateway.IpAddress {
|
||||||
|
return lan.gateway
|
||||||
|
}
|
||||||
|
|
||||||
for _, e := range lan.hosts {
|
for _, e := range lan.hosts {
|
||||||
if e.IpAddress == ip {
|
if e.IpAddress == ip {
|
||||||
return e
|
return e
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue