wifi_info
跨平台获取已保存 WiFi 网络信息的 Python 库。
特性
- 跨平台支持:Windows、Linux (NetworkManager)、macOS
- 安全获取:仅读取系统已授权存储的 WiFi 信息
- 完整信息:SSID、密码、WiFi 标准、认证类型、加密方式
- 简单易用:三个清晰的方法,满足不同场景需求
- 未来兼容:自动识别新的 WiFi 协议
安装
pip install wifi_info
快速开始
方法 1: 获取所有 SSID 列表
from wifi_info import WifiInfo
wifi = WifiInfo()
ssids = wifi.list_ssids()
print(ssids) # ['HomeWiFi', 'OfficeWiFi', 'CoffeeShop']
方法 2: 获取指定网络的详细信息
from wifi_info import WifiInfo
wifi = WifiInfo()
info = wifi.get_wifi_info('HomeWiFi')
print(f"密码: {info['password']}")
print(f"WiFi 标准: {info['wifi_standard']}")
print(f"认证类型: {info['auth_type']}")
方法 3: 获取所有网络的完整信息
from wifi_info import WifiInfo
wifi = WifiInfo()
networks = wifi.info_list()
for net in networks:
print(f"SSID: {net['ssid']}, 密码: {net['password']}")
输出字段说明
每个网络信息字典包含以下字段:
| 字段名 | 类型 | 描述 | 示例 |
|---|---|---|---|
ssid |
str |
网络名称 | "MyHomeWiFi" |
password |
str | None |
明文密码(若可获取) | "secret123" |
wifi_standard |
str | None |
WiFi 标准 | "Wi-Fi 6" |
auth_type |
str | None |
认证类型 | "WPA2-Personal" |
cipher |
str | None |
加密算法 | "CCMP" |
platform_source |
str |
数据来源平台 | "windows_netsh" |
支持的 WiFi 标准
- Wi-Fi 1 (802.11b)
- Wi-Fi 2 (802.11g)
- Wi-Fi 4 (802.11n)
- Wi-Fi 5 (802.11ac)
- Wi-Fi 6 (802.11ax)
- Wi-Fi 6E (802.11ax + 6GHz)
- Wi-Fi 7 (802.11be)
- 未知协议自动保留原始名称(如
802.11BF)
权限说明
- Windows: 无需管理员权限
- Linux: 可能需要 sudo 权限读取 NetworkManager 配置
- macOS: 会触发系统钥匙串授权弹窗
开发
# 克隆仓库
git clone https://github.com/dingtongbin/wifi_info.git
cd wifi_info
# 安装依赖
pip install -e ".[dev]"
# 运行测试
pytest tests/ -v
使用示例
更多示例请查看 examples.py 文件。
贡献
欢迎提交 Issue 和 Pull Request!
许可证
Apache License 2.0
作者
dingtongbin
链接
Metadata
Release files for py-wifi-info 0.1.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| py_wifi_info-0.1.3.tar.gz | 23.0 kB | Without provenance | Details for py_wifi_info-0.1.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| py_wifi_info-0.1.3-py3-none-any.whl | Python 3 | none | any | Details for py_wifi_info-0.1.3-py3-none-any.whl |
Total release size: 38.4 kB
Release files / py_wifi_info-0.1.3.tar.gz
| Download URL | py_wifi_info-0.1.3.tar.gz |
|---|---|
| Size | 23.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
95b4aa310302f9775147e3d61a154d7ed0f171f214003f71f43ff3292680f658
|
|
BLAKE2b-256 checksum How to use checksums |
cc575ec3a158ecff9e149e0bde8b326ba55ef9028fac2b8d83e197e51124b677
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.8 {"installer":{"name":"uv","version":"0.11.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / py_wifi_info-0.1.3-py3-none-any.whl
| Download URL | py_wifi_info-0.1.3-py3-none-any.whl |
|---|---|
| Size | 15.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
758e247d021d5458bbd255534d001b5b061d381b545da83598a0a462660b02d0
|
|
BLAKE2b-256 checksum How to use checksums |
e6b3ca8fe63de3b09e854adf8e42a4b3ccccbd0116737d8150b2480d494ebc29
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.8 {"installer":{"name":"uv","version":"0.11.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Security for py-wifi-info 0.1.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.