()
Get the hardware address on Unix by running netstat.
Get the hardware address on Unix by running netstat.
Get the hardware address on Unix by running netstat .
def _netstat_getnode():
    """Get the hardware address on Unix by running netstat."""
    # This might work on AIX, Tru64 UNIX and presumably on IRIX.
    try:
        pipe = _popen('netstat', '-ia')
        if not pipe:
            return
        with pipe:
            words = pipe.readline().rstrip().split()
            try:
                i = words.index('Address')
            except ValueError:
                return
            for line in pipe:
                try:
                    words = line.rstrip().split()
                    word = words[i]
                    if len(word) == 17 and word.count(':') == 5:
                        mac = int(word.replace(':', ''), 16)
                        if mac:
                            return mac
                except (ValueError, IndexError):
                    pass
    except OSError:
        pass
def _netstat_getnode ( ) : # This might work on AIX, Tru64 UNIX and presumably on IRIX. try : pipe = _popen ( 'netstat' , '-ia' ) if not pipe : return with pipe : words = pipe . readline ( ) . rstrip ( ) . split ( ) try : i = words . index ( 'Address' ) except ValueError : return for line in pipe : try : words = line . rstrip ( ) . split ( ) word = words [ i ] if len ( word ) == 17 and word . count ( ':' ) == 5 : mac = int ( word . replace ( ':' , '' ) , 16 ) if mac : return mac except ( ValueError , IndexError ) : pass except OSError : pass