Skip to main content

Progress

Struct Progress 

Source
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

Source

pub fn stage(&self) -> Stage

What the scan is working on right now.

Source

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.

Source

pub fn stage_total(&self) -> Option<u64>

How many units the current stage holds, for one that knew its size when it began.

Source

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.

Source

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.

Source

pub fn remaining(&self) -> Option<u64>

How many targets are still to settle, or None where the plan cannot be counted.

Source

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.

Source

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.

Source

pub fn counted(&self) -> Option<(u64, u64)>

The two figures fraction divides.

For a bar of a fixed number of cells: dividing in integers keeps the cells and the percentage agreeing, where one f64 can round a bar full beside a figure that reads 99%.

Trait Implementations§

Source§

impl Clone for Progress

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Progress

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more