mirror of
https://github.com/bettercap/bettercap
synced 2025-08-14 10:46:57 -07:00
wifi module: fixes and multiple channel selection
This commit is contained in:
commit
654633c419
6 changed files with 105 additions and 22 deletions
|
@ -17,7 +17,8 @@ func (w *WiFiModule) isApSelected() bool {
|
|||
return w.ap != nil
|
||||
}
|
||||
|
||||
func (w *WiFiModule) getRow(station *network.Station) []string {
|
||||
func (w *WiFiModule) getRow(station *network.Station) ([]string, bool) {
|
||||
include := false
|
||||
sinceStarted := time.Since(w.Session.StartedAt)
|
||||
sinceFirstSeen := time.Since(station.FirstSeen)
|
||||
|
||||
|
@ -61,6 +62,17 @@ func (w *WiFiModule) getRow(station *network.Station) []string {
|
|||
recvd = humanize.Bytes(station.Received)
|
||||
}
|
||||
|
||||
if w.source == "" {
|
||||
for _, frequencies := range w.frequencies {
|
||||
if frequencies == station.Frequency {
|
||||
include = true
|
||||
break
|
||||
}
|
||||
}
|
||||
} else {
|
||||
include = true
|
||||
}
|
||||
|
||||
if w.isApSelected() {
|
||||
return []string{
|
||||
fmt.Sprintf("%d dBm", station.RSSI),
|
||||
|
@ -70,7 +82,7 @@ func (w *WiFiModule) getRow(station *network.Station) []string {
|
|||
sent,
|
||||
recvd,
|
||||
seen,
|
||||
}
|
||||
}, include
|
||||
} else {
|
||||
// this is ugly, but necessary in order to have this
|
||||
// method handle both access point and clients
|
||||
|
@ -93,7 +105,7 @@ func (w *WiFiModule) getRow(station *network.Station) []string {
|
|||
sent,
|
||||
recvd,
|
||||
seen,
|
||||
}
|
||||
}, include
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -123,7 +135,9 @@ func (w *WiFiModule) Show(by string) error {
|
|||
|
||||
rows := make([][]string, 0)
|
||||
for _, s := range stations {
|
||||
rows = append(rows, w.getRow(s))
|
||||
if row, include := w.getRow(s); include == true {
|
||||
rows = append(rows, row)
|
||||
}
|
||||
}
|
||||
nrows := len(rows)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue