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

BIN
app.db

Binary file not shown.

View File

@@ -27,19 +27,19 @@ def load_user(user_id):
return User.query.get(int(user_id)) return User.query.get(int(user_id))
class Passwords(db.Model): # class Passwords(db.Model):
id = db.Column(db.Integer, primary_key=True) # id = db.Column(db.Integer, primary_key=True)
ssid = db.Column(db.String(140)) # ssid = db.Column(db.String(140))
password = db.Column(db.String(128)) # password = db.Column(db.String(128))
def __repr__(self): # def __repr__(self):
return "<Passwords {}>".format(self.ssid) # return "<Passwords {}>".format(self.ssid)
class ConfigTable(db.Model): # class ConfigTable(db.Model):
id = db.Column(db.Integer, primary_key=True) # id = db.Column(db.Integer, primary_key=True)
k = db.Column(db.String(100)) # k = db.Column(db.String(100))
v = db.Column(db.String(1023)) # v = db.Column(db.String(1023))
def __repr__(self): # def __repr__(self):
return "<Config {}:{}>".format(self.k, self.v) # 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.find("ESSID:") != -1:
if line.partition("ESSID:")[2].strip('"') != "": if line.partition("ESSID:")[2].strip('"') != "":
cell["SSID"] = line.partition("ESSID:")[2].strip('"') cell["SSID"] = line.partition("ESSID:")[2].strip('"')
else:
cell["SSID"] = "!***!"
if cell["SSID"] == current_sid: if cell["SSID"] == current_sid:
cell["Connected"] = "Yes" cell["Connected"] = "Yes"
else: else:
@@ -92,6 +94,8 @@ def parse_iwlist(iwlist_output, current_sid):
except: except:
cells = [] cells = []
cells = [cell for cell in cells if cell["SSID"] != "!***!"]
return cells 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 import app
from app.forms import LoginForm, WPAForm from app.forms import LoginForm, WPAForm
from app.models import ConfigTable, Passwords, User from app.models import User
from app.network_utils import ( from app.network_utils import (
connect_network, connect_network,
disconnect_network, disconnect_network,