Created
August 20, 2019 23:57
-
-
Save ianatha/26d2860543af7c114e1a692f444ca78c to your computer and use it in GitHub Desktop.
DEFCON 27 BHV CTF MedMonitor task
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python2 | |
import os | |
import sys | |
import struct | |
from flask import Flask, request, render_template, redirect, url_for, flash, make_response | |
import pickle | |
app = Flask(__name__) | |
@app.route('/register_patient') | |
def patient_register(): | |
try: | |
a = request.args.get('token').decode("base64") | |
dev = pickle.loads(a) | |
name = request.args.get('patient_name') | |
data = request.args.get('patient_data') | |
print dev["id"] | |
# cur = engine.execute("INSERT INTO patient (id_device, name, confidential_data) VALUES (%d, '%s', '%s')" % (dev["id"], name, data)) | |
return "REGISTERED" | |
except Exception as e: | |
print e | |
return "ERROR" | |
if __name__ == '__main__': | |
app.debug = True | |
app.run(threaded=True,host="0.0.0.0", port=5001) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment