Working before disconnect
This commit is contained in:
@@ -10,8 +10,8 @@ from app.models import Network, Networks, User
|
||||
from config import debug
|
||||
|
||||
CMD_SCAN = "sudo nmcli -t -f SSID,SIGNAL,IN-USE,SECURITY -e yes -m tab device wifi list ifname wlxf81a6719febb --rescan yes"
|
||||
CMD_JOIN = 'sudo nmcli device wifi connect "*SSID*" ifname wlxf81a6719febb'
|
||||
CMD_JOINPW = 'sudo nmcli device wifi connect "*SSID*" ifname wlxf81a6719febb password "*PASSWORD*"'
|
||||
CMD_JOIN = "sudo nmcli device wifi connect *SSID* ifname wlxf81a6719febb"
|
||||
CMD_JOINPW = "sudo nmcli device wifi connect *SSID* ifname wlxf81a6719febb password *PASSWORD*"
|
||||
# Error: Connection activation failed: (7) Secrets were required, but not provided.
|
||||
# Device 'wlxf81a6719febb' successfully activated with '11111-1111-11111-111111-11111111'
|
||||
|
||||
@@ -23,6 +23,7 @@ def scan_networks():
|
||||
t = line.split(":")
|
||||
if t[0] != "":
|
||||
scan.append(line)
|
||||
|
||||
return scan
|
||||
|
||||
|
||||
@@ -78,11 +79,11 @@ def wpa(ssid):
|
||||
cmd = CMD_JOINPW.replace("*SSID*", ssid)
|
||||
cmd = cmd.replace("*PASSWORD*", form.password.data)
|
||||
|
||||
output = subprocess.run(cmd.split(" "), stdout=subprocess.PIPE).stdout.decode("utf-8")
|
||||
if output.find("Error") == "-1":
|
||||
output = subprocess.run(cmd.split(" "), stdout=subprocess.PIPE, stderr=subprocess.PIPE).stdout.decode("utf-8")
|
||||
if output.find("Error") == -1:
|
||||
return "Successfully connected to {}".format(ssid)
|
||||
|
||||
return "Failed to connect to {} {} {}".format(ssid, pformat(cmd.split(" ")), cmd)
|
||||
return "Failed to connect to {}".format(ssid)
|
||||
|
||||
return render_template("wpa.html", title="WPA Password", form=form)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user