Last active
September 13, 2019 07:01
-
-
Save meeuw/31ae385cc67a8a94f29407355aad7c58 to your computer and use it in GitHub Desktop.
script to disconnect current wifi connection
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# https://w1.fi/wpa_supplicant/devel/dbus.html | |
import dbus | |
import sys | |
if len(sys.argv) > 1: | |
interface = sys.argv[1] | |
else: | |
interface = 'wlp0s20f0u2u2' | |
bus = dbus.SystemBus() | |
wpa_supplicant1 = bus.get_object('fi.w1.wpa_supplicant1', '/fi/w1/wpa_supplicant1') | |
path = wpa_supplicant1.GetInterface(interface, dbus_interface="fi.w1.wpa_supplicant1") | |
interface_obj = bus.get_object("fi.w1.wpa_supplicant1", path) | |
interface_obj.Reassociate(dbus_interface="fi.w1.wpa_supplicant1.Interface") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment