mirror of
https://github.com/bettercap/bettercap
synced 2025-08-19 21:13:18 -07:00
new: new net.clear command to clear endpoints collected by net.recon
This commit is contained in:
parent
e3573b81e4
commit
5f462525d3
2 changed files with 14 additions and 0 deletions
|
@ -30,6 +30,13 @@ func NewDiscovery(s *session.Session) *Discovery {
|
||||||
return mod.Stop()
|
return mod.Stop()
|
||||||
}))
|
}))
|
||||||
|
|
||||||
|
mod.AddHandler(session.NewModuleHandler("net.clear", "",
|
||||||
|
"Clear all endpoints collected by the hosts discovery module.",
|
||||||
|
func(args []string) error {
|
||||||
|
mod.Session.Lan.Clear()
|
||||||
|
return nil
|
||||||
|
}))
|
||||||
|
|
||||||
mod.AddParam(session.NewBoolParameter("net.show.meta",
|
mod.AddParam(session.NewBoolParameter("net.show.meta",
|
||||||
"false",
|
"false",
|
||||||
"If true, the net.show command will show all metadata collected about each endpoint."))
|
"If true, the net.show command will show all metadata collected about each endpoint."))
|
||||||
|
|
|
@ -229,3 +229,10 @@ func (lan *LAN) AddIfNew(ip, mac string) *Endpoint {
|
||||||
func (lan *LAN) GetAlias(mac string) string {
|
func (lan *LAN) GetAlias(mac string) string {
|
||||||
return lan.aliases.GetOr(mac, "")
|
return lan.aliases.GetOr(mac, "")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (lan *LAN) Clear() {
|
||||||
|
lan.Lock()
|
||||||
|
defer lan.Unlock()
|
||||||
|
lan.hosts = make(map[string]*Endpoint)
|
||||||
|
lan.ttl = make(map[string]uint)
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue