mirror of
https://github.com/bettercap/bettercap
synced 2025-08-19 13:09:49 -07:00
new: reporting alias and vendor for wifi.client.new and wifi.client.lost events
This commit is contained in:
parent
b450747f4e
commit
621f03c946
2 changed files with 16 additions and 7 deletions
|
@ -88,18 +88,21 @@ func (s *EventsStream) viewWiFiHandshakeEvent(e session.Event) {
|
||||||
|
|
||||||
func (s *EventsStream) viewWiFiClientEvent(e session.Event) {
|
func (s *EventsStream) viewWiFiClientEvent(e session.Event) {
|
||||||
ce := e.Data.(WiFiClientEvent)
|
ce := e.Data.(WiFiClientEvent)
|
||||||
|
|
||||||
|
ce.Client.Alias = s.Session.Lan.GetAlias(ce.Client.BSSID())
|
||||||
|
|
||||||
if e.Tag == "wifi.client.new" {
|
if e.Tag == "wifi.client.new" {
|
||||||
fmt.Fprintf(s.output, "[%s] [%s] new wifi client %s detected for %s (%s)\n",
|
fmt.Fprintf(s.output, "[%s] [%s] new station %s detected for %s (%s)\n",
|
||||||
e.Time.Format(eventTimeFormat),
|
e.Time.Format(eventTimeFormat),
|
||||||
tui.Green(e.Tag),
|
tui.Green(e.Tag),
|
||||||
ce.Client.BSSID(),
|
ce.Client.String(),
|
||||||
tui.Bold(ce.AP.ESSID()),
|
tui.Bold(ce.AP.ESSID()),
|
||||||
tui.Dim(ce.AP.BSSID()))
|
tui.Dim(ce.AP.BSSID()))
|
||||||
} else if e.Tag == "wifi.client.lost" {
|
} else if e.Tag == "wifi.client.lost" {
|
||||||
fmt.Fprintf(s.output, "[%s] [%s] wifi client %s disconnected from %s (%s)\n",
|
fmt.Fprintf(s.output, "[%s] [%s] station %s disconnected from %s (%s)\n",
|
||||||
e.Time.Format(eventTimeFormat),
|
e.Time.Format(eventTimeFormat),
|
||||||
tui.Green(e.Tag),
|
tui.Green(e.Tag),
|
||||||
ce.Client.BSSID(),
|
ce.Client.String(),
|
||||||
tui.Bold(ce.AP.ESSID()),
|
tui.Bold(ce.AP.ESSID()),
|
||||||
tui.Dim(ce.AP.BSSID()))
|
tui.Dim(ce.AP.BSSID()))
|
||||||
}
|
}
|
||||||
|
|
|
@ -149,10 +149,16 @@ func (t *Endpoint) String() string {
|
||||||
return t.IpAddress
|
return t.IpAddress
|
||||||
} else if t.Vendor == "" {
|
} else if t.Vendor == "" {
|
||||||
return fmt.Sprintf("%s%s", ipPart, t.HwAddress)
|
return fmt.Sprintf("%s%s", ipPart, t.HwAddress)
|
||||||
} else if t.Hostname == "" {
|
} else if t.Hostname == "" && t.Alias == "" {
|
||||||
return fmt.Sprintf("%s%s ( %s )", ipPart, t.HwAddress, t.Vendor)
|
return fmt.Sprintf("%s%s (%s)", ipPart, t.HwAddress, t.Vendor)
|
||||||
}
|
}
|
||||||
return fmt.Sprintf("%s%s ( %s ) - %s", ipPart, t.HwAddress, t.Vendor, tui.Bold(t.Hostname))
|
|
||||||
|
name := t.Hostname
|
||||||
|
if t.Alias != "" {
|
||||||
|
name = t.Alias
|
||||||
|
}
|
||||||
|
|
||||||
|
return fmt.Sprintf("%s%s (%s) - %s", ipPart, t.HwAddress, t.Vendor, tui.Bold(name))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *Endpoint) OnMeta(meta map[string]string) {
|
func (t *Endpoint) OnMeta(meta map[string]string) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue