403Webshell
Server IP : 198.38.94.13  /  Your IP : 216.73.217.33
Web Server : Apache
System : Linux d4744.dxb1.stableserver.net 5.14.0-611.49.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Apr 21 16:39:08 EDT 2026 x86_64
User : revivere ( 1140)
PHP Version : 8.2.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /opt/saltstack/salt/lib/python3.10/site-packages/salt/modules/netaddress.py
"""
Module for getting information about network addresses.

.. versionadded:: 2016.3.0

:depends: netaddr
"""

__virtualname__ = "netaddress"

try:
    import netaddr

    HAS_NETADDR = True
except ImportError as e:
    HAS_NETADDR = False


def __virtual__():
    """
    Only load if netaddr library exist.
    """
    if not HAS_NETADDR:
        return (
            False,
            "The netaddress execution module cannot be loaded: "
            "netaddr python library is not installed.",
        )
    return __virtualname__


def list_cidr_ips(cidr):
    """
    Get a list of IP addresses from a CIDR.

    CLI Example:

    .. code-block:: bash

        salt myminion netaddress.list_cidr_ips 192.168.0.0/20
    """
    ips = netaddr.IPNetwork(cidr)
    return [str(ip) for ip in list(ips)]


def list_cidr_ips_ipv6(cidr):
    """
    Get a list of IPv6 addresses from a CIDR.

    CLI Example:

    .. code-block:: bash

        salt myminion netaddress.list_cidr_ips_ipv6 192.168.0.0/20
    """
    ips = netaddr.IPNetwork(cidr)
    return [str(ip.ipv6()) for ip in list(ips)]


def cidr_netmask(cidr):
    """
    Get the netmask address associated with a CIDR address.

    CLI Example:

    .. code-block:: bash

        salt myminion netaddress.cidr_netmask 192.168.0.0/20
    """
    ips = netaddr.IPNetwork(cidr)
    return str(ips.netmask)


def cidr_broadcast(cidr):
    """
    Get the broadcast address associated with a CIDR address.

    CLI Example:

    .. code-block:: bash

        salt myminion netaddress.cidr_netmask 192.168.0.0/20
    """
    ips = netaddr.IPNetwork(cidr)
    return str(ips.broadcast)

Youez - 2016 - github.com/yon3zu
LinuXploit