Skip to content

Instantly share code, notes, and snippets.

@ianatha
Created August 20, 2019 23:57
Show Gist options
  • Save ianatha/26d2860543af7c114e1a692f444ca78c to your computer and use it in GitHub Desktop.
Save ianatha/26d2860543af7c114e1a692f444ca78c to your computer and use it in GitHub Desktop.
DEFCON 27 BHV CTF MedMonitor task
#!/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