Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #63710

Re: How to get Mac address of ethernet port?

From "James Harris" <james.harris.1@gmail.com>
Newsgroups comp.lang.python
Subject Re: How to get Mac address of ethernet port?
Date 2014-01-11 15:54 +0000
Organization A noiseless patient Spider
Message-ID <larpf5$3c1$1@dont-email.me> (permalink)
References <6a5ceb3f-021d-4acc-b618-ce53530fa2dd@googlegroups.com> <mailman.5329.1389450993.18130.python-list@python.org>

Show all headers | View raw


"Andriy Kornatskyy" <andriy.kornatskyy@live.com> wrote in message 
news:mailman.5329.1389450993.18130.python-list@python.org...
> Sam,
>
> How about this?
>
> from uuid import getnode as get_mac
> '%012x' % get_mac()

AIUI that will return a mac address even if there isn't one. That may or may 
not suit the OP.

To the OP, depending on what you want to do remember that a machine can have 
more than one mac address and that a mac address can differ from the 
burned-in address (BIA) as some cards allow the effective mac address to be 
changed in software. So it's possible that two machines could show the same 
mac address.

James

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

How to get Mac address of ethernet port? Sam <lightaiyee@gmail.com> - 2014-01-11 06:26 -0800
  Re: How to get Mac address of ethernet port? Andriy Kornatskyy <andriy.kornatskyy@live.com> - 2014-01-11 16:35 +0200
    Re: How to get Mac address of ethernet port? "James Harris" <james.harris.1@gmail.com> - 2014-01-11 15:54 +0000
      Re: How to get Mac address of ethernet port? Roy Smith <roy@panix.com> - 2014-01-11 11:29 -0500
        Re: How to get Mac address of ethernet port? Chris Angelico <rosuav@gmail.com> - 2014-01-12 08:40 +1100
          Re: How to get Mac address of ethernet port? Roy Smith <roy@panix.com> - 2014-01-11 16:55 -0500
            Re: How to get Mac address of ethernet port? Chris Angelico <rosuav@gmail.com> - 2014-01-12 09:08 +1100
            Re: How to get Mac address of ethernet port? Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-01-12 11:22 -0500
  Re: How to get Mac address of ethernet port? Chris Angelico <rosuav@gmail.com> - 2014-01-12 01:38 +1100
  Re: How to get Mac address of ethernet port? Chris Angelico <rosuav@gmail.com> - 2014-01-12 01:52 +1100
  Re: How to get Mac address of ethernet port? Skip Montanaro <skip@pobox.com> - 2014-01-11 09:03 -0600
  Re: How to get Mac address of ethernet port? Michael Torrie <torriem@gmail.com> - 2014-01-11 09:34 -0700
    Re: How to get Mac address of ethernet port? Sam <lightaiyee@gmail.com> - 2014-01-11 17:25 -0800
  Re: How to get Mac address of ethernet port? William Ray Wing <wrw@mac.com> - 2014-01-13 10:42 -0500
  Re: How to get Mac address of ethernet port? Chris Angelico <rosuav@gmail.com> - 2014-01-14 03:47 +1100

csiph-web