From 696c056b56e6bc9a013937096f65cfc2b92c0cf3 Mon Sep 17 00:00:00 2001 From: evilsocket Date: Sun, 10 Feb 2019 12:51:50 +0100 Subject: [PATCH] fix: using tui.Table for wifi.show.wps output --- modules/wifi_show.go | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/modules/wifi_show.go b/modules/wifi_show.go index 60923788..2b355082 100644 --- a/modules/wifi_show.go +++ b/modules/wifi_show.go @@ -331,14 +331,20 @@ func (w *WiFiModule) ShowWPS(bssid string) (err error) { } sort.Sort(ByBssidSorter(toShow)) + + colNames := []string{"Name", "Value"} + for _, station := range toShow { ssid := station.ESSID() if ssid == "" { ssid = tui.Dim(ssid) } - fmt.Println() - fmt.Printf("* %s (%s ch:%d):\n", tui.Bold(ssid), tui.Dim(station.BSSID()), station.Channel()) + rows := [][]string{ + []string{tui.Green("essid"), ssid}, + []string{tui.Green("bssid"), station.BSSID()}, + } + keys := []string{} for name := range station.WPS { keys = append(keys, name) @@ -346,11 +352,14 @@ func (w *WiFiModule) ShowWPS(bssid string) (err error) { sort.Strings(keys) for _, name := range keys { - fmt.Printf(" %s: %s\n", name, tui.Yellow(station.WPS[name])) + rows = append(rows, []string{ + tui.Green(name), + tui.Yellow(station.WPS[name]), + }) } - } - fmt.Println() + tui.Table(os.Stdout, colNames, rows) + } return nil }