mirror of
https://github.com/bettercap/bettercap
synced 2025-08-20 21:43:18 -07:00
new: new net.show.meta boolean flag to enable or disable endpoints metainfo rendering
This commit is contained in:
parent
6f691245e0
commit
9f64372273
2 changed files with 15 additions and 4 deletions
|
@ -29,6 +29,10 @@ func NewDiscovery(s *session.Session) *Discovery {
|
|||
return d.Stop()
|
||||
}))
|
||||
|
||||
d.AddParam(session.NewBoolParameter("net.show.meta",
|
||||
"true",
|
||||
"If true, the net.show command will show all metadata collected about each endpoint."))
|
||||
|
||||
d.AddHandler(session.NewModuleHandler("net.show", "",
|
||||
"Show cache hosts list (default sorting by ip).",
|
||||
func(args []string) error {
|
||||
|
|
|
@ -110,6 +110,11 @@ func (d *Discovery) getRow(e *network.Endpoint, withMeta bool) [][]string {
|
|||
}
|
||||
|
||||
func (d *Discovery) Show(by string, addr string) error {
|
||||
err, showMeta := d.BoolParam("net.show.meta")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
targets := d.Session.Lan.List()
|
||||
if by == "seen" {
|
||||
sort.Sort(BySeenSorter(targets))
|
||||
|
@ -141,10 +146,12 @@ func (d *Discovery) Show(by string, addr string) error {
|
|||
}
|
||||
|
||||
hasMeta := false
|
||||
for _, t := range targets {
|
||||
if !t.Meta.Empty() {
|
||||
hasMeta = true
|
||||
break
|
||||
if showMeta {
|
||||
for _, t := range targets {
|
||||
if !t.Meta.Empty() {
|
||||
hasMeta = true
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue