repl.it
Python

No description

fork
loading
Files
  • main.py
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import uuid, textwrap

def getmac(node=None):
    node = node or uuid.getnode()
    x = '0'+hex(node)[2:] # pretty sure this is right
    parts = textwrap.wrap(x, 2) # split every 2 chars
    return ':'.join(parts) # the mac addr

def realgetmac(node=None): # new method
    mac = node or uuid.getnode()
    realmac = ':'.join(("%012X" % mac)[i:i+2] for i in range(0, 12, 2))
    return realmac

if __name__ == '__main__':
    #print(getmac()) # old version
    print(realgetmac())

'''
edit - i wasnt right to put the 0 beforehand but it seems to be missing a digit without
'''