pub struct Progress { /* private fields */ }Expand description
How far a scan has got through its plan.
A cheap, cloneable view of the counters the strategies settle their targets against, cheap enough to read on every frame: a read is a pair of atomic loads and one short lock.
settled counts what the strategies have finished with, on
every scan, journalled or not. planned is the size of the
plan, known only where the targets can be numbered: an IPv6 range of a /64
or wider cannot be, and a listen session has no plan.
Where the plan cannot be counted, fraction answers
None, and a front end can show a running count.
A scan that runs to the end settles every target in its plan and the fraction reaches 1.0. One stopped early leaves it short.
let progress = session.progress();
match progress.planned() {
Some(planned) => println!("{} of {planned} targets", progress.settled()),
None => println!("{} targets settled", progress.settled()),
}Implementations§
Source§impl Progress
impl Progress
Sourcepub fn stage_done(&self) -> u64
pub fn stage_done(&self) -> u64
How many units of the current stage are finished.
The unit is the stage’s own: ports for Stage::Services, detection
runs for Stage::Detections, TLS ports for Stage::Tls. Zero for a
stage that does not count itself.
A unit is counted once the stage is done with it, whatever the result. One passed over because its host had spent its budget or the scan was stopped is not, so a stage can end short of its total.
Sourcepub fn stage_total(&self) -> Option<u64>
pub fn stage_total(&self) -> Option<u64>
How many units the current stage holds, for one that knew its size when it began.
Sourcepub fn settled(&self) -> u64
pub fn settled(&self) -> u64
How many of the plan’s targets the scan has finished with, counting those an earlier sitting settled and this one resumed past.
A target is settled once no further probing could change its verdict: it answered, its retry budget was spent on silence, or its host was found down and no probe was owed. A target the scan stopped before reaching is not counted.
Sourcepub const fn planned(&self) -> Option<u64>
pub const fn planned(&self) -> Option<u64>
How many targets the plan holds, or None for a plan whose targets
cannot all be numbered.
Fixed for the life of the scan. A resumed sitting reports the size of the
whole job, matching settled.
Sourcepub fn remaining(&self) -> Option<u64>
pub fn remaining(&self) -> Option<u64>
How many targets are still to settle, or None where the plan cannot be
counted.
Sourcepub fn fraction(&self) -> Option<f64>
pub fn fraction(&self) -> Option<f64>
How far through the current stage the scan is, from 0.0 to 1.0.
A stage that counted itself answers for itself. The stage the plan was
drawn for answers with what the plan has settled, including a resumed
sitting’s earlier work. Any other stage that never learned its size
answers None. That includes a port scan’s liveness pass, which settles
none of the plan’s address-and-port pairs.
The plan’s figure counts the work of probing, so a target settled without a probe counts on neither side: one whose host the liveness pass found silent, one the exclusions withhold, one no route leads to, and one on a host with no verdict, left for a later sitting. Those settle as fast as the walk passes them; counted as work, a range with five live hosts behind a thousand ports would read nearly finished within a second.
An empty stage is complete, and the result is capped at 1.0.
Sourcepub fn overall(&self) -> Option<(u64, u64)>
pub fn overall(&self) -> Option<(u64, u64)>
Where the scan stands across every stage it expects to run, as a position over a total.
One figure for a whole run, so a bar drawn from it fills once. It only moves forward: an expected stage with nothing to do is stepped over, so the figure can jump, and a stage that grows after it began, as service detection does when its second protocol’s run starts, holds the figure until the work catches up. It reads whole only once the last expected stage is behind the scan.
The expected stages are a superset: whether services, detections and TLS have anything to do depends on the ports found.
None for a session that was never told which stages to expect. See
SessionBuilder::staging.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Progress
impl RefUnwindSafe for Progress
impl Send for Progress
impl Sync for Progress
impl Unpin for Progress
impl UnsafeUnpin for Progress
impl UnwindSafe for Progress
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<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