linux - Find mac address on python -


i have searched identifier , tried find mac address connected device on server problem output returns empty example

a = os.popen("arp -a 192.168.6.150 | awk '{print $4}'").readlines()

a empty

i'm working on captive portal page untangle. want mac address ip of device on network. code runs on apache server.

from mod_python import apache mod_python import util 

the following function returns mac or none if mac not found.

import commands def getmac(iface):     mac = commands.getoutput("ifconfig " + iface + "| grep hwaddr | awk '{ print $5 }'")     if len(mac)==17:         return mac  getmac('eth0') 

Comments

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -