Skip to main content

A cross-platform WiFi management tool for Windows, macOS, and Ubuntu

Project description

py-wifi-helper

PyPI version PyPI Downloads

This is a Python tool/library developed for macOS 13.5, Ubuntu 22.04, and Windows 10/11, primarily providing operations for wireless interfaces. It includes functionalities such as listing available wireless interfaces, scanning for WiFi signals using a specified wireless interface, connecting a chosen wireless interface to a specific WiFi access point, retrieving information about the connected WiFi access points for the specified wireless interface, and disconnecting the specified wireless interface.

Installation

Dependencies

Windows

pip install pywifi comtypes

macOS

pip install "pyobjc-core>=9.2" "pyobjc-framework-Cocoa>=9.2" "pyobjc-framework-CoreWLAN>=9.2"

Ubuntu

Requires nmcli to be installed:

sudo apt-get install network-manager

Usage

% py-wifi-helper --help
usage: py-wifi-helper [-h] [--action {device,scan,connect,disconnect}] [--device DEVICE] [--ssid SSID] [--password PASSWORD] [--scanner-path SCANNER_PATH]

options:
  -h, --help            show this help message and exit
  --action {device,scan,connect,disconnect}
                        command action
  --device DEVICE       interface
  --ssid SSID          ssid
  --password PASSWORD   password
  --scanner-path SCANNER_PATH
                        Path to WiFiScanner.app (macOS only)

Windows

> py-wifi-helper
{
    "version": "1.0.0",
    "device": {
        "default": "Intel(R) Wi-Fi 6 AX201 160MHz",
        "list": [
            "Intel(R) Wi-Fi 6 AX201 160MHz"
        ],
        "error": null,
        "select": "Intel(R) Wi-Fi 6 AX201 160MHz"
    },
    "connection": {
        "default": {
            "ssid": "MyWiFi",
            "log": null
        },
        "Intel(R) Wi-Fi 6 AX201 160MHz": {
            "ssid": "MyWiFi",
            "log": null
        }
    },
    "action": {
        "name": "device",
        "status": true,
        "error": null,
        "log": null
    }
}

Ubuntu

$ lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 22.04.3 LTS
Release:	22.04
Codename:	jammy

$ sudo py-wifi-helper
{
    "version": "1.0.0",
    "device": {
        "default": "wlxd1234567890",
        "list": [
            "wlxd1234567890"
        ],
        "error": null,
        "select": "wlxd1234567890"
    },
    "connection": {
        "default": {
            "ssid": null,
            "log": null
        },
        "wlxd1234567890": {
            "ssid": null,
            "log": null
        }
    },
    "action": {
        "name": "device",
        "status": true,
        "error": null,
        "log": null
    }
}

macOS

Setup Location Services Permission

Starting from macOS 15+, scanning WiFi networks requires Location Services permission. You need to set up WiFiScanner.app first:

# Default setup (creates WiFiScanner.app in current directory)
py-wifi-helper-macos-setup

# Or specify a custom location
py-wifi-helper-macos-setup --target-path ~/Applications/WiFiScanner.app

After setup, you'll need to:

  1. Allow Location Services access when prompted
  2. Or manually enable Location Services for WiFiScanner in System Settings > Privacy & Security > Location Services

Basic Usage

% sw_vers
ProductName:		macOS
ProductVersion:		13.5
BuildVersion:		22G74

% py-wifi-helper
{
    "version": "1.0.0",
    "device": {
        "default": "en0",
        "list": [
            "en0"
        ],
        "error": null,
        "select": "en0"
    },
    "connection": {
        "default": {
            "ssid": "MyHomeWIFIAP",
            "log": null
        },
        "en0": {
            "ssid": "MyHomeWIFIAP",
            "log": null
        }
    },
    "action": {
        "name": "device",
        "status": true,
        "error": null,
        "log": null
    }
}

For scanning operations, you can either use the default WiFiScanner.app location or specify a custom path:

# Use default WiFiScanner.app location
py-wifi-helper --action scan

# Use custom WiFiScanner.app location
py-wifi-helper --action scan --scanner-path ~/Applications/WiFiScanner.app

Examples

Scan for WiFi Networks

py-wifi-helper --action scan

Connect to WiFi

py-wifi-helper --action connect --ssid "MyWiFi" --password "12345678"

Disconnect from WiFi

py-wifi-helper --action disconnect

Use Specific Interface

py-wifi-helper --action scan --device "wlan0"

Notes

  • Windows requires administrator privileges for some operations
  • Ubuntu requires sudo for network operations
  • macOS requires Location Services permission for WiFi scanning (set up using py-wifi-helper-macos-setup)

Platform Support

  • Windows 10/11 (via pywifi)
  • macOS 13.5+ (via CoreWLAN)
  • Ubuntu 22.04+ (via nmcli)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

py_wifi_helper-2.0.3.tar.gz (22.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

py_wifi_helper-2.0.3-py3-none-any.whl (25.4 kB view details)

Uploaded Python 3

File details

Details for the file py_wifi_helper-2.0.3.tar.gz.

File metadata

  • Download URL: py_wifi_helper-2.0.3.tar.gz
  • Upload date:
  • Size: 22.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for py_wifi_helper-2.0.3.tar.gz
Algorithm Hash digest
SHA256 bfa9eb7a310e015b9c94a1c0181a0f792af5fac097060ad93247d29026c9ea43
MD5 b1aa5a16b8c61274181aaf99154bdc32
BLAKE2b-256 4d2510c6ff328c71d3d37b4407d1876a63f3ff111d302377ea13508d72be74d8

See more details on using hashes here.

Provenance

The following attestation bundles were made for py_wifi_helper-2.0.3.tar.gz:

Publisher: python-publish.yml on changyy/py-wifi-helper

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file py_wifi_helper-2.0.3-py3-none-any.whl.

File metadata

  • Download URL: py_wifi_helper-2.0.3-py3-none-any.whl
  • Upload date:
  • Size: 25.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for py_wifi_helper-2.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 a79538699c3e7630ce8626fb4276c57e88b5babb92e7991f23030915716a5275
MD5 f1d34d06efd917c129aa7764f70ac8f2
BLAKE2b-256 3bf1c91ece65c3994796cf06459c2bcd7f31bd038dc64f8c81a685610a0c4e9d

See more details on using hashes here.

Provenance

The following attestation bundles were made for py_wifi_helper-2.0.3-py3-none-any.whl:

Publisher: python-publish.yml on changyy/py-wifi-helper

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page