diff --git a/modules/net_recon_show.go b/modules/net_recon_show.go index 4cc17b3d..0db24319 100644 --- a/modules/net_recon_show.go +++ b/modules/net_recon_show.go @@ -4,6 +4,7 @@ import ( "fmt" "os" "sort" + "time" "github.com/evilsocket/bettercap-ng/core" "github.com/evilsocket/bettercap-ng/net" @@ -13,6 +14,11 @@ import ( "github.com/olekukonko/tablewriter" ) +var ( + aliveTimeInterval = time.Duration(10) * time.Second + presentTimeInterval = time.Duration(1) * time.Minute +) + type ProtoPair struct { Protocol string Hits uint64 @@ -89,6 +95,16 @@ func (d *Discovery) Show(by string) error { 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{ t.IpAddress, t.HwAddress, @@ -96,7 +112,7 @@ func (d *Discovery) Show(by string) error { t.Vendor, humanize.Bytes(traffic.Sent), humanize.Bytes(traffic.Received), - t.LastSeen.Format("15:04:05"), + seen, } }