operations capa

operations-net-discovery

Network environment discovery: local interfaces/gateway/listening ports + authorized CIDR sweep (TCP-responsive probing). Assessment, not exploitation. Composes infrastructure-security-scan.

Network environment discovery: local interfaces/gateway/listening ports + authorized CIDR sweep (TCP-responsive probing). Assessment, not exploitation. Composes infrastructure-security-scan.

Tieroperations
Roleunclassified (baselined)
Pathcrates/operations/net-discovery
Edition2021
Targetsnet_report, self_report, operations_net_discovery
Public items28 across 4 modules
Tests29

What it is for

operations-net-discovery — network environment discovery.

Lets an application discover and understand its network environment:

interfaces, the subnets it sits on, its default gateway, and the TCP ports it exposes. Introspecting the machine you already run on is not the dual-use case the sweep guards against.

CIDR the operator has explicitly authorized (see authorize_range).

infrastructure-security-scan for assessment.

Posture: assessment, not exploitation. No payloads, no exploits, no writes — the same posture as infrastructure-security-scan, which this crate composes.

Platforms. Supported on Linux, Windows, and FreeBSD only; OS access is isolated behind the Prober seam (SystemProber in production, testkit::FixtureProber for zero-I/O tests). Building on any other target is a hard error.

Capabilities

Ipv4Cidr

Hand-rolled IPv4 CIDR (u32 math) — no external dependency (Gate 1 decision).

Item
pub struct Ipv4Cidr
Ipv4Cidr :: fn parse(s : & str) -> Result <Self, DiscoverError>
Ipv4Cidr :: fn network(& self) -> Ipv4Addr
Ipv4Cidr :: fn prefix(& self) -> u8
Ipv4Cidr :: fn canonical(& self) -> String
Ipv4Cidr :: fn contains(& self, addr : Ipv4Addr) -> bool
Ipv4Cidr :: fn host_count(& self) -> u64
Ipv4Cidr :: fn hosts(& self) -> Ipv4CidrHosts

Ipv4CidrHosts

Hand-rolled IPv4 CIDR (u32 math) — no external dependency (Gate 1 decision).

Item
pub struct Ipv4CidrHosts
Ipv4CidrHosts :: fn next(& mut self) -> Option <Ipv4Addr>

DiscoverError

Error types. DiscoverError is the crate-level result; ProbeError is the

Item
pub enum DiscoverError

ProbeError

Error types. DiscoverError is the crate-level result; ProbeError is the

Item
pub enum ProbeError

ListeningTool

The I/O seam. All OS access — interface/gateway enumeration, listening-port

Item
pub enum ListeningTool

ProbeOutcome

The I/O seam. All OS access — interface/gateway enumeration, listening-port

Item
pub enum ProbeOutcome
ProbeOutcome :: fn host_reachable(self) -> bool

Prober

The I/O seam. All OS access — interface/gateway enumeration, listening-port

Item
pub trait Prober

RawInterface

The I/O seam. All OS access — interface/gateway enumeration, listening-port

Item
pub struct RawInterface

RawListening

The I/O seam. All OS access — interface/gateway enumeration, listening-port

Item
pub struct RawListening

SystemProber

The I/O seam. All OS access — interface/gateway enumeration, listening-port

Item
pub struct SystemProber
SystemProber :: fn interfaces(& self) -> Result <Vec <RawInterface>, ProbeError>
SystemProber :: fn default_gateway(& self) -> Result <Option <Ipv4Addr>, ProbeError>
SystemProber :: fn listening_raw(& self) -> Result <RawListening, ProbeError>
SystemProber :: fn tcp_connect(& self, addr : SocketAddr, timeout : Duration) -> ProbeOutcome

FixtureProber

Public test harness: a FixtureProber returning canned OS data so the

Item
pub struct FixtureProber
FixtureProber :: fn interfaces(& self) -> Result <Vec <RawInterface>, ProbeError>
FixtureProber :: fn default_gateway(& self) -> Result <Option <Ipv4Addr>, ProbeError>
FixtureProber :: fn listening_raw(& self) -> Result <RawListening, ProbeError>
FixtureProber :: fn tcp_connect(& self, addr : SocketAddr, _timeout : Duration) -> ProbeOutcome

How to use it

From `examples/net_report.rs`:


use data_export::{CsvExporter, ExportColumn, ExportConfig, ExportFormat, JsonExporter};
use operations_net_discovery::{
    authorize_range, local_report, sweep, DiscoverError, LocalNetworkReport, ScanTarget,
    SweepOptions, SystemProber,
};
use serde::Serialize;

