Ready to Start Your Career?

Tutorial: MAC Address Generator Code

Bmsr256 s profile image
By: Bmsr256
August 20, 2017
Today, I will present a random MAC address generator tool written in Python. This code is for educational purposes and you can test this code and learn more about Python programming.MAC is an acronym for Media Access Control address and is a unique identifier assigned to network interfaces (e.g: NIC cards) for communications at the data link layer of a network segment.There is the source code of the generator:`#!/usr/bin/python# *-* coding:utf-8 *-*import randomdef randomMAC():'''generate random MAC address.the first 24 bits are for OUI (Organizationally Unique Identifier).'''mac = [0x00, 0x8c, 0xfa,random.randint(0x00, 0xff),random.randint(0x00, 0xff),random.randint(0x00, 0xff)]return ':'.join(map(lambda x: "%02x" % x, mac))if __name__ == '__main__':print randomMAC()`I hope this code will be helpful to you, if you have some questions then ask me in the comments.
Schedule Demo
Build your Cybersecurity or IT Career
Accelerate in your role, earn new certifications, and develop cutting-edge skills using the fastest growing catalog in the industry