here is a sample code
>>> import fcntl, socket, struct
>>>
>>> def getHwAddr(ifname):
... s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
... info = fcntl.ioctl(s.fileno(), 0x8927, struct.pack('256s',
ifname[:15]))
... return ''.join(['%02x:' % ord(char) for char in info[18:24]])[:-1]
...
>>> print getHwAddr('eth0')
On Thu, Apr 14, 2011 at 5:47 PM, Nitin Kumar <[email protected]> wrote:
> Hi All,
>
> Is anyone aware how to fetch mac machine IP using python?
>
> --
> Nitin K
> _______________________________________________
> BangPypers mailing list
> [email protected]
> http://mail.python.org/mailman/listinfo/bangpypers
>
--
----------------------------
Kind regards
Ruchir Shukla
Phone: +91 9099020687
[email protected]; Ruchir Shukla <http://ruchir-shukla.blogspot.com/>
_______________________________________________
BangPypers mailing list
[email protected]
http://mail.python.org/mailman/listinfo/bangpypers