diff --git a/Pipfile b/Pipfile index 2331eb5..18e3b86 100644 --- a/Pipfile +++ b/Pipfile @@ -9,6 +9,7 @@ flask_wtf = "*" flask-login = "*" flask-sqlalchemy = "*" flask-migrate = "*" +flask_table = "*" [dev-packages] pylint = "*" diff --git a/Pipfile.lock b/Pipfile.lock index 2bdb9fd..e12e5d4 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -1,7 +1,7 @@ { "_meta": { "hash": { - "sha256": "6d1e954a069f0d93d3fff2ba6d3bd3a08da50fa809099a6b572b3a9d97905749" + "sha256": "934470cc806e90595dfe323f119ff2420ee11d2694858cbf1f9d9d0fb407dd96" }, "pipfile-spec": 6, "requires": { @@ -23,6 +23,13 @@ ], "version": "==1.6.5" }, + "babel": { + "hashes": [ + "sha256:ab49e12b91d937cd11f0b67cb259a57ab4ad2b59ac7a3b41d6c06c0ac5b0def9", + "sha256:bc0c176f9f6a994582230df350aa6e05ba2ebe4b3ac317eab29d9be5d2768da0" + ], + "version": "==2.9.1" + }, "click": { "hashes": [ "sha256:8c04c11192119b1ef78ea049e0a6f0463e4c48ef00a30160c704337586f3ad7a", @@ -38,6 +45,13 @@ "index": "pypi", "version": "==2.0.1" }, + "flask-babel": { + "hashes": [ + "sha256:e6820a052a8d344e178cdd36dd4bb8aea09b4bda3d5f9fa9f008df2c7f2f5468", + "sha256:f9faf45cdb2e1a32ea2ec14403587d4295108f35017a7821a2b1acb8cfd9257d" + ], + "version": "==2.0.0" + }, "flask-login": { "hashes": [ "sha256:6d33aef15b5bcead780acc339464aae8a6e28f13c90d8b1cf9de8b549d1c0b4b", @@ -62,6 +76,13 @@ "index": "pypi", "version": "==2.5.1" }, + "flask-table": { + "hashes": [ + "sha256:320e5756cd7252e902e03b6cd1087f2c7ebc31364341b482f41f30074d10a770" + ], + "index": "pypi", + "version": "==0.5.0" + }, "flask-wtf": { "hashes": [ "sha256:6ff7af73458f182180906a37a783e290bdc8a3817fe4ad17227563137ca285bf", @@ -202,6 +223,13 @@ ], "version": "==1.0.4" }, + "pytz": { + "hashes": [ + "sha256:83a4a90894bf38e243cf052c8b58f381bfe9a7a483f6a9cab140bc7f702ac4da", + "sha256:eb10ce3e7736052ed3623d49975ce333bcd712c7bb19a58b9e2089d4057d0798" + ], + "version": "==2021.1" + }, "six": { "hashes": [ "sha256:1e61c37477a1626458e36f7b1d82aa5c9b094fa4802892072e49de9c60c4c926", diff --git a/app/models.py b/app/models.py index f2a1112..d96e2b3 100644 --- a/app/models.py +++ b/app/models.py @@ -1,4 +1,7 @@ from flask_login import UserMixin +from flask_table import Col, Table + +# from sqlalchemy.ext.declarative.api import instrument_declarative from werkzeug.security import check_password_hash, generate_password_hash from app import db, login @@ -23,3 +26,18 @@ class User(UserMixin, db.Model): @login.user_loader def load_user(id): return User.query.get(int(id)) + + +class Networks(Table): + ssid = Col("SSID") + signal = Col("Signal Strength") + inuse = Col("Connected") + security = Col("Security") + + +class Network(object): + def __init__(self, ssid, signal, inuse, security): + self.ssid = ssid + self.signal = signal + self.inuse = inuse + self.security = security diff --git a/app/routes.py b/app/routes.py index 9f07e1f..153a254 100644 --- a/app/routes.py +++ b/app/routes.py @@ -3,15 +3,22 @@ from flask_login import current_user, login_required, login_user, logout_user from app import app from app.forms import LoginForm -from app.models import User +from app.models import User, Network, Networks @app.route("/") @app.route("/index") @login_required -def index(): - user = {"username": "Miguel"} - return render_template("index.html", title="Home", user=user) +def search_results(): + results = [] + scan = ["rpi:100: :WPA2", "Home:94:*:WPA2", "HOME2:48: :WPA2", "BT:23: :"] + for item in scan: + erm = Network(item.split(":")[0], item.split(":")[1], item.split(":")[2], item.split(":")[3]) + results.append(erm) + + table = Networks(results) + table.border = True + return render_template("index.html", table=table) @app.route("/login", methods=["GET", "POST"]) diff --git a/app/templates/index.html b/app/templates/index.html index 1a3e36c..f5c6c2a 100644 --- a/app/templates/index.html +++ b/app/templates/index.html @@ -1,16 +1,4 @@ - - - - Travel Router - - - -

Hi, {{ user.username }}!

- {% for post in posts %} -
-

{{ post.author.username }} says: {{ post.body }}

-
- {% endfor %} - - - \ No newline at end of file + + Networks + {{ table }} + \ No newline at end of file