diff --git a/modules/events_view.go b/modules/events_view.go index 5a36099a..21d99451 100644 --- a/modules/events_view.go +++ b/modules/events_view.go @@ -29,14 +29,19 @@ func (s EventsStream) viewWiFiEvent(e session.Event) { if ap.Vendor != "" { vend = fmt.Sprintf(" (%s)", ap.Vendor) } + rssi := "" + if ap.RSSI != 0 { + rssi = fmt.Sprintf(" (%d dBm)", ap.RSSI) + } if e.Tag == "wifi.ap.new" { - fmt.Printf("[%s] [%s] WiFi access point %s detected as %s%s.\n", + fmt.Printf("[%s] [%s] WiFi access point %s%s detected as %s%s.\n", e.Time.Format(eventTimeFormat), core.Green(e.Tag), core.Bold(ap.ESSID()), + core.Dim(core.Yellow(rssi)), core.Green(ap.BSSID()), - vend) + core.Dim(vend)) } else if e.Tag == "wifi.ap.lost" { fmt.Printf("[%s] [%s] WiFi access point %s (%s) lost.\n", e.Time.Format(eventTimeFormat), @@ -51,11 +56,24 @@ func (s EventsStream) viewWiFiEvent(e session.Event) { } } else if e.Tag == "wifi.client.probe" { probe := e.Data.(WiFiProbe) - fmt.Printf("[%s] [%s] Station %s is probing for SSID %s\n", + desc := "" + if probe.FromAlias != "" { + desc = fmt.Sprintf(" (%s)", probe.FromAlias) + } else if probe.FromVendor != "" { + desc = fmt.Sprintf(" (%s)", probe.FromVendor) + } + rssi := "" + if probe.RSSI != 0 { + rssi = fmt.Sprintf(" (%d dBm)", probe.RSSI) + } + + fmt.Printf("[%s] [%s] Station %s%s is probing for SSID %s%s\n", e.Time.Format(eventTimeFormat), core.Green(e.Tag), - probe.From.String(), - core.Bold(probe.SSID)) + probe.FromAddr.String(), + core.Dim(desc), + core.Bold(probe.SSID), + core.Yellow(rssi)) } } @@ -87,7 +105,7 @@ func (s EventsStream) viewEndpointEvent(e session.Event) { e.Time.Format(eventTimeFormat), core.Green(e.Tag), core.Red(t.IpAddress), - name) + core.Dim(vend)) } else { fmt.Printf("[%s] [%s] %s\n", e.Time.Format(eventTimeFormat), diff --git a/modules/wifi_recon.go b/modules/wifi_recon.go index 17d2f0cf..22a500ce 100644 --- a/modules/wifi_recon.go +++ b/modules/wifi_recon.go @@ -25,8 +25,11 @@ import ( var maxStationTTL = 5 * time.Minute type WiFiProbe struct { - From net.HardwareAddr - SSID string + FromAddr net.HardwareAddr + FromVendor string + FromAlias string + SSID string + RSSI int8 } type WiFiRecon struct { @@ -481,8 +484,11 @@ func (w *WiFiRecon) discoverProbes(radiotap *layers.RadioTap, dot11 *layers.Dot1 } w.Session.Events.Add("wifi.client.probe", WiFiProbe{ - From: dot11.Address2, - SSID: string(req.Contents[2 : 2+size]), + FromAddr: dot11.Address2, + FromVendor: network.OuiLookup(dot11.Address2.String()), + FromAlias: w.Session.Lan.GetAlias(dot11.Address2.String()), + SSID: string(req.Contents[2 : 2+size]), + RSSI: radiotap.DBMAntennaSignal, }) } diff --git a/network/lan.go b/network/lan.go index 0240fe9e..12f5e4b2 100644 --- a/network/lan.go +++ b/network/lan.go @@ -204,3 +204,7 @@ func (lan *LAN) AddIfNew(ip, mac string) *Endpoint { return nil } + +func (lan *LAN) GetAlias(mac string) string { + return lan.aliases.Get(mac) +} diff --git a/session/session_core_handlers.go b/session/session_core_handlers.go index be4ccdce..09f7bcb4 100644 --- a/session/session_core_handlers.go +++ b/session/session_core_handlers.go @@ -85,10 +85,11 @@ func (s *Session) helpHandler(args []string, sess *Session) error { for _, h := range handlers { fmt.Printf(h.Help(maxLen)) } + fmt.Println() params := m.Parameters() if len(params) > 0 { - fmt.Printf("\n Parameters\n\n") + fmt.Printf(" Parameters\n\n") maxLen := 0 for _, h := range params { len := len(h.Name)