nadzoring.network_base.network_params module

Get network params on Linux, Windows.

The script returns the result of parsing the execution of standard Linux and Windows commands. A dictionary with basic parameters of the default network interface is returned. The basic parameters include: the name of the network interface, local v4 and v6 ip addresses, the default gateway address, and the mac address of the network interface.

On some linux machines, the net-tools package must be installed, because the route command doesn’t work without it (example: Ubuntu): sudo apt install net-tools

In addition to the above package, no third-party libraries are required for the script to work.

nadzoring.network_base.network_params._create_empty_network_info() dict[str, None][source]

Create empty network information dictionary.

nadzoring.network_base.network_params._extract_interface_details(interface_parts: list[str]) dict[str, str | None][source]

Extract detailed information from an interface configuration.

nadzoring.network_base.network_params._find_enabled_interface(config_blocks: list[str]) list[str] | None[source]

Find the first enabled network interface.

nadzoring.network_base.network_params._get_linux_gateway() str | None[source]

Get default gateway on Linux.

nadzoring.network_base.network_params._get_linux_interface_info() dict[str, str | None][source]

Extract interface name and IP addresses on Linux.

nadzoring.network_base.network_params._get_linux_mac_address(interface_name: str | None) str | None[source]

Get MAC address for a specific interface on Linux.

nadzoring.network_base.network_params._get_linux_network_info() dict[str, str | None][source]

Get network information for Linux systems.

nadzoring.network_base.network_params._get_windows_network_info() dict[str, str | None][source]

Get network information for Windows systems.

nadzoring.network_base.network_params._parse_windows_network_configs() list[str][source]

Parse Windows network configuration output.

nadzoring.network_base.network_params.network_param() dict[str, str | None] | None[source]

Get basic network parameters for the current system.

Returns:

Dictionary with network interface information or None if OS not supported.

nadzoring.network_base.network_params.public_ip() str[source]

Getting an external IP address by accessing the service api: https://api.ipify.org/.

Returns:

public IP

Return type:

str