2013-03-24 20:20:26 +00:00
|
|
|
import flask
|
2014-03-07 03:38:24 +00:00
|
|
|
import os.path, os
|
2014-03-05 04:25:12 +00:00
|
|
|
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
|
|
|
|
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-03-09 20:51:24 +00:00
|
|
|
p = os.path.join(master().server.config.confdir, proxy.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')
|
2014-01-05 03:59:27 +00:00
|
|
|
|
|
|
|
|
|
|
|
@mapp.route("/cert/p12")
|
|
|
|
def certs_p12():
|
2014-03-09 20:51:24 +00:00
|
|
|
p = os.path.join(master().server.config.confdir, proxy.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')
|
2014-01-05 03:59:27 +00:00
|
|
|
|