#[derive(Serialize)]
struct IfaceRow {
    interface: String,
    up: bool,
    loopback: bool,
    address: String,
    prefix: u8,
    network: String,
}

From `examples/self_report.rs`:


use operations_net_discovery::{local_report, SystemProber};

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let report = local_report(&SystemProber)?;

    println!("default gateway: {:?}", report.default_gateway);

    println!("\ninterfaces:");
    for iface in &report.interfaces {
        let flags = match (iface.is_up, iface.is_loopback) {
            (true, true) => "up,loopback",
            (true, false) => "up",
            (false, _) => "down",
        };
        println!("  {} [{}]", iface.name, flags);
        for a in &iface.ipv4 {
            println!(

Module structure

operations_net_discovery

flowchart TD
  n_operations_net_discovery["operations_net_discovery"]
  n_operations_net_discovery --> n_cidr["cidr"]
  n_operations_net_discovery --> n_error["error"]
  n_operations_net_discovery --> n_prober["prober"]
  n_operations_net_discovery --> n_testkit["testkit"]

Public surface

`cidr`

ItemWhat it is
pub struct Ipv4CidrA canonicalized IPv4 CIDR block.
Ipv4Cidr :: fn parse(s : & str) -> Result <Self, DiscoverError>Parse "a.b.c.d/n", canonicalizing the address down to its network
Ipv4Cidr :: fn network(& self) -> Ipv4AddrThe network address (canonical base of the block).
Ipv4Cidr :: fn prefix(& self) -> u8The prefix length (0..=32).
Ipv4Cidr :: fn canonical(& self) -> StringCanonical "network/prefix" string — stable for authorization/compare.
Ipv4Cidr :: fn contains(& self, addr : Ipv4Addr) -> boolWhether addr falls within this block.
Ipv4Cidr :: fn host_count(& self) -> u64Number of probeable hosts (see hosts for the policy).
Ipv4Cidr :: fn hosts(& self) -> Ipv4CidrHostsIterator over the probeable host addresses
pub struct Ipv4CidrHostsIterator produced by Ipv4Cidr::hosts.
Ipv4CidrHosts :: fn next(& mut self) -> Option <Ipv4Addr>

`error`

ItemWhat it is
pub enum DiscoverErrorCrate-level error.
pub enum ProbeErrorFailure surface of the Prober seam

`prober`

ItemWhat it is
pub struct RawInterfaceA raw interface as reported by the OS (before mapping to Interface).
pub enum ListeningToolWhich OS tool produced a RawListening capture — selects the parser.
pub struct RawListeningRaw stdout of a listening-port tool plus the tool that produced it.
pub enum ProbeOutcomeOutcome of a single TCP-connect probe
ProbeOutcome :: fn host_reachable(self) -> boolWhether this outcome proves the remote host is reachable.
pub trait ProberThe I/O seam
pub struct SystemProberProduction Prober: netdev for interfaces/gateway, the platform's listening-port tool via a strict argument-vector subprocess, and std::net::TcpStream::connect_timeout for sweeps.
SystemProber :: fn interfaces(& self) -> Result <Vec <RawInterface>, ProbeError>
SystemProber :: fn default_gateway(& self) -> Result <Option <Ipv4Addr>, ProbeError>
SystemProber :: fn listening_raw(& self) -> Result <RawListening, ProbeError>
SystemProber :: fn tcp_connect(& self, addr : SocketAddr, timeout : Duration) -> ProbeOutcome

`testkit`

ItemWhat it is
pub struct FixtureProberA Prober backed by canned data
FixtureProber :: fn interfaces(& self) -> Result <Vec <RawInterface>, ProbeError>
FixtureProber :: fn default_gateway(& self) -> Result <Option <Ipv4Addr>, ProbeError>
FixtureProber :: fn listening_raw(& self) -> Result <RawListening, ProbeError>
FixtureProber :: fn tcp_connect(& self, addr : SocketAddr, _timeout : Duration) -> ProbeOutcome

Re-exports. Exported here, defined elsewhere.

ExportDefined in
Ipv4Cidrcidr::Ipv4Cidr
infer_serviceservice::infer_service
to_scan_findingsfindings::to_scan_findings
{ActiveScanGrant,ScanFinding,ScanSeverity,ScanTarget}infrastructure_security_scan::{ActiveScanGrant,ScanFinding,ScanSeverity,ScanTarget}
{DiscoverError,ProbeError}error::{DiscoverError,ProbeError}
{ListeningTool,ProbeOutcome,Prober,RawInterface,RawListening,SystemProber}prober::{ListeningTool,ProbeOutcome,Prober,RawInterface,RawListening,SystemProber}
{authorize_range,sweep,AuthorizedRange,HostReport,PortObservation,SweepOptions,DEFAULT_PORTS,}sweep::{authorize_range,sweep,AuthorizedRange,HostReport,PortObservation,SweepOptions,DEFAULT_PORTS,}
{local_report,IfAddr,Interface,ListeningPort,LocalNetworkReport,Transport}local::{local_report,IfAddr,Interface,ListeningPort,LocalNetworkReport,Transport}

Boundary

Reaches into infrastructure.

Shares tier operations with 40 other crates: operations-approval-workflow, operations-assessments, operations-block-imaging, operations-boot-media, operations-browser-agent-worker, operations-camera-discovery, operations-camera-liveview, operations-camera-registry, … (40 total).

_What this crate deliberately does NOT own is a judgment. No committed registry records one for it, so none is stated here._

Where it sits

Tier (ontology)operations
Architectural role (taxonomy)unclassified (baselined)
Locationcrates/operations/net-discovery
Vocabulary in force (lexicon)current

Tier flow. Which tiers this crate's own edges cross.

flowchart LR
  n_operations["operations"] --> n_infrastructure["infrastructure"]

Dependencies

Runtime, in this workspace.

CrateTierOptionalOnly on
`infrastructure-security-scan`infrastructurenoalways

Runtime, from outside the workspace.

CrateRequirementFeaturesOptionalOnly on
netdev^0.45noalways
serde^1derivenoalways
thiserror^2noalways

Development, in this workspace.

CrateTierOptionalOnly on
`data-export`datanoalways

Development, from outside the workspace.

CrateRequirementFeaturesOptionalOnly on
serde^1derivenoalways
serde_json^1noalways

Build. None.

Depended on by. Nothing in this workspace.

Signal flow — what reaches this crate, and what it reaches.

flowchart LR
  SELF["operations-net-discovery"]
  SELF -->|development| n_data_export["data-export"]
  SELF -->|runtime| n_infrastructure_security_scan["infrastructure-security-scan"]
  classDef self fill:#1f883d,stroke:#1f883d,color:#fff;
  class SELF self;

Feature flags

No Cargo features are defined: every capability is unconditional, so no consumer can receive a half-wired crate.

Targets

KindNameSource
examplenet_report`examples/net_report.rs`
exampleself_report`examples/self_report.rs`
liboperations_net_discovery`src/lib.rs`

Error model

Error typeNamed by
DiscoverErrordeclared, no public signature returns it
ProbeErrordeclared, no public signature returns it

Operational characteristics

PropertyEvidence
async public surfacenone detected
async runtimenone detected
database accessnone detected
network I/Onone detected
unsafe codenone detected
environment variablesnone detected

No unsafe block, unsafe fn, unsafe impl or unsafe trait was found by the parser anywhere in this crate's source.

Configuration

No environment variable is read with a literal name anywhere in this crate. A variable whose key is computed at run time cannot be listed here, and is not claimed to be absent.

No workspace crate depends on this one.

Verification

KindCount
Unit tests29
Integration tests0
Examples2
Doctests0

Evidence by module. How often each public module is named by something executable.

ModuleTestsExamplesConsumers
cidr200
error210
prober620
testkit100

What the tests establish, by name:

Documentation coverage

MeasureDocumentedTotal
Public items with rustdoc1928
Public modules with a //! block44
pie showData
    title Public items with rustdoc
    "Documented" : 19
    "No rustdoc detected" : 9

Metrics

MetricValue
Rust source files10
Source lines1437
Code lines1052
Public API items28
Public modules4
Tests29
Examples2
Cargo features0
Direct runtime dependencies4
Workspace reverse dependencies0
pie showData
    title Public API by kind
    "enum" : 4
    "method" : 17
    "struct" : 6
    "trait" : 1
pie showData
    title Rust source composition
    "Code" : 1052
    "Blank or comment" : 385

Generation

Rendered by tools-corpus corpus readme from repository evidence alone, renderer schema 2, lexicon current. No model, network service or database was consulted. Regenerate with tools-corpus corpus readme --write; verify with --check.

Todas las operations · Manual