Hola usuario de nuestro sitio web, tenemos la respuesta a tu pregunta, has scroll y la hallarás más abajo.
Ejemplo: cómo conectar wifi usando python
import os
classFinder:def__init__(self,*args,**kwargs):
self.server_name = kwargs['server_name']
self.password = kwargs['password']
self.interface_name = kwargs['interface']
self.main_dict =defrun(self):
command ="""sudo iwlist wlp2s0 scan | grep -ioE 'ssid:"(.*.*)'"""
result = os.popen(command.format(self.server_name))
result =list(result)if"Device or resource busy"in result:returnNoneelse:
ssid_list =[item.lstrip('SSID:').strip('"n')for item in result]print("Successfully get ssids ".format(str(ssid_list)))for name in ssid_list:try:
result = self.connection(name)except Exception as exp:print("Couldn't connect to name : . ".format(name, exp))else:if result:print("Successfully connected to ".format(name))defconnection(self, name):try:
os.system("nmcli d wifi connect password iface ".format(name,
self.password,
self.interface_name))except:raiseelse:returnTrueif __name__ =="__main__":# Server_name is a case insensitive string, and/or regex pattern which demonstrates# the name of targeted WIFI device or a unique part of it.
server_name ="example_name"
password ="your_password"
interface_name ="your_interface_name"# i. e wlp2s0
F = Finder(server_name=server_name,
password=password,
interface=interface_name)
F.run()
Si sostienes algún recelo o forma de desarrollar nuestro reseña eres capaz de ejecutar una referencia y con gusto lo interpretaremos.
¡Haz clic para puntuar esta entrada!
(Votos: 0 Promedio: 0)