-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathUMPenTest_RFID_hack.py
47 lines (38 loc) · 1.3 KB
/
UMPenTest_RFID_hack.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
from flask_bootstrap import Bootstrap
from flask import Flask, render_template, flash, redirect, url_for
from config import DevelopmentConfig
from arduino_controller import Controller
bootstrap = Bootstrap()
app = Flask(__name__, instance_relative_config=True)
bootstrap.init_app(app)
# Immeditly create arduino controller, and start
arduino_cont = Controller()
arduino_cont.start()
app.config.from_object(DevelopmentConfig)
@app.route('/')
@app.route('/index')
def index():
""" login page """
return render_template('index.html', title='Home')
@app.route('/home')
def home():
""" homepage """
return render_template('home.html', title='Home', dropdown_codes=arduino_cont.codes)
@app.route('/home/sendCode/<codeIndex>')
def sendCode(codeIndex):
""" output to rasp """
print('Sending code index: ', codeIndex)
return arduino_cont.write(int(codeIndex))
@app.route('/sendAuth/<username>/<password>')
def sendAuth(username, password):
""" sends authentication data to backend """
print('Sending auth data to backend...')
if username == "ump_hacker" and password == "aH-KeE-aY-Me_h0seA":
return 'True'
return 'False'
@app.route('/home/lock')
def lock():
""" output to rasp """
return arduino_cont.lock()
if __name__ == '__main__':
app.run(host='0.0.0.0', port='80')