mirror of
https://github.com/bettercap/bettercap
synced 2025-08-19 21:13:18 -07:00
new: net.show.filter, net.show.limit, net.show.sort and net.show.sort_by parameters to control net.show
This commit is contained in:
parent
431e84ea79
commit
28f8586abb
4 changed files with 178 additions and 29 deletions
|
@ -17,11 +17,27 @@ func (a ByAddressSorter) Less(i, j int) bool {
|
|||
return a[i].IpAddressUint32 < a[j].IpAddressUint32
|
||||
}
|
||||
|
||||
type ByIpSorter []*network.Endpoint
|
||||
|
||||
func (a ByIpSorter) Len() int { return len(a) }
|
||||
func (a ByIpSorter) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
|
||||
func (a ByIpSorter) Less(i, j int) bool {
|
||||
return a[i].IpAddressUint32 < a[j].IpAddressUint32
|
||||
}
|
||||
|
||||
type ByMacSorter []*network.Endpoint
|
||||
|
||||
func (a ByMacSorter) Len() int { return len(a) }
|
||||
func (a ByMacSorter) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
|
||||
func (a ByMacSorter) Less(i, j int) bool {
|
||||
return a[i].HwAddress < a[j].HwAddress
|
||||
}
|
||||
|
||||
type BySeenSorter []*network.Endpoint
|
||||
|
||||
func (a BySeenSorter) Len() int { return len(a) }
|
||||
func (a BySeenSorter) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
|
||||
func (a BySeenSorter) Less(i, j int) bool { return a[i].LastSeen.After(a[j].LastSeen) }
|
||||
func (a BySeenSorter) Less(i, j int) bool { return a[i].LastSeen.Before(a[j].LastSeen) }
|
||||
|
||||
type BySentSorter []*network.Endpoint
|
||||
|
||||
|
@ -43,7 +59,7 @@ func (a BySentSorter) Less(i, j int) bool {
|
|||
bTraffic = &packets.Traffic{}
|
||||
}
|
||||
|
||||
return bTraffic.Sent < aTraffic.Sent
|
||||
return bTraffic.Sent > aTraffic.Sent
|
||||
}
|
||||
|
||||
type ByRcvdSorter []*network.Endpoint
|
||||
|
@ -66,5 +82,5 @@ func (a ByRcvdSorter) Less(i, j int) bool {
|
|||
bTraffic = &packets.Traffic{}
|
||||
}
|
||||
|
||||
return bTraffic.Received < aTraffic.Received
|
||||
return bTraffic.Received > aTraffic.Received
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue