genvid.toolbox.NetworkTool

class genvid.toolbox.NetworkTool(**kwargs)

Bases: genvid.toolbox.basetool.BaseTool

Platform abstraction of Network utilities

AF_INET = 2

IPv4 Family

AF_INET6 = 23

IPv6 Family

MAC Address Family

GENVID_DEFAULT_IP = None

The default IP address to use for services. Default to 127.0.0.1.

static get_external_ip()

Return the external IP of the current machine.

get_interface_from_ip(ip, family=<AddressFamily.AF_INET: 2>)

Given an ip address, try to find the the IPInterface containing this IP.

get_ip()

Return the local IP address.

get_nameservers()

Return the list of nameservers on the system.

get_nameservers_linux()

Return the list of nameservers configured in /etc/resolv.conf

get_nameservers_windows()

Return the list of nameservers configured on a Windows system.

static get_network_addresses(interface, family)

Return the list of addresses for this interface.

Args:

interface: The name of the interface.

family: The family type of the addresses.

get_network_interface(ip, family=<AddressFamily.AF_INET: 2>)

Return the network interface associated with an IP address.

Args:

ip: The IP address to match.

family: The family of the IP address (default to AF_INET (IPv4))

static get_network_interfaces()

Return the list of network interfaces on the system