Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2016
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. #/usr/bin/env python2
  2.  
  3. import re
  4.  
  5. def main():
  6.  
  7. # Put subprocess handling here instead of this
  8.  
  9. f = open("out", "r")
  10. output = f.read()
  11.  
  12. cell = re.findall("Cell (\d+)", output)
  13. ssid = re.findall('ESSID:"(.+)"', output)
  14. loss = re.findall('Signal level=-(\d+)', output)
  15. ch = re.findall('Channel:(\d+)', output)
  16.  
  17. print "\n \x1b[1;39m %-3s %-30s %-8s %-2s\x1b[0m" % ( "NUM", "ESSID", "PWR", "CH")
  18. print " \x1b[1;39m%-3s %-30s %-8s %-2s\x1b[0m" % ( "---", "-" * 30, "-" * 7, "-" * 2)
  19.  
  20. for i in range(0, len(cell)):
  21.  
  22. print "\x1b[32m %-3s\x1b[39m \x1b[35m%-30s\x1b[0m \x1b[1;33m-%-3sdBm\x1b[0m \x1b[32m%2s\x1b[0m" % (cell[i], ssid[i], loss[i], ch[i])
  23.  
  24. print "\n"
  25.  
  26. if __name__=="__main__":
  27. main();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement