joshschmelzle / lswifi

a CLI-centric Wi-Fi scanning tool for Windows
https://pypi.org/project/lswifi/
BSD 3-Clause "New" or "Revised" License
49 stars 7 forks source link

Presence of 0xc6 in neighboring SSID breaks lswifi #10

Closed joshschmelzle closed 2 years ago

joshschmelzle commented 2 years ago

When there is a non utf-8 character present in a beacon or probe response frame from neighboring APs, lswifi breaks because it is unable to decode. Need to investigate and address.

PS C:\Users\jsz> lswifi
2021-10-29 15:31:12,991 [INFO] lswifi.client: timeout interval (4.0 seconds) exceeded...
Exception in thread Thread-1:
Traceback (most recent call last):
  File "C:\Users\jsz\AppData\Local\Programs\Python\Python310\lib\threading.py", line 1009, in _bootstrap_inner
    self.run()
  File "C:\Users\jsz\AppData\Local\Programs\Python\Python310\lib\threading.py", line 1358, in run
    self.function(*self.args, **self.kwargs)
  File "C:\Users\jsz\AppData\Local\Programs\Python\Python310\lib\site-packages\lswifi\client.py", line 402, in scan_timeout
    self.data = self.get_bss_list(self.iface)
  File "C:\Users\jsz\AppData\Local\Programs\Python\Python310\lib\site-packages\lswifi\client.py", line 286, in get_bss_list
    wireless_network_bss_list = WLAN_API.WLAN.get_wireless_network_bss_list(
  File "C:\Users\jsz\AppData\Local\Programs\Python\Python310\lib\site-packages\lswifi\wlanapi.py", line 1577, in get_wireless_network_bss_list
    networks.append(WirelessNetworkBss(bss_entry, connected_bssid))
  File "C:\Users\jsz\AppData\Local\Programs\Python\Python310\lib\site-packages\lswifi\elements.py", line 61, in __init__
    _ssid = bytes.decode(bss_entry.dot11Ssid.SSID[: WLAN_API.DOT11_SSID_MAX_LENGTH])
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc6 in position 0: invalid continuation byte
joshschmelzle commented 2 years ago

Fixed in 14a54dff3aee8e33c4e49336911a0b9779ef24c2