一个用于生成大量mac地址的python脚本
import random
def generate_mac_address():
mac = [random.choice('0123456789ABCDEF') for _ in range(12)]
p = 2
for i in range(5):
mac.insert(p, '-')
p += 3
return ''.join(mac)
num_addresses = 310000
mac_addresses = set()
while len(mac_addresses) < num_addresses:
mac = generate_mac_address()
mac_addresses.add(mac)
with open('mac_addresses.csv', 'w') as file:
for mac in mac_addresses:
file.write(mac + '\n')