From d4bdb340c8fa7b241cfeb3ec86a2e41d91cb92b0 Mon Sep 17 00:00:00 2001 From: iamdoubz <> Date: Mon, 4 May 2026 02:30:26 -0500 Subject: [PATCH 1/2] Fix wrong windows sdk struct layout --- scanner.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/scanner.py b/scanner.py index 3ff4058..d0e410a 100644 --- a/scanner.py +++ b/scanner.py @@ -293,9 +293,16 @@ def _wlanapi_enumerate_and_scan(wlan, handle) -> list[AccessPoint]: ("InterfaceInfo", WLAN_INTERFACE_INFO * 64)] # ── WLAN_BSS_ENTRY ──────────────────────────────────────────────────────── + # DOT11_SSID is { ULONG uSSIDLength; UCHAR ucSSID[32]; } = 36 bytes. + # It must NOT be packed as c_ubyte*33 — uSSIDLength is a 4-byte ULONG, + # not a single byte, so the SSID data starts at offset 4, not offset 1. + class DOT11_SSID(ctypes.Structure): + _fields_ = [("uSSIDLength", wt.ULONG), + ("ucSSID", ctypes.c_ubyte * 32)] + class WLAN_BSS_ENTRY(ctypes.Structure): _fields_ = [ - ("dot11Ssid", ctypes.c_ubyte * 33), # DOT11_SSID (length + ucSSID) + ("dot11Ssid", DOT11_SSID), ("uPhyId", wt.ULONG), ("dot11Bssid", ctypes.c_ubyte * 6), ("dot11BssType", wt.DWORD), @@ -357,9 +364,10 @@ def _wlanapi_enumerate_and_scan(wlan, handle) -> list[AccessPoint]: for j in range(bss_list.dwNumberOfItems): entry = bss_list.wlanBssEntries[j] - # Decode SSID (first byte = length in DOT11_SSID) - ssid_len = entry.dot11Ssid[0] - ssid_bytes = bytes(entry.dot11Ssid[1:1 + ssid_len]) + # Decode SSID using the correct DOT11_SSID field layout: + # uSSIDLength is the number of valid bytes in ucSSID (max 32). + ssid_len = entry.dot11Ssid.uSSIDLength + ssid_bytes = bytes(entry.dot11Ssid.ucSSID[:ssid_len]) try: ssid = ssid_bytes.decode("utf-8", errors="replace").strip("\x00") except Exception: From 988c40025ecf69287cbf817508fc4e6ade1fe53c Mon Sep 17 00:00:00 2001 From: iamdoubz <> Date: Mon, 4 May 2026 02:30:48 -0500 Subject: [PATCH 2/2] Display correct ssid --- main.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.py b/main.py index 78f7ce9..64d2202 100644 --- a/main.py +++ b/main.py @@ -460,7 +460,7 @@ class WiFiHeatmapApp: text_fg = TEXT if is_live else dim_fg dim2 = TEXT_DIM if is_live else dim_fg - _cell(ssid[:20], 160, fg=text_fg, bold=True) + _cell(ssid, 160, fg=text_fg, bold=True) _cell(bssid, 145, fg=dim2) _cell(channel, 38, fg=text_fg) _cell(freq, 90, fg=text_fg)