mirror of
https://github.com/bettercap/bettercap
synced 2025-07-16 10:03:39 -07:00
misc: improve consistency and add rssi to logs
This commit is contained in:
parent
b8e48e7f8a
commit
b9cf32573f
4 changed files with 40 additions and 11 deletions
|
@ -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),
|
||||
|
|
|
@ -25,8 +25,11 @@ import (
|
|||
var maxStationTTL = 5 * time.Minute
|
||||
|
||||
type WiFiProbe struct {
|
||||
From net.HardwareAddr
|
||||
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,
|
||||
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,
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue