Merge pull request #740 from cdbrkfxrpt/main

Change iw call in module nic from link to info
This commit is contained in:
tobi-wan-kenobi 2020-12-01 03:32:10 +01:00 committed by GitHub
commit 5fb19b66da
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -134,13 +134,15 @@ class Module(core.module.Module):
widget.set("state", state) widget.set("state", state)
def get_ssid(self, intf): def get_ssid(self, intf):
if self._iswlan(intf) and not self._istunnel(intf) and self.iw: if not self._iswlan(intf) or self._istunnel(intf) or not self.iw:
ssid = util.cli.execute("{} dev {} link".format(self.iw, intf)) return ""
found_ssid = re.findall("SSID:\s(.+)", ssid)
if len(found_ssid) > 0: iw_info = util.cli.execute("{} dev {} info".format(self.iw, intf))
return found_ssid[0] for line in iw_info.split("\n"):
else: match = re.match("^\s+ssid\s(.+)$", line)
return "" if match:
return match.group(1)
return "" return ""