0

I want to trigger some functions when specific device connected in my network.

I know my device's mac address.

But I don't know how to locate this device's mac address using python.

Some solutions using shell script, but I want to use python.

Please let me know the solution.

Thank you.

Cloud
  • 125
  • 1
  • 8
  • possible duplicate of [Getting MAC Address](http://stackoverflow.com/questions/159137/getting-mac-address) – Yoel Nov 21 '14 at 09:47
  • @Yoel OP not asking how to get his own mac, Op want when a device is conned to his network he want that device mac address – Hackaholic Nov 21 '14 at 09:48

1 Answers1

1

If you want to locate your local MAC, you can use netifaces package.

import netifaces
netifaces.ifaddresses('eth0')
yegorich
  • 4,653
  • 3
  • 31
  • 37
  • No, not local MAC address. – Cloud Nov 21 '14 at 11:19
  • Is this device broadcasting itself or does it at least require DHCP address? See this post too: http://stackoverflow.com/questions/1750803/obtain-mac-address-from-devices-using-python – yegorich Nov 21 '14 at 11:48