Exemple #1
0
def find_addrs_listening_on_port(port, kind='inet'):
    """Return the list of IP addresses which are listening
    on the specified port.
    """
    listening = []
    for connection in psutil.net_connections(kind):
        if (connection.status == psutil.CONN_LISTEN and
                connection.laddr[1] == int(port)):
            listening.append(connection.laddr[0])
    return listening
Exemple #2
0
def find_addrs_listening_on_port(port, kind='inet'):
    """Return the list of IP addresses which are listening
    on the specified port.
    """
    listening = []
    for connection in psutil.net_connections(kind):
        if (connection.status == psutil.CONN_LISTEN
                and connection.laddr[1] == int(port)):
            listening.append(connection.laddr[0])
    return listening