This commit is contained in:
Rich
2021-09-01 10:34:11 +01:00
parent 9933954deb
commit aadd367076
4 changed files with 17 additions and 13 deletions

View File

@@ -27,19 +27,19 @@ def load_user(user_id):
return User.query.get(int(user_id))
class Passwords(db.Model):
id = db.Column(db.Integer, primary_key=True)
ssid = db.Column(db.String(140))
password = db.Column(db.String(128))
# class Passwords(db.Model):
# id = db.Column(db.Integer, primary_key=True)
# ssid = db.Column(db.String(140))
# password = db.Column(db.String(128))
def __repr__(self):
return "<Passwords {}>".format(self.ssid)
# def __repr__(self):
# return "<Passwords {}>".format(self.ssid)
class ConfigTable(db.Model):
id = db.Column(db.Integer, primary_key=True)
k = db.Column(db.String(100))
v = db.Column(db.String(1023))
# class ConfigTable(db.Model):
# id = db.Column(db.Integer, primary_key=True)
# k = db.Column(db.String(100))
# v = db.Column(db.String(1023))
def __repr__(self):
return "<Config {}:{}>".format(self.k, self.v)
# def __repr__(self):
# return "<Config {}:{}>".format(self.k, self.v)

View File

@@ -76,6 +76,8 @@ def parse_iwlist(iwlist_output, current_sid):
if line.find("ESSID:") != -1:
if line.partition("ESSID:")[2].strip('"') != "":
cell["SSID"] = line.partition("ESSID:")[2].strip('"')
else:
cell["SSID"] = "!***!"
if cell["SSID"] == current_sid:
cell["Connected"] = "Yes"
else:
@@ -92,6 +94,8 @@ def parse_iwlist(iwlist_output, current_sid):
except:
cells = []
cells = [cell for cell in cells if cell["SSID"] != "!***!"]
return cells

View File

@@ -3,7 +3,7 @@ from flask_login import current_user, login_required, login_user, logout_user
from app import app
from app.forms import LoginForm, WPAForm
from app.models import ConfigTable, Passwords, User
from app.models import User
from app.network_utils import (
connect_network,
disconnect_network,