[Feature] Add Wifi 6e and 7 #18
+31
-11
@@ -99,7 +99,12 @@ class AccessPoint:
|
|||||||
if not self.vendor or self.vendor == "-":
|
if not self.vendor or self.vendor == "-":
|
||||||
self.vendor = lookup_vendor(self.bssid)
|
self.vendor = lookup_vendor(self.bssid)
|
||||||
if not self.band:
|
if not self.band:
|
||||||
self.band = _band_from_channel(self.channel)
|
# Prefer freq-based detection — channel numbers overlap between bands
|
||||||
|
# (e.g. channel 37 exists in both 5 GHz and 6 GHz)
|
||||||
|
if self.freq_mhz:
|
||||||
|
self.band = _band_from_freq(self.freq_mhz)
|
||||||
|
else:
|
||||||
|
self.band = _band_from_channel(self.channel)
|
||||||
if not self.freq_mhz and self.channel:
|
if not self.freq_mhz and self.channel:
|
||||||
self.freq_mhz = _freq_from_channel(self.channel)
|
self.freq_mhz = _freq_from_channel(self.channel)
|
||||||
|
|
||||||
@@ -186,6 +191,12 @@ def scan_averaged(samples: int = 10, delay: float = 0.1) -> list[AccessPoint]:
|
|||||||
|
|
||||||
# ── Helpers ───────────────────────────────────────────────────────────────────
|
# ── Helpers ───────────────────────────────────────────────────────────────────
|
||||||
|
|
||||||
|
def _band_from_freq(freq_mhz: int) -> str:
|
||||||
|
if 2400 <= freq_mhz <= 2500: return "2.4 GHz"
|
||||||
|
if 5150 <= freq_mhz <= 5900: return "5 GHz"
|
||||||
|
if 5925 <= freq_mhz <= 7125: return "6 GHz"
|
||||||
|
return ""
|
||||||
|
|
||||||
def _band_from_channel(ch: int) -> str:
|
def _band_from_channel(ch: int) -> str:
|
||||||
if 1 <= ch <= 14: return "2.4 GHz"
|
if 1 <= ch <= 14: return "2.4 GHz"
|
||||||
if 32 <= ch <= 177: return "5 GHz"
|
if 32 <= ch <= 177: return "5 GHz"
|
||||||
@@ -199,6 +210,7 @@ def _freq_from_channel(ch: int) -> int:
|
|||||||
|
|
||||||
def _mode_from_flags(s: str) -> str:
|
def _mode_from_flags(s: str) -> str:
|
||||||
u = s.upper()
|
u = s.upper()
|
||||||
|
if any(x in u for x in ("EHT", "802.11BE", "WIFI 7", "WI-FI 7")): return "be (Wi-Fi 7)"
|
||||||
if any(x in u for x in ("AX", "HE", "802.11AX", "WIFI 6", "WI-FI 6")): return "ax (Wi-Fi 6)"
|
if any(x in u for x in ("AX", "HE", "802.11AX", "WIFI 6", "WI-FI 6")): return "ax (Wi-Fi 6)"
|
||||||
if any(x in u for x in ("AC", "VHT", "802.11AC")): return "ac (Wi-Fi 5)"
|
if any(x in u for x in ("AC", "VHT", "802.11AC")): return "ac (Wi-Fi 5)"
|
||||||
if any(x in u for x in ("802.11N", " N ", "HT20", "HT40")): return "n (Wi-Fi 4)"
|
if any(x in u for x in ("802.11N", " N ", "HT20", "HT40")): return "n (Wi-Fi 4)"
|
||||||
@@ -209,7 +221,7 @@ def _mode_from_flags(s: str) -> str:
|
|||||||
|
|
||||||
def _channel_width_from_str(s: str) -> str:
|
def _channel_width_from_str(s: str) -> str:
|
||||||
s = s.strip()
|
s = s.strip()
|
||||||
for w in ("160", "80+80", "80", "40", "20"):
|
for w in ("320", "160", "80+80", "80", "40", "20"):
|
||||||
if w in s: return f"{w} MHz"
|
if w in s: return f"{w} MHz"
|
||||||
return s or "-"
|
return s or "-"
|
||||||
|
|
||||||
@@ -392,11 +404,15 @@ def _wlanapi_enumerate_and_scan(wlan, handle) -> list[AccessPoint]:
|
|||||||
phy_type = entry.dot11BssPhyType
|
phy_type = entry.dot11BssPhyType
|
||||||
mode = {
|
mode = {
|
||||||
6: "g", # dot11_phy_type_erp
|
6: "g", # dot11_phy_type_erp
|
||||||
7: "a", # dot11_phy_type_ht (could also be n/5GHz)
|
7: "a", # dot11_phy_type_ofdm (legacy 802.11a)
|
||||||
8: "n (Wi-Fi 4)", # dot11_phy_type_ht
|
8: "n (Wi-Fi 4)", # dot11_phy_type_ht
|
||||||
9: "ac (Wi-Fi 5)", # dot11_phy_type_vht
|
9: "ac (Wi-Fi 5)", # dot11_phy_type_vht
|
||||||
10: "ax (Wi-Fi 6)", # dot11_phy_type_he
|
10: "ax (Wi-Fi 6)", # dot11_phy_type_he (covers Wi-Fi 6 and 6E)
|
||||||
|
11: "be (Wi-Fi 7)", # dot11_phy_type_eht (802.11be)
|
||||||
}.get(phy_type, "-")
|
}.get(phy_type, "-")
|
||||||
|
# Wi-Fi 6E is 802.11ax (phy_type 10) operating in the 6 GHz band
|
||||||
|
if mode == "ax (Wi-Fi 6)" and 5925 <= freq_mhz <= 7125:
|
||||||
|
mode = "ax (Wi-Fi 6E)"
|
||||||
|
|
||||||
aps.append(AccessPoint(
|
aps.append(AccessPoint(
|
||||||
ssid=ssid, bssid=bssid, signal_dbm=signal_dbm,
|
ssid=ssid, bssid=bssid, signal_dbm=signal_dbm,
|
||||||
@@ -533,17 +549,21 @@ def _parse_iw_output(text: str) -> list[AccessPoint]:
|
|||||||
else: sec = "Open"
|
else: sec = "Open"
|
||||||
|
|
||||||
# Mode from capability IEs
|
# Mode from capability IEs
|
||||||
has_he = bool(re.search(r'HE capabilities', block, re.I))
|
has_eht = bool(re.search(r'EHT capabilities', block, re.I))
|
||||||
|
has_he = bool(re.search(r'HE capabilities', block, re.I))
|
||||||
has_vht = bool(re.search(r'VHT capabilities', block, re.I))
|
has_vht = bool(re.search(r'VHT capabilities', block, re.I))
|
||||||
has_ht = bool(re.search(r'HT capabilities', block, re.I))
|
has_ht = bool(re.search(r'HT capabilities', block, re.I))
|
||||||
if has_he: mode = "ax (Wi-Fi 6)"
|
if has_eht: mode = "be (Wi-Fi 7)"
|
||||||
elif has_vht: mode = "ac (Wi-Fi 5)"
|
elif has_he and freq_mhz and freq_mhz >= 5925: mode = "ax (Wi-Fi 6E)"
|
||||||
elif has_ht: mode = "n (Wi-Fi 4)"
|
elif has_he: mode = "ax (Wi-Fi 6)"
|
||||||
elif freq_mhz and freq_mhz < 3000: mode = "g"
|
elif has_vht: mode = "ac (Wi-Fi 5)"
|
||||||
else: mode = "a"
|
elif has_ht: mode = "n (Wi-Fi 4)"
|
||||||
|
elif freq_mhz and freq_mhz < 3000: mode = "g"
|
||||||
|
else: mode = "a"
|
||||||
|
|
||||||
# Channel width
|
# Channel width
|
||||||
if re.search(r'channel width: 160', block): width = "160 MHz"
|
if re.search(r'channel width: 320', block): width = "320 MHz"
|
||||||
|
elif re.search(r'channel width: 160', block): width = "160 MHz"
|
||||||
elif re.search(r'channel width: 80', block): width = "80 MHz"
|
elif re.search(r'channel width: 80', block): width = "80 MHz"
|
||||||
elif re.search(r'channel width: 40', block): width = "40 MHz"
|
elif re.search(r'channel width: 40', block): width = "40 MHz"
|
||||||
else: width = "20 MHz"
|
else: width = "20 MHz"
|
||||||
|
|||||||
Reference in new issue
Block a user