diff --git a/modules/net_recon/net_show.go b/modules/net_recon/net_show.go index c3dd9874..a0b38009 100644 --- a/modules/net_recon/net_show.go +++ b/modules/net_recon/net_show.go @@ -2,6 +2,7 @@ package net_recon import ( "fmt" + "github.com/bettercap/bettercap/modules/syn_scan" "sort" "strings" "time" @@ -12,6 +13,7 @@ import ( "github.com/dustin/go-humanize" "github.com/evilsocket/islazy/tui" + "github.com/evilsocket/islazy/str" ) const ( @@ -297,9 +299,29 @@ func (mod *Discovery) showMeta(arg string) (err error) { } for _, k := range keys { + meta := t.Meta.Get(k) + val := "" + if s, ok := meta.(string); ok { + val = s + } else if ports, ok := meta.(map[int]*syn_scan.OpenPort); ok { + val = "ports: " + for _, info := range ports { + val += fmt.Sprintf("%s:%d", info.Proto, info.Port) + if info.Service != "" { + val += fmt.Sprintf("(%s)", info.Service) + } + if info.Banner != "" { + val += fmt.Sprintf(" [%s]", info.Banner) + } + val += " " + } + val = str.Trim(val) + } else { + val = fmt.Sprintf("%#v", meta) + } rows = append(rows, []string{ tui.Green(k), - tui.Yellow(t.Meta.Get(k).(string)), + tui.Yellow(val), }) } diff --git a/network/net.go b/network/net.go index 4838f74c..bb485fc7 100644 --- a/network/net.go +++ b/network/net.go @@ -112,7 +112,7 @@ func ParseTargets(targets string, aliasMap *data.UnsortedKV) (ips []net.IP, macs } targets = strings.Trim(targets, ", ") - fmt.Printf("targets=%s macs=%#v\n", targets, macs) + // fmt.Printf("targets=%s macs=%#v\n", targets, macs) // check and resolve aliases for _, targetAlias := range aliasParser.FindAllString(targets, -1) { diff --git a/network/net_linux.go b/network/net_linux.go index 1bd5bc5b..7e8265a6 100644 --- a/network/net_linux.go +++ b/network/net_linux.go @@ -44,7 +44,7 @@ func SetInterfaceChannel(iface string, channel int) error { Debug("SetInterfaceChannel(%s, %d) iw based", iface, channel) out, err := core.Exec("iw", []string{"dev", iface, "set", "channel", fmt.Sprintf("%d", channel)}) if err != nil { - return err + return fmt.Errorf("iw: out=%s err=%s", out, err) } else if out != "" { return fmt.Errorf("Unexpected output while setting interface %s to channel %d: %s", iface, channel, out) } @@ -52,7 +52,7 @@ func SetInterfaceChannel(iface string, channel int) error { Debug("SetInterfaceChannel(%s, %d) iwconfig based") out, err := core.Exec("iwconfig", []string{iface, "channel", fmt.Sprintf("%d", channel)}) if err != nil { - return err + return fmt.Errorf("iwconfig: out=%s err=%s", out, err) } else if out != "" { return fmt.Errorf("Unexpected output while setting interface %s to channel %d: %s", iface, channel, out) }