| 1 | package net_sniffscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/net_sniff`/ |
| 2 | |
| 3 | import ( |
| 4 | "github.com/bettercap/bettercap/logscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/log`/" |
| 5 | "timescip-go gomod github.com/golang/go/src go1.16 time/" |
| 6 | ) |
| 7 | |
| 8 | type SnifferStatsscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/net_sniff`/SnifferStats# struct { |
| 9 | NumLocalscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/net_sniff`/SnifferStats#NumLocal. uint64 |
| 10 | NumMatchedscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/net_sniff`/SnifferStats#NumMatched. uint64 |
| 11 | NumDumpedscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/net_sniff`/SnifferStats#NumDumped. uint64 |
| 12 | NumWrotescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/net_sniff`/SnifferStats#NumWrote. uint64 |
| 13 | Startedscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/net_sniff`/SnifferStats#Started. timescip-go gomod github.com/golang/go/src go1.16 time/.Timescip-go gomod github.com/golang/go/src go1.16 time/Time# |
| 14 | FirstPacketscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/net_sniff`/SnifferStats#FirstPacket. timescip-go gomod github.com/golang/go/src go1.16 time/.Timescip-go gomod github.com/golang/go/src go1.16 time/Time# |
| 15 | LastPacketscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/net_sniff`/SnifferStats#LastPacket. timescip-go gomod github.com/golang/go/src go1.16 time/.Timescip-go gomod github.com/golang/go/src go1.16 time/Time# |
| 16 | } |
| 17 | |
| 18 | func NewSnifferStatsscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/net_sniff`/NewSnifferStats().() *SnifferStatsscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/net_sniff`/SnifferStats# { |
| 19 | return &SnifferStatsscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/net_sniff`/SnifferStats#{ |
| 20 | NumLocalscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/net_sniff`/SnifferStats#NumLocal.: 0, |
| 21 | NumMatchedscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/net_sniff`/SnifferStats#NumMatched.: 0, |
| 22 | NumDumpedscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/net_sniff`/SnifferStats#NumDumped.: 0, |
| 23 | NumWrotescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/net_sniff`/SnifferStats#NumWrote.: 0, |
| 24 | Startedscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/net_sniff`/SnifferStats#Started.: timescip-go gomod github.com/golang/go/src go1.16 time/.Nowscip-go gomod github.com/golang/go/src go1.16 time/Now().(), |
| 25 | FirstPacketscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/net_sniff`/SnifferStats#FirstPacket.: timescip-go gomod github.com/golang/go/src go1.16 time/.Timescip-go gomod github.com/golang/go/src go1.16 time/Time#{}, |
| 26 | LastPacketscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/net_sniff`/SnifferStats#LastPacket.: timescip-go gomod github.com/golang/go/src go1.16 time/.Timescip-go gomod github.com/golang/go/src go1.16 time/Time#{}, |
| 27 | } |
| 28 | } |
| 29 | |
| 30 | func (s *SnifferStatsscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/net_sniff`/SnifferStats#) Printscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/net_sniff`/SnifferStats#Print().() error { |
| 31 | first := "never" |
| 32 | last := "never" |
| 33 | |
| 34 | if !s.FirstPacketscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/net_sniff`/SnifferStats#FirstPacket..IsZeroscip-go gomod github.com/golang/go/src go1.16 time/Time#IsZero().() { |
| 35 | first = s.FirstPacketscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/net_sniff`/SnifferStats#FirstPacket..Stringscip-go gomod github.com/golang/go/src go1.16 time/Time#String().() |
| 36 | } |
| 37 | if !s.LastPacketscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/net_sniff`/SnifferStats#LastPacket..IsZeroscip-go gomod github.com/golang/go/src go1.16 time/Time#IsZero().() { |
| 38 | last = s.LastPacketscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/net_sniff`/SnifferStats#LastPacket..Stringscip-go gomod github.com/golang/go/src go1.16 time/Time#String().() |
| 39 | } |
| 40 | |
| 41 | logscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/log`/.Infoscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/log`/Info().("Sniffer Started : %s", s.Startedscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/net_sniff`/SnifferStats#Started.) |
| 42 | logscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/log`/.Infoscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/log`/Info().("First Packet Seen : %s", first) |
| 43 | logscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/log`/.Infoscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/log`/Info().("Last Packet Seen : %s", last) |
| 44 | logscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/log`/.Infoscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/log`/Info().("Local Packets : %d", s.NumLocalscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/net_sniff`/SnifferStats#NumLocal.) |
| 45 | logscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/log`/.Infoscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/log`/Info().("Matched Packets : %d", s.NumMatchedscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/net_sniff`/SnifferStats#NumMatched.) |
| 46 | logscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/log`/.Infoscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/log`/Info().("Dumped Packets : %d", s.NumDumpedscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/net_sniff`/SnifferStats#NumDumped.) |
| 47 | logscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/log`/.Infoscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/log`/Info().("Wrote Packets : %d", s.NumWrotescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/net_sniff`/SnifferStats#NumWrote.) |
| 48 | |
| 49 | return nil |
| 50 | } |