aboutsummaryrefslogtreecommitdiffstats
path: root/libmproxy/web/app.py
diff options
context:
space:
mode:
authorAldo Cortesi <aldo@nullcube.com>2014-09-10 11:34:58 +1200
committerAldo Cortesi <aldo@nullcube.com>2014-09-10 11:34:58 +1200
commit76982937a68a2adaf96ec2d258e369d7c871a609 (patch)
tree46453bc432035ea5f4405351563529de65ea0ba3 /libmproxy/web/app.py
parente5412e9dd91c37a3f43f68441985b857d29cbbb4 (diff)
downloadmitmproxy-76982937a68a2adaf96ec2d258e369d7c871a609.tar.gz
mitmproxy-76982937a68a2adaf96ec2d258e369d7c871a609.tar.bz2
mitmproxy-76982937a68a2adaf96ec2d258e369d7c871a609.zip
Reorg to put web app in its own directory
Diffstat (limited to 'libmproxy/web/app.py')
-rw-r--r--libmproxy/web/app.py29
1 files changed, 29 insertions, 0 deletions
diff --git a/libmproxy/web/app.py b/libmproxy/web/app.py
new file mode 100644
index 00000000..9b5db38a
--- /dev/null
+++ b/libmproxy/web/app.py
@@ -0,0 +1,29 @@
+from __future__ import absolute_import
+import flask
+import os
+from ..proxy import config
+
+mapp = flask.Flask(__name__)
+mapp.debug = True
+
+
+def master():
+ return flask.request.environ["mitmproxy.master"]
+
+
+@mapp.route("/")
+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")
+ 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")
+ return flask.Response(open(p, "rb").read(), mimetype='application/x-pkcs12')
+