nadzoring.commands.network_commands module

Network base CLI commands.

nadzoring.commands.network_commands._parse_port_specification(mode: str, ports: str | None) tuple[list[int] | None, tuple[int, int] | None][source]

Parse a port specification string into custom ports or a range.

Parameters:
  • mode – Scan mode string; only "custom" triggers parsing.

  • ports – Raw port string such as "22,80,443" or "1-1024".

Returns:

Two-tuple of (custom_ports, port_range) where exactly one element is non-None when mode == "custom" and ports is provided, and both are None otherwise.

Raises:

click.BadParameter – When the port string cannot be parsed.