Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- usati = []
- def genera_mac():
- global usati
- while True:
- lettere = list(str.upper('qwertyuiopasdfghjklzxcvbnm'))
- numeri = [1,2,3,4,5,6,7,8,9,0]
- MAC = []
- MacAddress = ''
- for numero in range(6):
- casuale = (random.randint(1,4))
- if casuale == 1:
- MAC.append(str(numeri[random.randint(0,9)]) + str(numeri[random.randint(0,9)]))
- if casuale == 2:
- MAC.append(lettere[random.randint(0,25)] + lettere[random.randint(0,25)])
- if casuale == 3:
- MAC.append(str(numeri[random.randint(0,9)]) + lettere[random.randint(0,25)])
- if casuale == 4:
- MAC.append(lettere[random.randint(0,25)] + str(numeri[random.randint(0,9)]))
- for numero1 in range(6):
- if numero1 == 5:
- MacAddress += MAC[numero1 - 1]
- else:
- MacAddress += MAC[numero1 - 1] + ":"
- if MacAddress in usati:
- continue
- else:
- return MacAddress
- print(genera_mac())
- print(genera_mac())
- print(genera_mac())
- print(genera_mac())
- print(genera_mac())
Add Comment
Please, Sign In to add comment