()
return None
Get the hardware address on Unix by running arp.
Get the hardware address on Unix by running arp.
Get the hardware address on Unix by running arp .
def _arp_getnode():
    """Get the hardware address on Unix by running arp."""
    import os, socket
    try:
        ip_addr = socket.gethostbyname(socket.gethostname())
    except OSError:
        return None

    # Try getting the MAC addr from arp based on our IP address (Solaris).
    mac = _find_mac_near_keyword('arp', '-an', [os.fsencode(ip_addr)], lambda i: -1)
    if mac:
        return mac

    # This works on OpenBSD
    mac = _find_mac_near_keyword('arp', '-an', [os.fsencode(ip_addr)], lambda i: i+1)
    if mac:
        return mac

    # This works on Linux, FreeBSD and NetBSD
    mac = _find_mac_near_keyword('arp', '-an', [os.fsencode('(%s)' % ip_addr)],
                    lambda i: i+2)
    # Return None instead of 0.
    if mac:
        return mac
    return None
def _arp_getnode ( ) : import os , socket try : ip_addr = socket . gethostbyname ( socket . gethostname ( ) ) except OSError : return None # Try getting the MAC addr from arp based on our IP address (Solaris). mac = _find_mac_near_keyword ( 'arp' , '-an' , [ os . fsencode ( ip_addr ) ] , lambda i : - 1 ) if mac : return mac # This works on OpenBSD mac = _find_mac_near_keyword ( 'arp' , '-an' , [ os . fsencode ( ip_addr ) ] , lambda i : i + 1 ) if mac : return mac # This works on Linux, FreeBSD and NetBSD mac = _find_mac_near_keyword ( 'arp' , '-an' , [ os . fsencode ( '(%s)' % ip_addr ) ] , lambda i : i + 2 ) # Return None instead of 0. if mac : return mac return None