Created
June 21, 2016 09:16
-
-
Save eoldavix/bb712869dde65fe8a2ebd166bf220127 to your computer and use it in GitHub Desktop.
Random hardware MAC file generator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| # coding=utf-8 | |
| import random | |
| def HexGenerator(): | |
| return format(random.randrange(255), '02x') | |
| def MacGenerator(): | |
| return "{}:{}:{}:{}:{}:{};".format(HexGenerator(), | |
| HexGenerator(), | |
| HexGenerator(), | |
| HexGenerator(), | |
| HexGenerator(), | |
| HexGenerator() | |
| ) | |
| def main(): | |
| with open('/tmp/macs', 'w') as f: | |
| for i in range(0,100): | |
| f.write("{}\n".format(MacGenerator())) | |
| if __name__ == '__main__': | |
| main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment