awkman / pywifi

A cross-platform module for manipulating WiFi devices.
MIT License
453 stars 154 forks source link

Can't connect when SSID or key contains < character #37

Open meeusen opened 5 years ago

meeusen commented 5 years ago

Windows 7 Python 2.7.9 32-bit PyWiFi 1.1.10

When trying to connect to a network, and the SSID or key contains a "<" character, pywifi is not able to create the network profile (looking at Control Panel - Network and Internet - Manage Wireless Networks).

When using < in the Profile.ssid or Profile.key, and calling interface.add_network_profile(), there is no error, but there is also no network profile created. When using <, a network profile is created, but a connection with that profile fails.

I only have a problem with the < character. The >, & or " characters don't show this issue, I can just use them in the SSID or key.

import pywifi
pw = pywifi.PyWiFi()
i = pw.interfaces()[0]
p = pywifi.Profile()
p.ssid = "My<SSID"
i.add_network_profile(p)
# no network profile is created
p.ssid = "My&lt;SSID"
i.add_network_profile(p)
# A network profile "My<SSID" is created, but a connection with that profile fails