mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-12-22 21:22:37 +01:00
c72cd38e76
Make the HostapdCLI class non-static so that each objects corresponds to a hostapd instance on one network interface (this is independent of whether the AP instances use one or separate hostapd processes)
27 lines
772 B
Python
27 lines
772 B
Python
#!/usr/bin/python3
|
|
import os, os.path
|
|
import wiphy
|
|
|
|
hostapd_map = {ifname: intf for wname, wiphy in wiphy.wiphy_map.items()
|
|
for ifname, intf in wiphy.items() if intf.use == 'hostapd'}
|
|
|
|
class HostapdCLI:
|
|
def __init__(self, interface):
|
|
self.ifname = interface.name
|
|
self.ctrl_interface = interface.ctrl_interface
|
|
|
|
socket_path = os.path.dirname(self.ctrl_interface)
|
|
|
|
self.cmdline = 'hostapd_cli -p"' + socket_path + '" -i"' + \
|
|
self.ifname + '"'
|
|
|
|
def wps_push_button(self):
|
|
os.system(self.cmdline + ' wps_pbc')
|
|
|
|
def deauthenticate(self, client_address):
|
|
os.system(self.cmdline + ' deauthenticate ' + client_address)
|
|
|
|
@staticmethod
|
|
def kill_all():
|
|
os.system('killall hostapd')
|