mirror of
https://github.com/bettercap/bettercap
synced 2025-07-07 21:42:06 -07:00
misc: small fix or general refactoring i did not bother commenting
This commit is contained in:
parent
620f5291a6
commit
b80bd4e1e2
2 changed files with 31 additions and 30 deletions
|
@ -184,36 +184,6 @@ func mhz2chan(freq int) int {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
type ByChannelSorter []*WiFiStation
|
|
||||||
|
|
||||||
func (a ByChannelSorter) Len() int { return len(a) }
|
|
||||||
func (a ByChannelSorter) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
|
|
||||||
func (a ByChannelSorter) Less(i, j int) bool {
|
|
||||||
if a[i].Channel == a[j].Channel {
|
|
||||||
return a[i].HwAddress < a[j].HwAddress
|
|
||||||
}
|
|
||||||
return a[i].Channel < a[j].Channel
|
|
||||||
}
|
|
||||||
|
|
||||||
type ByEssidSorter []*WiFiStation
|
|
||||||
|
|
||||||
func (a ByEssidSorter) Len() int { return len(a) }
|
|
||||||
func (a ByEssidSorter) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
|
|
||||||
func (a ByEssidSorter) Less(i, j int) bool {
|
|
||||||
if a[i].ESSID() == a[j].ESSID() {
|
|
||||||
return a[i].HwAddress < a[j].HwAddress
|
|
||||||
}
|
|
||||||
return a[i].ESSID() < a[j].ESSID()
|
|
||||||
}
|
|
||||||
|
|
||||||
type BywifiSeenSorter []*WiFiStation
|
|
||||||
|
|
||||||
func (a BywifiSeenSorter) Len() int { return len(a) }
|
|
||||||
func (a BywifiSeenSorter) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
|
|
||||||
func (a BywifiSeenSorter) Less(i, j int) bool {
|
|
||||||
return a[i].LastSeen.After(a[j].LastSeen)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (w *WiFiRecon) showTable(header []string, rows [][]string) {
|
func (w *WiFiRecon) showTable(header []string, rows [][]string) {
|
||||||
fmt.Println()
|
fmt.Println()
|
||||||
table := tablewriter.NewWriter(os.Stdout)
|
table := tablewriter.NewWriter(os.Stdout)
|
||||||
|
|
31
modules/wifi_recon_sort.go
Normal file
31
modules/wifi_recon_sort.go
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
package modules
|
||||||
|
|
||||||
|
type ByChannelSorter []*WiFiStation
|
||||||
|
|
||||||
|
func (a ByChannelSorter) Len() int { return len(a) }
|
||||||
|
func (a ByChannelSorter) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
|
||||||
|
func (a ByChannelSorter) Less(i, j int) bool {
|
||||||
|
if a[i].Channel == a[j].Channel {
|
||||||
|
return a[i].HwAddress < a[j].HwAddress
|
||||||
|
}
|
||||||
|
return a[i].Channel < a[j].Channel
|
||||||
|
}
|
||||||
|
|
||||||
|
type ByEssidSorter []*WiFiStation
|
||||||
|
|
||||||
|
func (a ByEssidSorter) Len() int { return len(a) }
|
||||||
|
func (a ByEssidSorter) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
|
||||||
|
func (a ByEssidSorter) Less(i, j int) bool {
|
||||||
|
if a[i].ESSID() == a[j].ESSID() {
|
||||||
|
return a[i].HwAddress < a[j].HwAddress
|
||||||
|
}
|
||||||
|
return a[i].ESSID() < a[j].ESSID()
|
||||||
|
}
|
||||||
|
|
||||||
|
type BywifiSeenSorter []*WiFiStation
|
||||||
|
|
||||||
|
func (a BywifiSeenSorter) Len() int { return len(a) }
|
||||||
|
func (a BywifiSeenSorter) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
|
||||||
|
func (a BywifiSeenSorter) Less(i, j int) bool {
|
||||||
|
return a[i].LastSeen.After(a[j].LastSeen)
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue