mitmproxy/libmproxy/app.py

28 lines
669 B
Python
Raw Normal View History

2013-03-24 20:20:26 +00:00
import flask
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
def master():
return flask.request.environ["mitmproxy.master"]
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():
capath = master().server.config.cacert
p = os.path.splitext(capath)[0] + "-cert.pem"
return flask.Response(open(p).read(), mimetype='application/x-x509-ca-cert')
@mapp.route("/cert/p12")
def certs_p12():
capath = master().server.config.cacert
p = os.path.splitext(capath)[0] + "-cert.p12"
return flask.Response(open(p).read(), mimetype='application/x-pkcs12')