mm

There is a python script which convert and copy a simple string in a mac adress.

This utility is useful when you work with a lot of mac adress:

#!/usr/bin/python
# Author: samba
# Date: 2011-10-07
# Version 0.1 - License:  GPLv3
 
import sys, string, re, pygtk, gtk
pygtk.require('2.0')
from optparse import OptionParser
 
clipboard = gtk.clipboard_get()
 
p=OptionParser()
p.add_option("-l","--lower",default=True,action="store_true", help="Print MAC Address in lower case)")
p.add_option("-a","--append",default=False,action="store_true", help="Append MAC Address Viasat type)")
p.add_option("-u","--upper",default=False,action="store_true",help="Print MAC Address in UPPER case")
p.add_option("-d","--dot",default=False,action="store_true",help="Print MAC Address with:some:double:dots")
p.add_option("-c","--clean",default=False,action="store_true",help="Print Mac Address removing the double dot")
(opt, args) = p.parse_args()
 
if (len(args)==0):
        mac = raw_input("Inserisci il Mac: ")
else:
        mac = args.pop(0)
vendor="123456"
if(opt.lower):
        mac = mac.lower()
if(opt.append):
        mac = vendor + mac
if(opt.upper):
        mac = mac.upper()
if(opt.clean):
        mac = mac.replace(":","")
if(opt.dot):
        mac = ":".join(re.findall("..", mac))
 
print mac
clipboard.set_text(mac)
clipboard.store()
sys.exit()
This entry was posted in General and tagged , , , , . Bookmark the permalink.