mirror of
https://github.com/bettercap/bettercap
synced 2025-08-20 05:23:19 -07:00
new: net.show now accepts a comma separated list of ip, macs or aliases to filter for
This commit is contained in:
parent
09caa4dd37
commit
a2b3ee79fb
4 changed files with 52 additions and 32 deletions
|
@ -81,6 +81,19 @@ func (lan *LAN) Get(mac string) (*Endpoint, bool) {
|
|||
return nil, false
|
||||
}
|
||||
|
||||
func (lan *LAN) GetByIp(ip string) *Endpoint {
|
||||
lan.Lock()
|
||||
defer lan.Unlock()
|
||||
|
||||
for _, e := range lan.hosts {
|
||||
if e.IpAddress == ip {
|
||||
return e
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (lan *LAN) List() (list []*Endpoint) {
|
||||
lan.Lock()
|
||||
defer lan.Unlock()
|
||||
|
@ -169,19 +182,6 @@ func (lan *LAN) EachHost(cb func(mac string, e *Endpoint)) {
|
|||
}
|
||||
}
|
||||
|
||||
func (lan *LAN) GetByIp(ip string) *Endpoint {
|
||||
lan.Lock()
|
||||
defer lan.Unlock()
|
||||
|
||||
for _, e := range lan.hosts {
|
||||
if e.IpAddress == ip {
|
||||
return e
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (lan *LAN) AddIfNew(ip, mac string) *Endpoint {
|
||||
lan.Lock()
|
||||
defer lan.Unlock()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue