""" The web application built on Flask is contained within this file. When run as a script, the Flask development server is started. """ import os, socket import submission_pb2, storage from flask import Flask, request app = Flask(__name__) store = storage.FilesystemStorage('logs/') @app.route('/') def index(): pass @app.route('/submit', methods=['POST']) def submit(): submission = submission_pb2.Submission() submission.ParseFromString(request.data) source = socket.getfqdn(request.remote_addr) # TODO: is this ok? # TODO: pass through analyser for f in submission.files: store.save_file(source, f.filename, f.data) return '' if __name__ == '__main__': app.run(host='::1', debug=True)