2013-03-24 20:20:26 +00:00
|
|
|
import flask
|
2014-01-23 21:46:34 +00:00
|
|
|
import os.path
|
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
|
|
|
|
2014-01-04 21:58:53 +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")
|
|
|
|
|
|
|
|
|
2014-01-05 03:59:27 +00:00
|
|
|
@mapp.route("/cert/pem")
|
|
|
|
def certs_pem():
|
2014-01-23 21:46:34 +00:00
|
|
|
capath = master().server.config.cacert
|
|
|
|
p = os.path.splitext(capath)[0] + "-cert.pem"
|
2014-02-07 01:36:39 +00:00
|
|
|
return flask.Response(open(p, "rb").read(), mimetype='application/x-x509-ca-cert')
|
2014-01-05 03:59:27 +00:00
|
|
|
|
|
|
|
|
|
|
|
@mapp.route("/cert/p12")
|
|
|
|
def certs_p12():
|
2014-01-23 21:46:34 +00:00
|
|
|
capath = master().server.config.cacert
|
|
|
|
p = os.path.splitext(capath)[0] + "-cert.p12"
|
2014-02-07 01:36:39 +00:00
|
|
|
return flask.Response(open(p, "rb").read(), mimetype='application/x-pkcs12')
|
2014-01-05 03:59:27 +00:00
|
|
|
|