How can I get the MAC addresses of machines using python-nmap?
I'm using python-nmap to scan my local network, I can get the ip of several systems but not their MAC addresses.
How can I get the MAC addresses in the scan results?
nm = nmap.PortScanner()
a=nm.scan(hosts=cidr2, arguments='-sP')
for k,v in a['scan'].iteritems():
if str(v['status']['state']) == 'up':
number_thread += 1
print str(v)
try: print str(v['addresses']['ipv4']) + ' => ' + str(v['addresses']['mac'])
except: print str(v['addresses']['ipv4'])