Skip to main content

Utility for changing to an unsecured network

Project description

Some python3.7+ utilities for changing the network you’re computer is on

With super thanks to @igo95862 for the sdbus library I use after https://github.com/igo95862/python-sdbus/issues/1

Installation

Something like:

> python3 -m venv network_changer
> ./network_changer/bin/python -m pip install network_changer
> ./network_changer/network_changer info

On Linux systems with nmcli it’ll install sdbus related dbus libraries. You can modify that behaviour with these environment variables at pip install:

NETWORK_CHANGER_NO_SDBUS

Don’t automatically install sdbus. If you want sdbus anyway then use:

> python -m pip instal network_changer[sdbus]

On linux systems without nmcli, you’ll need libiw-dev to be installed for network switching to work. You will also need sudo for all actions with iw and for wpasupplicant to be uninstalled.

If you are using nmcli on a raspberry Pi, you’ll need to do the following:

> sudo apt-get install network-manager
# Make /etc/NetworkManager/NetworkManager.conf look like this
|   [main]
|   plugins=ifupdown,keyfile
|   dhcp=internal
|
|   [ifupdown]
|   managed=true
# Make sure /etc/dhcpcd.conf has "denyinterfaces wlan0" in it somewhere
> sudo reboot

On a Mac, it’ll shell out to the airport CLI command. Note that the only thing that requires sudo is disconnection.

There is no Windows support.

Usage

Once you’ve installed network_manager you have three commands available to you:

network_manager info

Display the bssid and ssid of the interface

--interface <iface>

Specify which interface to use. By default it’ll find the one most appropriate for your system. So en0 on Mac and wlan0 on a linux

network_manager scan

Display the bssid and ssid of the access points the interface can see

--interface <iface>

Specify which interface to use. By default it’ll find the one most appropriate for your system. So en0 on Mac and wlan0 on a linux

--filter-bssid <some string>

Only show networks whose bssid contains the specified string in it

--filter-ssid <some string>

Only show networks whose ssid contains the specified string in it

network_manager connect

Connect to the network with the specified ssid. Note that this library does not support networks that have any type of security.

--interface <iface>

Specify which interface to use. By default it’ll find the one most appropriate for your system. So en0 on Mac and wlan0 on a linux

--ssid <ssid>

The ssid to connect to

Changelog

0.1.0 - TBD
  • Initial release

  • Note that there are no unit tests and this code isn’t actively used by me

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

network-changer-0.1.0.tar.gz (22.3 kB view details)

Uploaded Source

File details

Details for the file network-changer-0.1.0.tar.gz.

File metadata

  • Download URL: network-changer-0.1.0.tar.gz
  • Upload date:
  • Size: 22.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.8.13

File hashes

Hashes for network-changer-0.1.0.tar.gz
Algorithm Hash digest
SHA256 846d730652fea9dc773da8f69ed989001cd3032f7abed065aa706d2f98af7351
MD5 c263b327f2c48adad4f834331c158ead
BLAKE2b-256 aa57de33b88864df1cde8ae1833517dcf3f6571297ce9b8c9f4285cbe15ce4fb

See more details on using hashes here.

Supported by

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