import random
import struct
mac_bin_list = []
mac_hex_list = []
for i in range(1,7):
i = random.randint(0x00,0xff)
mac_bin_list.append(i)
Fake_HW = struct.pack("BBBBBB",mac_bin_list[0], mac_bin_list[1], mac_bin_list[2], mac_bin_list[3], mac_bin_list[4], mac_bin_list[5])
for j in mac_bin_list:
mac_hex_list.append(hex(j))
Hardware = ":".join(mac_hex_list).replace("0x","")
print Hardware
--------------------结果-----------------------------
24:c7:6f:92:2c:42
以上就是本文的全部内容了,希望大家能够喜欢。