mitmproxy/libmproxy/onboarding/app.py

30 lines
742 B
Python
Raw Normal View History

from __future__ import absolute_import
2013-03-24 20:20:26 +00:00
import flask
import os
from ..proxy import config
2013-03-24 20:20:26 +00:00
mapp = flask.Flask(__name__)
2013-07-22 22:28:35 +00:00
mapp.debug = True
2014-02-07 01:36:39 +00:00
def master():
return flask.request.environ["mitmproxy.master"]
2013-03-24 20:20:26 +00:00
2014-02-07 01:36:39 +00:00
2013-03-24 20:20:26 +00:00
@mapp.route("/")
2013-07-22 22:28:35 +00:00
def index():
return flask.render_template("index.html", section="home")
@mapp.route("/cert/pem")
def certs_pem():
p = os.path.join(master().server.config.confdir, config.CONF_BASENAME + "-ca-cert.pem")
2014-02-07 01:36:39 +00:00
return flask.Response(open(p, "rb").read(), mimetype='application/x-x509-ca-cert')
@mapp.route("/cert/p12")
def certs_p12():
p = os.path.join(master().server.config.confdir, config.CONF_BASENAME + "-ca-cert.p12")
2014-02-07 01:36:39 +00:00
return flask.Response(open(p, "rb").read(), mimetype='application/x-pkcs12')