Skip to content

Instantly share code, notes, and snippets.

@rajeevs1992
Created January 22, 2013 14:43
Show Gist options
  • Save rajeevs1992/4595140 to your computer and use it in GitHub Desktop.
Save rajeevs1992/4595140 to your computer and use it in GitHub Desktop.
#!/bin/bash
#Author :Rajeev S
#Date :8/18/2011 2341hrs
#print mac id of a computer
import re
import os
os.system("clear")
ifconfigOutput=os.popen("ifconfig").read()
t='[a-z0-9]'
MACpattern=(t*2+':')*5+t*2
m=re.search(MACpattern,ifconfigOutput)
print 'MAC address is ',m .group()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment