mirror of
https://github.com/bettercap/bettercap
synced 2025-08-20 13:33:21 -07:00
new: endpoints seen since less than 10 seconds are marked as bold and not seen after 1 minute are marked as dim
This commit is contained in:
parent
fd31ee1823
commit
c332250afa
1 changed files with 17 additions and 1 deletions
|
@ -4,6 +4,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
"sort"
|
"sort"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/evilsocket/bettercap-ng/core"
|
"github.com/evilsocket/bettercap-ng/core"
|
||||||
"github.com/evilsocket/bettercap-ng/net"
|
"github.com/evilsocket/bettercap-ng/net"
|
||||||
|
@ -13,6 +14,11 @@ import (
|
||||||
"github.com/olekukonko/tablewriter"
|
"github.com/olekukonko/tablewriter"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var (
|
||||||
|
aliveTimeInterval = time.Duration(10) * time.Second
|
||||||
|
presentTimeInterval = time.Duration(1) * time.Minute
|
||||||
|
)
|
||||||
|
|
||||||
type ProtoPair struct {
|
type ProtoPair struct {
|
||||||
Protocol string
|
Protocol string
|
||||||
Hits uint64
|
Hits uint64
|
||||||
|
@ -89,6 +95,16 @@ func (d *Discovery) Show(by string) error {
|
||||||
traffic = &packets.Traffic{}
|
traffic = &packets.Traffic{}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
seen := t.LastSeen.Format("15:04:05")
|
||||||
|
sinceLastSeen := time.Since(t.LastSeen)
|
||||||
|
if sinceLastSeen <= aliveTimeInterval {
|
||||||
|
seen = core.Bold(seen)
|
||||||
|
} else if sinceLastSeen <= presentTimeInterval {
|
||||||
|
|
||||||
|
} else {
|
||||||
|
seen = core.Dim(seen)
|
||||||
|
}
|
||||||
|
|
||||||
data[i] = []string{
|
data[i] = []string{
|
||||||
t.IpAddress,
|
t.IpAddress,
|
||||||
t.HwAddress,
|
t.HwAddress,
|
||||||
|
@ -96,7 +112,7 @@ func (d *Discovery) Show(by string) error {
|
||||||
t.Vendor,
|
t.Vendor,
|
||||||
humanize.Bytes(traffic.Sent),
|
humanize.Bytes(traffic.Sent),
|
||||||
humanize.Bytes(traffic.Received),
|
humanize.Bytes(traffic.Received),
|
||||||
t.LastSeen.Format("15:04:05"),
|
seen,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue