mitmproxy/libmproxy/app.py

29 lines
686 B
Python
Raw Normal View History

2013-03-24 20:20:26 +00:00
import flask
import os.path
import proxy
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, proxy.CONF_BASENAME + "-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, proxy.CONF_BASENAME + "-cert.p12")
2014-02-07 01:36:39 +00:00
return flask.Response(open(p, "rb").read(), mimetype='application/x-pkcs12')