Reputation: 21
Hi I am trying to capture the mac address of the client machine from python or java.I tried from java but no luck.its printing only for server mac address.I need client mac address.I tried some methods in python.
from uuid import getnode as get_mac
mac = get_mac()
The above code print uuid number of the machine.But I think it works only for server machine.I need to capture for client machine.Any help will be appreciated.
Upvotes: 0
Views: 2712
Reputation: 1563
You can use system interfaces address file
def getmacaddress(interface):
macaddress = open('/sys/class/net/'+interface+'/address').readline()
return macaddress[0:17]
call this using MACADDRESS = getmacaddress("wlan0")
This will return your system macaddress.
Upvotes: 0