.
This commit is contained in:
6
app.py
6
app.py
@@ -9,6 +9,7 @@ from flask import request
|
|||||||
|
|
||||||
CMD_SCAN = "sudo nmcli -t -f SSID,SIGNAL,IN-USE,SECURITY -e yes -m tab device wifi list ifname wlxf81a6719febb --rescan yes"
|
CMD_SCAN = "sudo nmcli -t -f SSID,SIGNAL,IN-USE,SECURITY -e yes -m tab device wifi list ifname wlxf81a6719febb --rescan yes"
|
||||||
scan = ["rpi:100: :WPA2", "Home:94:*:WPA2", "HOME2:48: :WPA2", "BT:23: :"]
|
scan = ["rpi:100: :WPA2", "Home:94:*:WPA2", "HOME2:48: :WPA2", "BT:23: :"]
|
||||||
|
# scan = []
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
|
|
||||||
@@ -21,9 +22,12 @@ app = Flask(__name__)
|
|||||||
|
|
||||||
|
|
||||||
def scan_wifi():
|
def scan_wifi():
|
||||||
|
global scan
|
||||||
|
|
||||||
scan = []
|
scan = []
|
||||||
temp = subprocess.run(CMD_SCAN.split(" "), stdout=subprocess.PIPE).stdout.decode("utf-8")
|
temp = subprocess.run(CMD_SCAN.split(" "), stdout=subprocess.PIPE).stdout.decode("utf-8")
|
||||||
for line in temp.split():
|
for line in temp.split():
|
||||||
|
line = line.split(":")
|
||||||
if line[0] != "":
|
if line[0] != "":
|
||||||
scan.append(line)
|
scan.append(line)
|
||||||
|
|
||||||
@@ -31,7 +35,7 @@ def scan_wifi():
|
|||||||
@app.route("/", methods=["GET", "POST"])
|
@app.route("/", methods=["GET", "POST"])
|
||||||
def main():
|
def main():
|
||||||
if request.method == "GET":
|
if request.method == "GET":
|
||||||
scan_wifi()
|
# scan_wifi()
|
||||||
output = """<form method="POST"><table>
|
output = """<form method="POST"><table>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
|||||||
Reference in New Issue
Block a user