diff --git a/iwlist.py b/iwlist.py index bec4ced..bd70de3 100644 --- a/iwlist.py +++ b/iwlist.py @@ -3,11 +3,11 @@ cellNumberRe = re.compile(r"^Cell\s+(?P.+)\s+-\s+Address:\s(?P.+)$") regexps = [ - re.compile(r"^ESSID:\"(?P.*)\"$"), + re.compile(r"^ESSID: \"(?P.*)\"$"), re.compile(r"^Protocol:(?P.+)$"), re.compile(r"^Mode:(?P.+)$"), re.compile(r"^Frequency:(?P[\d.]+) (?P.+) \(Channel (?P\d+)\)$"), - re.compile(r"^Encryption key:(?P.+)$"), + re.compile(r"^Encryption: (?P.+)$"), re.compile(r"^Quality=(?P\d+)/(?P\d+)\s+Signal level=(?P.+) d.+$"), re.compile(r"^Signal level=(?P\d+)/(?P\d+).*$"), ] @@ -20,7 +20,7 @@ # Must run as super user. # Does not specify a particular device, so will scan all network devices. def scan(interface='wlan0'): - cmd = ["iwlist", interface, "scan"] + cmd = ["iwinfo", interface, "scan"] proc = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE) points = proc.stdout.read().decode('utf-8') return points @@ -44,12 +44,6 @@ def parse(content): for expression in regexps: result = expression.search(line) if result is not None: - if 'encryption' in result.groupdict() : - if result.groupdict()['encryption'] == 'on' : - cells[-1].update({'encryption': 'wep'}) - else : - cells[-1].update({'encryption': 'off'}) - else : - cells[-1].update(result.groupdict()) + cells[-1].update(result.groupdict()) continue return cells