首页
学习
活动
专区
圈层
工具
发布

python pywifi

1、the status of the wifi: const.IFACE_DISCONNECTED const.IFACE_SCANNING const.IFACE_INACTIVE const.IFACE_CONNECTING const.IFACE_CONNECTED

2、authention algorithm: almost use open const.AUTH_OPEN const.AUTH_SHARED

3、key management type an AP is no security setting, set the profile akm as AKM_TYPE_NONE. an AP is in WPA mode, set the profile akm as AKM_TYUPE_WPAPSK. an AP is in WPA2 mode, set the profile akm as AKM_TYUPE_WPA2PSK. AKM_TYPE_WPA and AKM_TYPE_WPA2 are used by the enterprise APs. const.AKM_TYPE_NONE const.AKM_TYPE_WPA const.AKM_TYPE_WPAPSK const.AKM_TYPE_WPA2 const.AKM_TYPE_WPA2PSK

4、cipher types const.CIPHER_TYPE_NONE const.CIPHER_TYPE_WEP const.CIPHER_TYPE_TKIP const.CIPHER_TYPE_CCMP

5、network profile ssid - The ssid of the AP. auth - The authentication algorithm of the AP. akm - The key management type of the AP. cipher - The cipher type of the AP. key (optinoal) - The key of the AP. This should be set if the cipher is not CIPHER_TYPE_NONE.

代码语言:javascript
代码运行次数:0
复制
import pywifi

wifi = pywifi.PyWiFi()
iface = wifi.interfaces()[0]

Interface.name()

Get the name of the Wi-Fi interface.

Interface.scan()

Trigger the interface to scan APs.

Interface.scan_results()

Obtain the results of the previous triggerred scan. A Profile list will be returned.

Note. Because the scan time for each Wi-Fi interface is variant. It is safer to call scan_results() 2 ~ 8 seconds later after calling scan().

Interface.add_network_profile(profile)

Add the AP profile for connecting to later.

Interface.remove_all_network_profiles()

Remove all the AP profiles.

Interface.network_profiles()

Obtain all the saved AP profiles by returning a Profile list.

Interface.connect(profile)

Connect to the specified AP by the given profile. Note. As current design, add_network_profile(profile) should be called before connect(profile) is called.

Interface.disconnect()

Disconnect current AP connection.

Interface.status()

Get the status of current status.

举报
领券