| 24 | |
| 25 | @property |
| 26 | def interfaces(self): |
| 27 | d = self.state['INTERFACES'] = {} |
| 28 | out = self._jobs.run("iwconfig", no_debug=True)[0] |
| 29 | for i in re.split(r"\n\s*\n", out): |
| 30 | if i == "": |
| 31 | continue |
| 32 | iface = i.split()[0] |
| 33 | if "no wireless extensions" not in i: |
| 34 | mon = "Mode:Monitor" in i |
| 35 | mac = None |
| 36 | ifcfg = self._jobs.run("ifconfig", no_debug=True)[0] |
| 37 | try: |
| 38 | ssid = i.split("ESSID:\"", 1)[1].split("\"", 1)[0] |
| 39 | for j in re.split(r"\n\s*\n", ifcfg): |
| 40 | if j.startswith(iface + ":"): |
| 41 | mac = j.split("ether ")[1].split()[0].upper() |
| 42 | except IndexError: |
| 43 | ssid = None |
| 44 | for j in re.split(r"\n\s*\n", ifcfg): |
| 45 | if j.startswith(iface + ":") and "unspec " in j: |
| 46 | mac = ":".join(j.split("unspec ")[1].split("-")[:6]) |
| 47 | d[iface] = [mon, ssid, mac] |
| 48 | return d.keys() |
| 49 | |
| 50 | @property |
| 51 | def man_interfaces(self): |