mirror of
https://github.com/bettercap/bettercap
synced 2025-08-19 21:13:18 -07:00
new: new wifi.show.manufacturer parameter to show APs manufacturers (fixes #456)
This commit is contained in:
parent
99a60364cd
commit
5944189802
2 changed files with 68 additions and 22 deletions
|
@ -48,6 +48,7 @@ type WiFiModule struct {
|
||||||
assocOpen bool
|
assocOpen bool
|
||||||
shakesFile string
|
shakesFile string
|
||||||
apRunning bool
|
apRunning bool
|
||||||
|
showManuf bool
|
||||||
apConfig packets.Dot11ApConfig
|
apConfig packets.Dot11ApConfig
|
||||||
writes *sync.WaitGroup
|
writes *sync.WaitGroup
|
||||||
reads *sync.WaitGroup
|
reads *sync.WaitGroup
|
||||||
|
@ -72,6 +73,7 @@ func NewWiFiModule(s *session.Session) *WiFiModule {
|
||||||
assocSkip: []net.HardwareAddr{},
|
assocSkip: []net.HardwareAddr{},
|
||||||
assocSilent: false,
|
assocSilent: false,
|
||||||
assocOpen: false,
|
assocOpen: false,
|
||||||
|
showManuf: false,
|
||||||
writes: &sync.WaitGroup{},
|
writes: &sync.WaitGroup{},
|
||||||
reads: &sync.WaitGroup{},
|
reads: &sync.WaitGroup{},
|
||||||
chanLock: &sync.Mutex{},
|
chanLock: &sync.Mutex{},
|
||||||
|
@ -245,6 +247,10 @@ func NewWiFiModule(s *session.Session) *WiFiModule {
|
||||||
mod.selector = utils.ViewSelectorFor(&mod.SessionModule, "wifi.show",
|
mod.selector = utils.ViewSelectorFor(&mod.SessionModule, "wifi.show",
|
||||||
[]string{"rssi", "bssid", "essid", "channel", "encryption", "clients", "seen", "sent", "rcvd"}, "rssi asc")
|
[]string{"rssi", "bssid", "essid", "channel", "encryption", "clients", "seen", "sent", "rcvd"}, "rssi asc")
|
||||||
|
|
||||||
|
mod.AddParam(session.NewBoolParameter("wifi.show.manufacturer",
|
||||||
|
"false",
|
||||||
|
"If true, wifi.show will also show the devices manufacturers."))
|
||||||
|
|
||||||
mod.AddHandler(session.NewModuleHandler("wifi.recon.channel", `wifi\.recon\.channel[\s]+([0-9]+(?:[, ]+[0-9]+)*|clear)`,
|
mod.AddHandler(session.NewModuleHandler("wifi.recon.channel", `wifi\.recon\.channel[\s]+([0-9]+(?:[, ]+[0-9]+)*|clear)`,
|
||||||
"WiFi channels (comma separated) or 'clear' for channel hopping.",
|
"WiFi channels (comma separated) or 'clear' for channel hopping.",
|
||||||
func(args []string) (err error) {
|
func(args []string) (err error) {
|
||||||
|
|
|
@ -81,6 +81,17 @@ func (mod *WiFiModule) getRow(station *network.Station) ([]string, bool) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if mod.isApSelected() {
|
if mod.isApSelected() {
|
||||||
|
if mod.showManuf {
|
||||||
|
return []string{
|
||||||
|
rssi,
|
||||||
|
bssid,
|
||||||
|
tui.Dim(station.Vendor),
|
||||||
|
strconv.Itoa(station.Channel()),
|
||||||
|
sent,
|
||||||
|
recvd,
|
||||||
|
seen,
|
||||||
|
}, include
|
||||||
|
} else {
|
||||||
return []string{
|
return []string{
|
||||||
rssi,
|
rssi,
|
||||||
bssid,
|
bssid,
|
||||||
|
@ -89,6 +100,7 @@ func (mod *WiFiModule) getRow(station *network.Station) ([]string, bool) {
|
||||||
recvd,
|
recvd,
|
||||||
seen,
|
seen,
|
||||||
}, include
|
}, include
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// this is ugly, but necessary in order to have this
|
// this is ugly, but necessary in order to have this
|
||||||
// method handle both access point and clients
|
// method handle both access point and clients
|
||||||
|
@ -117,6 +129,21 @@ func (mod *WiFiModule) getRow(station *network.Station) ([]string, bool) {
|
||||||
wps = tui.Dim(tui.Yellow(wps))
|
wps = tui.Dim(tui.Yellow(wps))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if mod.showManuf {
|
||||||
|
return []string{
|
||||||
|
rssi,
|
||||||
|
bssid,
|
||||||
|
tui.Dim(station.Vendor),
|
||||||
|
ssid,
|
||||||
|
encryption,
|
||||||
|
wps,
|
||||||
|
strconv.Itoa(station.Channel()),
|
||||||
|
clients,
|
||||||
|
sent,
|
||||||
|
recvd,
|
||||||
|
seen,
|
||||||
|
}, include
|
||||||
|
} else {
|
||||||
return []string{
|
return []string{
|
||||||
rssi,
|
rssi,
|
||||||
bssid,
|
bssid,
|
||||||
|
@ -130,6 +157,7 @@ func (mod *WiFiModule) getRow(station *network.Station) ([]string, bool) {
|
||||||
seen,
|
seen,
|
||||||
}, include
|
}, include
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (mod *WiFiModule) doFilter(station *network.Station) bool {
|
func (mod *WiFiModule) doFilter(station *network.Station) bool {
|
||||||
|
@ -225,9 +253,17 @@ func (mod *WiFiModule) colNames(nrows int) []string {
|
||||||
columns := []string(nil)
|
columns := []string(nil)
|
||||||
|
|
||||||
if !mod.isApSelected() {
|
if !mod.isApSelected() {
|
||||||
|
if mod.showManuf {
|
||||||
|
columns = []string{"RSSI", "BSSID", "Manufacturer", "SSID", "Encryption", "WPS", "Ch", "Clients", "Sent", "Recvd", "Seen"}
|
||||||
|
} else {
|
||||||
columns = []string{"RSSI", "BSSID", "SSID", "Encryption", "WPS", "Ch", "Clients", "Sent", "Recvd", "Seen"}
|
columns = []string{"RSSI", "BSSID", "SSID", "Encryption", "WPS", "Ch", "Clients", "Sent", "Recvd", "Seen"}
|
||||||
|
}
|
||||||
} else if nrows > 0 {
|
} else if nrows > 0 {
|
||||||
|
if mod.showManuf {
|
||||||
|
columns = []string{"RSSI", "BSSID", "Manufacturer", "Ch", "Sent", "Recvd", "Seen"}
|
||||||
|
} else {
|
||||||
columns = []string{"RSSI", "BSSID", "Ch", "Sent", "Recvd", "Seen"}
|
columns = []string{"RSSI", "BSSID", "Ch", "Sent", "Recvd", "Seen"}
|
||||||
|
}
|
||||||
fmt.Printf("\n%s clients:\n", mod.ap.HwAddress)
|
fmt.Printf("\n%s clients:\n", mod.ap.HwAddress)
|
||||||
} else {
|
} else {
|
||||||
fmt.Printf("\nNo authenticated clients detected for %s.\n", mod.ap.HwAddress)
|
fmt.Printf("\nNo authenticated clients detected for %s.\n", mod.ap.HwAddress)
|
||||||
|
@ -287,6 +323,10 @@ func (mod *WiFiModule) Show() (err error) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if err, mod.showManuf = mod.BoolParam("wifi.show.manufacturer"); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
rows := make([][]string, 0)
|
rows := make([][]string, 0)
|
||||||
for _, s := range stations {
|
for _, s := range stations {
|
||||||
if row, include := mod.getRow(s); include {
|
if row, include := mod.getRow(s); include {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue