Skip to main content

TargetScope

Struct TargetScope 

Source
pub struct TargetScope { /* private fields */ }
Expand description

What a phase was asked to cover, and what it was forbidden to.

The ranges are the merged form the engine iterated, so addresses counts distinct addresses and a report saying a sweep covered 254 hosts can be trusted.

ranges is what was walked after the exclusion policy, and excluded is the policy. Together they make the report evidence of scope: no host in it may fall inside the excluded ranges.

Implementations§

Source§

impl TargetScope

Source

pub fn from_ip_set(ips: &mut IpSet, exclusions: &Exclusions) -> Self

The scope of a discovery sweep, which has no port dimension.

Canonicalizes the set, so the recorded ranges are the merged ones the sweep iterates.

ips comes back with everything exclusions forbids removed, and the scope records what that cost. Applying and recording are one call (hence &mut) so neither can happen without the other.

Pass Exclusions::none where no policy is in force.

Source

pub fn listening_on(links: Vec<Zone>, exclusions: &Exclusions) -> Self

The scope of a phase that sent nothing and read what links carried.

Covers no address: a listener sent nothing, so it can report no address as empty, and a comparison will not read a quiet host as one that disappeared. The links are recorded as listened, not links.

exclusions is recorded to show the policy; it is enforced where findings are recorded.

Source

pub fn from_target_map(targets: &mut TargetMap, exclusions: &Exclusions) -> Self

The scope of a port scan, which pairs addresses with ports.

probes counts address, port and protocol combinations, or is None when the count overflows.

targets comes back narrowed, as in from_ip_set; a unit left with no address is dropped.

Source

pub fn ranges(&self) -> &[IpRange]

The address ranges covered, in ascending order.

Source

pub fn addresses(&self) -> u128

How many distinct addresses were in scope.

Source

pub fn probes(&self) -> Option<u128>

How many address/port/protocol combinations were in scope, or None for a discovery sweep and for a target set too large to count.

The links this phase swept whole, by the interface each is on.

A sweep of a local segment covers more than ranges: every IPv6 neighbour must answer an all-nodes solicitation, including hosts nobody could name in advance.

Recorded by interface, since fe80::/64 in ranges would make addresses read eighteen quintillion.

Empty for every port scan and every sweep of a routed range.

Source

pub fn listened(&self) -> &[Zone]

The links this phase read traffic from without probing them.

Never coverage. See listening_on.

Source

pub fn swept(&self, zone: Option<&Zone>) -> bool

Whether this phase swept the link a host was found on.

Asked of the link, not the address: a host answering an all-nodes solicitation is often keyed under a global address.

zone is the interface the host was found on. A host with no zone was not found on a link and is not claimed.

Source

pub fn ports(&self) -> &PortScope

Which ports the phase walked, and whether it walked the same ones for every address.

probes counts the combinations; this says which ports they were.

Source

pub fn protocols(&self) -> &[Protocol]

The transport protocols the phase was asked about, deduplicated and in ascending Protocol order, which puts TCP before UDP.

Empty for a discovery sweep, whose probes the strategy chooses.

Source

pub fn excluded(&self) -> &[IpRange]

The address ranges the phase was forbidden to probe, in ascending order.

The exclusion policy in force, merged. Empty means no policy was set; a policy that withheld nothing shows as withheld returning zero.

No host in the report may fall inside these ranges, which a reader can check.

Also holds other addresses of an excluded machine heard during the phase; see the machine an address names.

Source

pub fn withheld(&self) -> u128

How many addresses the exclusion policy took out of this phase.

The overlap between the policy and what this phase would have asked: targets the policy names or ties to an excluded machine, neighbour-table candidates it kept from a sweep, and addresses heard from an excluded machine’s hardware. Each is among the excluded or the targets, so the count and the list agree. Zero for a policy naming ground the phase would never walk, or for input an earlier phase already narrowed.

Tells a policy that was applied from one merely configured.

Source§

impl TargetScope

Source

pub fn from_parts(parts: ScopeParts) -> Self

Rebuilds a scope from what was recorded of it.

Applies no policy, unlike from_ip_set: the exclusions were applied when the scope was first computed.

Trait Implementations§

Source§

impl Clone for TargetScope

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 TargetScope

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Eq for TargetScope

Source§

impl From<&ScopeRecord> for TargetScope

Source§

fn from(record: &ScopeRecord) -> Self

Converts to this type from the input type.
Source§

impl From<&TargetScope> for ScopeRecord

Source§

fn from(scope: &TargetScope) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for TargetScope

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for TargetScope

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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. 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