diff --git a/CHANGELOG b/CHANGELOG index 86c41b13a..e0fb71b6e 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,10 @@ +29 Dec 2014: mitmproxy 0.11.2: + + * Configuration files - mitmproxy.conf, mitmdump.conf, common.conf in the + .mitmproxy directory. + * Better handling of servers that reject connections that are not SNI. + * Many other small bugfixes and improvements. + 15 November 2014: mitmproxy 0.11.1: diff --git a/MANIFEST.in b/MANIFEST.in index cc048b614..3578d855e 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -5,4 +5,6 @@ recursive-include examples * recursive-include doc * recursive-include test * recursive-include libmproxy * -recursive-exclude * *.pyc *.pyo *.swo *.swp \ No newline at end of file +recursive-exclude * *.pyc *.pyo *.swo *.swp +recursive-exclude netlib * +recursive-exclude libpathod * diff --git a/doc-src/_nav.html b/doc-src/_nav.html index 0ae0fa67b..6c3afbe14 100644 --- a/doc-src/_nav.html +++ b/doc-src/_nav.html @@ -7,6 +7,7 @@
mitmproxy.conf | +Settings for the mitmproxy. This file can contain any options supported by mitmproxy. | +
---|---|
mitmdump.conf | +Settings for the mitmdump. This file can contain any options supported by mitmdump. | +
common.conf | + +Settings shared between all command-line tools. Settings in + this file are over-ridden by those in the tool-specific + files. Only options shared by mitmproxy and mitmdump should be used in this file. | +
+# this is a comment +; this is also a comment (.ini style) +--- and this is a comment too (yaml style) ++ +## Key/Value pairs + +- Keys and values are case-sensitive +- Whitespace is ignored +- Lists are comma-delimited, and enclosed in square brackets + +
+name = value # (.ini style) +name: value # (yaml style) +--name value # (command-line option style) + +fruit = [apple, orange, lemon] +indexes = [1, 12, 35 , 40] ++ +## Flags + +These are boolean options that take no value but true/false. + +
+name = true # (.ini style) +name +--name # (command-line option style) ++ +# Options + +The options available in the config files are precisely those available as +command-line flags, with the key being the option's long name. To get a +complete list of these, use the __--help__ option on each of the tools. Be +careful to only specify common options in the __common.conf__ file - +unsupported options in this file will be detected as an error on startup. + +# Examples + +## common.conf + +Note that __port__ is an option supported by all tools. + +
+port = 8080 ++ + +## mitmproxy.conf + +
+palette = light ++ + diff --git a/doc-src/index.py b/doc-src/index.py index 9eb0ea2bd..753f90a5c 100644 --- a/doc-src/index.py +++ b/doc-src/index.py @@ -4,10 +4,13 @@ import datetime import countershape from countershape import Page, Directory, markup, model import countershape.template -sys.path.insert(0, "..") + +MITMPROXY_SRC = os.path.abspath( + os.path.expanduser(os.environ.get("MITMPROXY_SRC", "..")) +) +sys.path.insert(0, MITMPROXY_SRC) from libmproxy import filt, version -MITMPROXY_SRC = os.environ.get("MITMPROXY_SRC", os.path.abspath("..")) ns.VERSION = version.VERSION if ns.options.website: @@ -57,11 +60,13 @@ ns.navbar = countershape.template.File(None, "_nav.html") pages = [ Page("index.html", "Introduction"), Page("install.html", "Installation"), - Page("mitmproxy.html", "mitmproxy"), - Page("mitmdump.html", "mitmdump"), Page("howmitmproxy.html", "How mitmproxy works"), Page("modes.html", "Modes of Operation"), + Page("mitmproxy.html", "mitmproxy"), + Page("mitmdump.html", "mitmdump"), + Page("config.html", "configuration"), + Page("ssl.html", "Overview"), Directory("certinstall"), Directory("scripting"), diff --git a/libmproxy/cmdline.py b/libmproxy/cmdline.py index ec03d63ee..f5c66caab 100644 --- a/libmproxy/cmdline.py +++ b/libmproxy/cmdline.py @@ -194,6 +194,12 @@ def common_options(parser): action= 'version', version= "%(prog)s" + " " + version.VERSION ) + parser.add_argument( + '--shortversion', + action= 'version', + help = "show program's short version number and exit", + version = version.VERSION + ) parser.add_argument( "--anticache", action="store_true", dest="anticache", default=False, @@ -451,9 +457,9 @@ def common_options(parser): "--replay-ignore-payload-param", action="append", dest="replay_ignore_payload_params", type=str, help=""" - Request's payload parameters (application/x-www-form-urlencoded) to - be ignored while searching for a saved flow to replay. - Can be passed multiple times. + Request's payload parameters (application/x-www-form-urlencoded) to + be ignored while searching for a saved flow to replay. + Can be passed multiple times. """ ) diff --git a/libmproxy/onboarding/app.py b/libmproxy/onboarding/app.py index 4023fae2e..f0aecc157 100644 --- a/libmproxy/onboarding/app.py +++ b/libmproxy/onboarding/app.py @@ -1,29 +1,80 @@ from __future__ import absolute_import -import flask import os +import tornado.web +import tornado.wsgi +import tornado.template + +from .. import utils from ..proxy import config -mapp = flask.Flask(__name__) -mapp.debug = True + +loader = tornado.template.Loader(utils.pkg_data.path("onboarding/templates")) -def master(): - return flask.request.environ["mitmproxy.master"] +class Adapter(tornado.wsgi.WSGIAdapter): + # Tornado doesn't make the WSGI environment available to pages, so this + # hideous monkey patch is the easiest way to get to the mitmproxy.master + # variable. + def __init__(self, application): + self._application = application + + def application(self, request): + request.master = self.environ["mitmproxy.master"] + return self._application(request) + + def __call__(self, environ, start_response): + self.environ = environ + return tornado.wsgi.WSGIAdapter.__call__( + self, + environ, + start_response + ) -@mapp.route("/") -def index(): - return flask.render_template("index.html", section="home") +class Index(tornado.web.RequestHandler): + def get(self): + t = loader.load("index.html") + self.write(t.generate()) -@mapp.route("/cert/pem") -def certs_pem(): - p = os.path.join(master().server.config.cadir, config.CONF_BASENAME + "-ca-cert.pem") - return flask.Response(open(p, "rb").read(), mimetype='application/x-x509-ca-cert') +class PEM(tornado.web.RequestHandler): + def get(self): + p = os.path.join( + self.request.master.server.config.cadir, + config.CONF_BASENAME + "-ca-cert.pem" + ) + self.set_header( + "Content-Type", "application/x-x509-ca-cert" + ) + self.write(open(p, "rb").read()) -@mapp.route("/cert/p12") -def certs_p12(): - p = os.path.join(master().server.config.cadir, config.CONF_BASENAME + "-ca-cert.p12") - return flask.Response(open(p, "rb").read(), mimetype='application/x-pkcs12') +class P12(tornado.web.RequestHandler): + def get(self): + p = os.path.join( + self.request.master.server.config.cadir, + config.CONF_BASENAME + "-ca-cert.p12" + ) + self.set_header( + "Content-Type", "application/x-pkcs12" + ) + self.write(open(p, "rb").read()) + + +application = tornado.web.Application( + [ + (r"/", Index), + (r"/cert/pem", PEM), + (r"/cert/p12", P12), + ( + r"/static/(.*)", + tornado.web.StaticFileHandler, + { + "path": utils.pkg_data.path("onboarding/static") + } + ), + ], + #debug=True +) +mapp = Adapter(application) diff --git a/libmproxy/onboarding/templates/frame.html b/libmproxy/onboarding/templates/frame.html index b5c5c67c8..f00e1a66e 100644 --- a/libmproxy/onboarding/templates/frame.html +++ b/libmproxy/onboarding/templates/frame.html @@ -3,7 +3,7 @@