aboutsummaryrefslogtreecommitdiffstats
path: root/libmproxy/app.py
blob: ed7ec72a50f91d88543707029e7b17d046f0a752 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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')