A cross-platform module for manipulating WiFi devices.
Project description
pywifi
pywifi provides a cross-platform Python module for manipulating wireless interfaces.
- Easy to use
- Supports Windows and Linux
Prerequisites
On Linux, you will need to run wpa_supplicant to manipulate the wifi devices, and then pywifi can communicate with wpa_supplicant through socket.
On Windows, the Native Wifi component comes with Windows versions greater than Windows XP SP2.
Installation
After installing the prerequisites listed above for your platform, you can use pip to install from source:
cd pywifi/
pip install .
Documentation
For the details of pywifi, please refer to Documentation.
Example
import pywifi
wifi = pywifi.PyWiFi()
iface = wifi.interfaces()[0]
iface.disconnect()
time.sleep(1)
assert iface.status() in\
[const.IFACE_DISCONNECTED, const.IFACE_INACTIVE]
profile = pywifi.Profile()
profile.ssid = 'testap'
profile.auth = const.AUTH_ALG_OPEN
profile.akm.append(const.AKM_TYPE_WPA2PSK)
profile.cipher = const.CIPHER_TYPE_CCMP
profile.key = '12345678'
iface.remove_all_network_profiles()
tmp_profile = iface.add_network_profile(profile)
iface.connect(tmp_profile)
time.sleep(30)
assert iface.status() == const.IFACE_CONNECTED
iface.disconnect()
time.sleep(1)
assert iface.status() in\
[const.IFACE_DISCONNECTED, const.IFACE_INACTIVE]
(C) Jiang Sheng-Jhih 2019, MIT License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file pywifi-1.1.12.tar.gz
.
File metadata
- Download URL: pywifi-1.1.12.tar.gz
- Upload date:
- Size: 13.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.18.4 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.29.1 CPython/3.6.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6da15de5d573635a461a95919920788b6f61748e1bd93a5e3504f456cf2e8bcc |
|
MD5 | 81d53b68a7150608d4fd968233a2f867 |
|
BLAKE2b-256 | b483af4c284db4a9c87af92525f1d755426e9dc04aef80be8c54b0ae6628105d |
File details
Details for the file pywifi-1.1.12-py3-none-any.whl
.
File metadata
- Download URL: pywifi-1.1.12-py3-none-any.whl
- Upload date:
- Size: 15.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.5.0.1 requests/2.18.4 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.29.1 CPython/3.6.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d1b79d9ff054eef1aca4ab97f2641650d001d6740bfa7666a7d9506bcfb8459b |
|
MD5 | 13bbf88378f1628a88e7fc5619df90e7 |
|
BLAKE2b-256 | 8955170a52685eeefeab36bfaf26bdca629263a0a28efffc3b556b2cc86ab966 |