Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #/usr/bin/env python2
- import re
- def main():
- # Put subprocess handling here instead of this
- f = open("out", "r")
- output = f.read()
- cell = re.findall("Cell (\d+)", output)
- ssid = re.findall('ESSID:"(.+)"', output)
- loss = re.findall('Signal level=-(\d+)', output)
- ch = re.findall('Channel:(\d+)', output)
- print "\n \x1b[1;39m %-3s %-30s %-8s %-2s\x1b[0m" % ( "NUM", "ESSID", "PWR", "CH")
- print " \x1b[1;39m%-3s %-30s %-8s %-2s\x1b[0m" % ( "---", "-" * 30, "-" * 7, "-" * 2)
- for i in range(0, len(cell)):
- 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])
- print "\n"
- if __name__=="__main__":
- main();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement