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
impl TargetScope
Sourcepub fn from_ip_set(ips: &mut IpSet, exclusions: &Exclusions) -> Self
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.
Sourcepub fn listening_on(links: Vec<Zone>, exclusions: &Exclusions) -> Self
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.
Sourcepub fn from_target_map(targets: &mut TargetMap, exclusions: &Exclusions) -> Self
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.
Sourcepub fn probes(&self) -> Option<u128>
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.
Sourcepub fn links(&self) -> &[Zone]
pub fn links(&self) -> &[Zone]
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.
Sourcepub fn listened(&self) -> &[Zone]
pub fn listened(&self) -> &[Zone]
The links this phase read traffic from without probing them.
Never coverage. See listening_on.
Sourcepub fn swept(&self, zone: Option<&Zone>) -> bool
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.
Sourcepub fn ports(&self) -> &PortScope
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.
Sourcepub fn protocols(&self) -> &[Protocol]
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.
Sourcepub fn excluded(&self) -> &[IpRange]
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.
Sourcepub fn withheld(&self) -> u128
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
impl TargetScope
Sourcepub fn from_parts(parts: ScopeParts) -> Self
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
impl Clone for TargetScope
Source§impl Debug for TargetScope
impl Debug for TargetScope
impl Eq for TargetScope
Source§impl From<&ScopeRecord> for TargetScope
impl From<&ScopeRecord> for TargetScope
Source§fn from(record: &ScopeRecord) -> Self
fn from(record: &ScopeRecord) -> Self
Source§impl From<&TargetScope> for ScopeRecord
impl From<&TargetScope> for ScopeRecord
Source§fn from(scope: &TargetScope) -> Self
fn from(scope: &TargetScope) -> Self
Source§impl PartialEq for TargetScope
impl PartialEq for TargetScope
impl StructuralPartialEq for TargetScope
Auto Trait Implementations§
impl Freeze for TargetScope
impl RefUnwindSafe for TargetScope
impl Send for TargetScope
impl Sync for TargetScope
impl Unpin for TargetScope
impl UnsafeUnpin for TargetScope
impl UnwindSafe for TargetScope
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