rajeevs1992

MAC ID Using RE

Aug 18th, 2011
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.28 KB | None | 0 0
  1. #!/bin/bash
  2. #Author :Rajeev S
  3. #Date   :8/18/2011 2341hrs
  4. #print mac id of a computer
  5. import re
  6. import os
  7. os.system("clear")
  8. ifconfigOutput=os.popen("ifconfig").read()
  9. t='[a-z0-9]'
  10. MACpattern=(t*2+':')*5+t*2
  11. m=re.search(MACpattern,ifconfigOutput)
  12. print 'MAC address is ',m .group()
Advertisement
Add Comment
Please, Sign In to add comment