linux, python, get, mac addres, all inteface
1
2
3
4
5
6
7
8
9
10
11
|
devs = os.listdir( '/sys/class/net' ) devs.remove( 'lo' ) mac_addr = list () for dev in devs: f = open ( '/sys/class/net/%s/address' % dev) mac = f.read() f.close() mac_addr.append( dict ([[ 'interface' ,dev],[ 'address' ,mac.strip( '\n' )]])) print mac_addr |