Created
April 16, 2013 17:35
-
-
Save maltzsama/5397874 to your computer and use it in GitHub Desktop.
mac address python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| import socket | |
| fd = socket.socket(socket.AF_PACKET, socket.SOCK_RAW) | |
| fd.bind(('eth0', 9999)) | |
| mac = fd.getsockname()[-1] | |
| print ':'.join(['%02x' % ord(n) for n in mac]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment