From bf34561a19ca3d4ca8d97228b571f9ea75f6d372 Mon Sep 17 00:00:00 2001 From: evilsocket Date: Sat, 19 Jan 2019 18:03:31 +0100 Subject: [PATCH] new: added interface name and channel on wifi.show --- modules/wifi_show.go | 4 +++- network/net_linux.go | 10 ++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/modules/wifi_show.go b/modules/wifi_show.go index 30ce411d..973bbe8b 100644 --- a/modules/wifi_show.go +++ b/modules/wifi_show.go @@ -159,7 +159,9 @@ func (w *WiFiModule) Show(by string) error { } w.Session.Queue.Stats.RLock() - fmt.Printf("\n%s %s / %s %s / %d pkts / %d errs\n\n", + fmt.Printf("\n%s (ch. %d) / %s %s / %s %s / %d pkts / %d errs\n\n", + w.Session.Interface.Name(), + network.GetInterfaceChannel(w.Session.Interface.Name()), tui.Red("↑"), humanize.Bytes(w.Session.Queue.Stats.Sent), tui.Green("↓"), diff --git a/network/net_linux.go b/network/net_linux.go index 68c758a1..13fa5b82 100644 --- a/network/net_linux.go +++ b/network/net_linux.go @@ -38,6 +38,16 @@ func getInterfaceName(iface net.Interface) string { return iface.Name } +func GetInterfaceChannel(iface string) int { + currChannelLock.Lock() + defer currChannelLock.Unlock() + + if curr, found := currChannels[iface]; found { + return curr + } + return 0 +} + func SetInterfaceChannel(iface string, channel int) error { currChannelLock.Lock() defer currChannelLock.Unlock()