pub struct ProbeStats { /* private fields */ }Expand description
What one raw scanner observed about its own run.
A short sweep has three possible causes with different fixes: probes or replies were lost (retransmission’s job); replies arrived after the scan stopped (the deadline is wrong); or replies arrived and went unrecognized (more time or packets will not help).
These counters separate them. sends_attempted
against segments_seen bounds the first,
stop_reason against
last_reply bounds the second, and
segments_off_target with
replies_without_rtt bounds the third.
A reply the kernel discards because the capture buffer was full reaches no counter
here, so capture is carried to tell receive-path loss from
network loss.
Instrumentation about the scan; nothing here changes what is reported about a host.
Implementations§
Source§impl ProbeStats
impl ProbeStats
Sourcepub fn scanner(&self) -> ScannerKind
pub fn scanner(&self) -> ScannerKind
The strategy these counters belong to.
Sourcepub fn targets(&self) -> u128
pub fn targets(&self) -> u128
How many targets this scanner owned: addresses for a discovery sweep,
(address, port) probes for a port scan.
Sourcepub fn stop_reason(&self) -> StopReason
pub fn stop_reason(&self) -> StopReason
Why the receive loop stopped.
Sourcepub fn sends_attempted(&self) -> u64
pub fn sends_attempted(&self) -> u64
Probes the scanner tried to put on the wire.
Sourcepub fn achieved_send_rate(&self) -> Option<f64>
pub fn achieved_send_rate(&self) -> Option<f64>
Probes per second the scanner put on the wire over its whole run:
sends_attempted over
elapsed. None for a run with no time to divide by.
Compare with the configured rate. The send timer never makes up a missed tick, since catching up would be a burst, so a busy run sends slower than asked.
Sourcepub fn sends_failed(&self) -> u64
pub fn sends_failed(&self) -> u64
Of those, ones that never left this host: the sender refused them or could not
reach their address. Unreachable addresses are in the phase’s
unroutable list.
Sourcepub fn sends_witnessed(&self) -> u64
pub fn sends_witnessed(&self) -> u64
How many probes were watched leaving on the wire. Read against
sends_attempted, and only when non-zero: the
gap is probes the OS took and dropped. Zero means no egress capture.
Sourcepub fn segments_seen(&self) -> u64
pub fn segments_seen(&self) -> u64
Segments the capture handed up, before any of the scanner’s own checks.
Sourcepub fn window(&self) -> Option<WindowSummary>
pub fn window(&self) -> Option<WindowSummary>
What this run’s congestion window did, for a scanner paced by one.
Tells “these ports drop probes” from “this scan was outrun”. A run whose window bottomed out with most probes unanswered could not ask, which says nothing about a firewall.
None for a scanner that paces itself some other way.
Sourcepub fn segments_off_target(&self) -> u64
pub fn segments_off_target(&self) -> u64
Segments from an address outside this scan’s target set. Expected to be small; a large count means the capture filter is admitting other traffic.
Sourcepub fn replies_without_rtt(&self) -> u64
pub fn replies_without_rtt(&self) -> u64
In-set replies that answered no outstanding probe, so they proved a host alive but yielded no round-trip sample. Duplicates land here, and so does a correlation bug.
Sourcepub fn refusals_unattributed(&self) -> u64
pub fn refusals_unattributed(&self) -> u64
ICMP refusals among replies_without_rtt
that quoted too little of the probe to name its attempt.
Anyone who knows the source port can forge a refusal naming the ports, so one that cannot name the attempt settles nothing, and the port keeps what its retries conclude. This counts them. A sender quoting only the eight bytes RFC 792 guarantees omits an ACK, window or Maimon scan’s nonce, and every INIT’s.
Sourcepub fn hosts_found(&self) -> u64
pub fn hosts_found(&self) -> u64
Targets a reply resolved, counted once each.
In the unit of targets: a host for a discovery sweep, an
(address, port) probe for a port scan.
Against targets it is coverage; against stop_reason and
last_reply it says whether the run was still finding things
when it ended.
Sourcepub fn answered_on(&self) -> &[u64]
pub fn answered_on(&self) -> &[u64]
Found hosts by the attempt whose reply revealed them.
Index i counts hosts answered on attempt i + 1; the last slot counts
attempt ATTEMPTS_COUNTED or later, so a hand-raised retry budget
still has somewhere to land.
Shows whether retransmission earns its traffic.
Sourcepub fn answered_unattributed(&self) -> u64
pub fn answered_unattributed(&self) -> u64
Found hosts whose reply named no attempt: it arrived after the probe had been written off, or carried nothing to match against.
Sourcepub fn first_reply(&self) -> Option<Duration>
pub fn first_reply(&self) -> Option<Duration>
How far into the run the first host was credited.
Sourcepub fn last_reply(&self) -> Option<Duration>
pub fn last_reply(&self) -> Option<Duration>
How far into the run the last host was credited. Close to
elapsed on a run that stopped for
DeadlineExpired means the scan was still
finding hosts when it ran out of time.
Sourcepub fn found_at(&self) -> &[u64]
pub fn found_at(&self) -> &[u64]
Hosts by how far into the run they were credited, bucketed by
BUCKET_BOUNDS_MS. Index i counts hosts found at or under
BUCKET_BOUNDS_MS[i] milliseconds; the final slot counts everything
later than the last bound.
Sourcepub fn capture(&self) -> Option<CaptureCounts>
pub fn capture(&self) -> Option<CaptureCounts>
What the kernel capture reported. None for a synthetic receive stream.
Source§impl ProbeStats
impl ProbeStats
Sourcepub fn from_parts(parts: ProbeStatsParts) -> Self
pub fn from_parts(parts: ProbeStatsParts) -> Self
Rebuilds probe statistics from what was recorded of them.
Each distribution is read for the slots this build counts: extra slots are dropped and missing ones read as zero, so a record from a build with more slots still reads. A caller building these by hand sizes them from the two constants.
Trait Implementations§
Source§impl Clone for ProbeStats
impl Clone for ProbeStats
Source§impl Debug for ProbeStats
impl Debug for ProbeStats
impl Eq for ProbeStats
Source§impl From<&ProbeStats> for ProbeStatsRecord
impl From<&ProbeStats> for ProbeStatsRecord
Source§fn from(stats: &ProbeStats) -> Self
fn from(stats: &ProbeStats) -> Self
Source§impl From<&ProbeStatsRecord> for ProbeStats
impl From<&ProbeStatsRecord> for ProbeStats
Source§fn from(record: &ProbeStatsRecord) -> Self
fn from(record: &ProbeStatsRecord) -> Self
Source§impl PartialEq for ProbeStats
impl PartialEq for ProbeStats
impl StructuralPartialEq for ProbeStats
Auto Trait Implementations§
impl Freeze for ProbeStats
impl RefUnwindSafe for ProbeStats
impl Send for ProbeStats
impl Sync for ProbeStats
impl Unpin for ProbeStats
impl UnsafeUnpin for ProbeStats
impl UnwindSafe for ProbeStats
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more