Permalink
Browse files

Initial checkin.

  • Loading branch information...
cortesi committed Feb 16, 2010
0 parents commit cb0e3287090786fad566feb67ac07b8ef361b2c3
@@ -0,0 +1,8 @@
MANIFEST
/build
/dist
/tmp
/doc
*.py[cd]
*.swp
*.swo
674 LICENSE

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -0,0 +1,5 @@
include LICENSE
recursive-include doc *
recursive-include test *
recursive-include libmproxy/resources *
recursive-exclude test *.swo *.swp *.pyc
38 README
@@ -0,0 +1,38 @@
mitmproxy is an interactive SSL-capable intercepting HTTP proxy. It lets you to
observe, modify and replay requests and responses on the fly. The underlying
library that mitmproxy is built on can also be used to do these things
programmatically.
By default, mitmproxy starts up with a mutt-like interactive curses interface -
the help page (which you can view by pressing "?") should tell you everything
you need to know. Note that requests and responses are stored in-memory until
you delete them, so leaving mitmproxy running indefinitely or requesting very
large amounts of data through it is a bad idea.
mitmproxy intercepts SSL requests by simply assuming that all CONNECT requests
are https. The connection from the browser is wrapped in SSL, and we read the
request by pretending to be the connecting server. We then open an SSL request
to the destination server, and replay the request.
Releases can be found here: http://corte.si/software
Source is hosted here: http://github.com/cortesi/mitmproxy
Requirements
------------
* The curses interface relies on a current version of the
[urwid](http://excess.org/urwid/) library.
* The test suite uses the [pry](http://github.com/cortesi/pry) unit testing
library.
You should also make sure that your console environment is set up with the
following:
* EDITOR environment variable to determine the external editor.
* PAGER environment variable to determine the external pager.
* Appropriate entries in your mailcap files to determine external
viewers for request and response contents.

Some generated files are not rendered by default. Learn more.

Oops, something went wrong.
@@ -0,0 +1,95 @@
body {
-x-system-font:none;
font-family: Helvetica,Arial,Tahoma,Verdana,Sans-Serif;
color: #555555;
font-size: 1.3em;
}
a {
color: #3F8ED8;
}
#hd {
margin: 0;
border-bottom: 1px solid #999;
}
#hd h1 {
letter-spacing: 3px;
font-size: 2.5em;
line-height: 100%;
margin: 0.3em 0;
font-weight: normal;
}
#bd {
padding: 20px;
}
#bd h1 {
font-size: 1.6em;
margin-top: 5px;
margin-bottom: 5px;
}
#bd h2 {
font-size: 1.2em;
margin-top: 5px;
margin-bottom: 5px;
}
#ft {
color: #aaa;
border-top: 1px solid #aaa;
clear: both;
margin: 0 0 2em 0;
font-size: 0.8em;
letter-spacing: 0.5px;
}
.pageindex {
font-size: 1.5em;
}
.pageindex ul {
list-style-image:none;
list-style-position:outside;
list-style-type:none;
margin: 0px;
}
.pageindex li {
list-style-image:none;
list-style-position:outside;
list-style-type:none;
margin: 0;
}
.pageindex li.active {
padding-left: 4px;
border-left: 5px solid #ff0000;
}
.pageindex li.inactive{
border-left: none;
margin-left: 9px;
}
.pageindex li li a {
display: block;
background-color: transparent;
margin: 0;
border-top: none;
border-bottom: none;
}
.pageindex ul ul {
margin-left: 20px;
padding: 0;
list-style-type: none;
}
.faq .question {
font-size: 1.1em;
font-weight: bold;
}
@@ -0,0 +1,16 @@
<div class="yui-t2" id="doc3">
<div style="" id="hd">
$!head!$
</div>
<div id="bd">
<div id="yui-main">
<div style="" class="yui-b">$!body!$</div>
</div>
<div style="" class="yui-b">
<div>@!sidebar!@</div>
</div>
</div>
<div style="" id="ft">
<p>@!copyright!@</p>
</div>
</div>
@@ -0,0 +1,14 @@
<h2>Contact</h2>
<p> Please send any comments, suggestions and bug reports to
<a href="mailto:$!docMaintainerEmail!$">$!docMaintainerEmail!$</a>.
</p>
<h2>License</h2>
<pre>
@!license!@
</pre>
@@ -0,0 +1,17 @@
<div class="faq">
<p class="question">On some sites I see a lot of "Connection from.."
entries that never complete.</p>
<p> This is probably because the page requests resources from SSL-protected
domains. These requests are intercepted by mitmproxy, but because we're
using a bogus certificate, the browser-side of the connection hangs. The
browser doesn't prompt you to add a certificate trust exception for remote
page components, only for the primary domain being visited. </p>
<p> To solve this, use something like FireBug to find out which page
components are hanging. Visit the relevant domains using your browser, and
add a certificate trust exception for each one. </p>
</div>
@@ -0,0 +1,3 @@
@!index_contents!@
@@ -0,0 +1,26 @@
import countershape
from countershape import Page, Directory, PythonModule
import countershape.grok
this.layout = countershape.Layout("_layout.html")
this.markup = "markdown"
ns.docTitle = "mitmproxy"
ns.docMaintainer = "Aldo Cortesi"
ns.docMaintainerEmail = "aldo@corte.si"
ns.copyright = "Aldo Cortesi 2010"
ns.head = countershape.template.Template(None, "<h1> @!docTitle!@ - @!this.title!@ </h1>")
ns.sidebar = countershape.widgets.SiblingPageIndex(
'/index.html',
exclude=['countershape']
)
ns.license = file("../LICENSE").read()
ns.index_contents = file("../README").read()
ns.example = file("../examples/stickycookies.py").read()
pages = [
Page("index.html", "introduction"),
Page("library.html", "library"),
Page("faq.html", "faq"),
Page("admin.html", "administrivia")
]
@@ -0,0 +1,15 @@
All of mitmproxy's basic functionality is exposed through the __libmproxy__
library. The example below shows a simple implementation of the "sticky cookie"
functionality included in the interactive mitmproxy program. Traffic is
monitored for __cookie__ and __set-cookie__ headers, and requests are rewritten
to include a previously seen cookie if they don't already have one. In effect,
this lets you log in to a site using your browser, and then make subsequent
requests using a tool like __curl__, which will then seem to be part of the
authenticated session.
<!--(block |pySyntax)-->
$!example!$
<!--(end)-->
@@ -0,0 +1,120 @@
.highlight { background: #f8f8f8; }
.highlight .c { color: #408080; font-style: italic } /* Comment */
.highlight .err { border: 1px solid #FF0000 } /* Error */
.highlight .k { color: #008000; font-weight: bold } /* Keyword */
.highlight .o { color: #666666 } /* Operator */
.highlight .cm { color: #408080; font-style: italic } /* Comment.Multiline */
.highlight .cp { color: #BC7A00 } /* Comment.Preproc */
.highlight .c1 { color: #408080; font-style: italic } /* Comment.Single */
.highlight .cs { color: #408080; font-style: italic } /* Comment.Special */
.highlight .gd { color: #A00000 } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .gr { color: #FF0000 } /* Generic.Error */
.highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */
.highlight .gi { color: #00A000 } /* Generic.Inserted */
.highlight .go { color: #808080 } /* Generic.Output */
.highlight .gp { color: #000080; font-weight: bold } /* Generic.Prompt */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #800080; font-weight: bold } /* Generic.Subheading */
.highlight .gt { color: #0040D0 } /* Generic.Traceback */
.highlight .kc { color: #008000; font-weight: bold } /* Keyword.Constant */
.highlight .kd { color: #008000; font-weight: bold } /* Keyword.Declaration */
.highlight .kp { color: #008000 } /* Keyword.Pseudo */
.highlight .kr { color: #008000; font-weight: bold } /* Keyword.Reserved */
.highlight .kt { color: #B00040 } /* Keyword.Type */
.highlight .m { color: #666666 } /* Literal.Number */
.highlight .s { color: #BA2121 } /* Literal.String */
.highlight .na { color: #7D9029 } /* Name.Attribute */
.highlight .nb { color: #008000 } /* Name.Builtin */
.highlight .nc { color: #0000FF; font-weight: bold } /* Name.Class */
.highlight .no { color: #880000 } /* Name.Constant */
.highlight .nd { color: #AA22FF } /* Name.Decorator */
.highlight .ni { color: #999999; font-weight: bold } /* Name.Entity */
.highlight .ne { color: #D2413A; font-weight: bold } /* Name.Exception */
.highlight .nf { color: #0000FF } /* Name.Function */
.highlight .nl { color: #A0A000 } /* Name.Label */
.highlight .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */
.highlight .nt { color: #008000; font-weight: bold } /* Name.Tag */
.highlight .nv { color: #19177C } /* Name.Variable */
.highlight .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */
.highlight .w { color: #bbbbbb } /* Text.Whitespace */
.highlight .mf { color: #666666 } /* Literal.Number.Float */
.highlight .mh { color: #666666 } /* Literal.Number.Hex */
.highlight .mi { color: #666666 } /* Literal.Number.Integer */
.highlight .mo { color: #666666 } /* Literal.Number.Oct */
.highlight .sb { color: #BA2121 } /* Literal.String.Backtick */
.highlight .sc { color: #BA2121 } /* Literal.String.Char */
.highlight .sd { color: #BA2121; font-style: italic } /* Literal.String.Doc */
.highlight .s2 { color: #BA2121 } /* Literal.String.Double */
.highlight .se { color: #BB6622; font-weight: bold } /* Literal.String.Escape */
.highlight .sh { color: #BA2121 } /* Literal.String.Heredoc */
.highlight .si { color: #BB6688; font-weight: bold } /* Literal.String.Interpol */
.highlight .sx { color: #008000 } /* Literal.String.Other */
.highlight .sr { color: #BB6688 } /* Literal.String.Regex */
.highlight .s1 { color: #BA2121 } /* Literal.String.Single */
.highlight .ss { color: #19177C } /* Literal.String.Symbol */
.highlight .bp { color: #008000 } /* Name.Builtin.Pseudo */
.highlight .vc { color: #19177C } /* Name.Variable.Class */
.highlight .vg { color: #19177C } /* Name.Variable.Global */
.highlight .vi { color: #19177C } /* Name.Variable.Instance */
.highlight .il { color: #666666 } /* Literal.Number.Integer.Long */
.grokdoc { background: #f8f8f8; }
.grokdoc .c { color: #408080; font-style: italic } /* Comment */
.grokdoc .err { border: 1px solid #FF0000 } /* Error */
.grokdoc .k { color: #008000; font-weight: bold } /* Keyword */
.grokdoc .o { color: #666666 } /* Operator */
.grokdoc .cm { color: #408080; font-style: italic } /* Comment.Multiline */
.grokdoc .cp { color: #BC7A00 } /* Comment.Preproc */
.grokdoc .c1 { color: #408080; font-style: italic } /* Comment.Single */
.grokdoc .cs { color: #408080; font-style: italic } /* Comment.Special */
.grokdoc .gd { color: #A00000 } /* Generic.Deleted */
.grokdoc .ge { font-style: italic } /* Generic.Emph */
.grokdoc .gr { color: #FF0000 } /* Generic.Error */
.grokdoc .gh { color: #000080; font-weight: bold } /* Generic.Heading */
.grokdoc .gi { color: #00A000 } /* Generic.Inserted */
.grokdoc .go { color: #808080 } /* Generic.Output */
.grokdoc .gp { color: #000080; font-weight: bold } /* Generic.Prompt */
.grokdoc .gs { font-weight: bold } /* Generic.Strong */
.grokdoc .gu { color: #800080; font-weight: bold } /* Generic.Subheading */
.grokdoc .gt { color: #0040D0 } /* Generic.Traceback */
.grokdoc .kc { color: #008000; font-weight: bold } /* Keyword.Constant */
.grokdoc .kd { color: #008000; font-weight: bold } /* Keyword.Declaration */
.grokdoc .kp { color: #008000 } /* Keyword.Pseudo */
.grokdoc .kr { color: #008000; font-weight: bold } /* Keyword.Reserved */
.grokdoc .kt { color: #B00040 } /* Keyword.Type */
.grokdoc .m { color: #666666 } /* Literal.Number */
.grokdoc .s { color: #BA2121 } /* Literal.String */
.grokdoc .na { color: #7D9029 } /* Name.Attribute */
.grokdoc .nb { color: #008000 } /* Name.Builtin */
.grokdoc .nc { color: #0000FF; font-weight: bold } /* Name.Class */
.grokdoc .no { color: #880000 } /* Name.Constant */
.grokdoc .nd { color: #AA22FF } /* Name.Decorator */
.grokdoc .ni { color: #999999; font-weight: bold } /* Name.Entity */
.grokdoc .ne { color: #D2413A; font-weight: bold } /* Name.Exception */
.grokdoc .nf { color: #0000FF } /* Name.Function */
.grokdoc .nl { color: #A0A000 } /* Name.Label */
.grokdoc .nn { color: #0000FF; font-weight: bold } /* Name.Namespace */
.grokdoc .nt { color: #008000; font-weight: bold } /* Name.Tag */
.grokdoc .nv { color: #19177C } /* Name.Variable */
.grokdoc .ow { color: #AA22FF; font-weight: bold } /* Operator.Word */
.grokdoc .w { color: #bbbbbb } /* Text.Whitespace */
.grokdoc .mf { color: #666666 } /* Literal.Number.Float */
.grokdoc .mh { color: #666666 } /* Literal.Number.Hex */
.grokdoc .mi { color: #666666 } /* Literal.Number.Integer */
.grokdoc .mo { color: #666666 } /* Literal.Number.Oct */
.grokdoc .sb { color: #BA2121 } /* Literal.String.Backtick */
.grokdoc .sc { color: #BA2121 } /* Literal.String.Char */
.grokdoc .sd { color: #BA2121; font-style: italic } /* Literal.String.Doc */
.grokdoc .s2 { color: #BA2121 } /* Literal.String.Double */
.grokdoc .se { color: #BB6622; font-weight: bold } /* Literal.String.Escape */
.grokdoc .sh { color: #BA2121 } /* Literal.String.Heredoc */
.grokdoc .si { color: #BB6688; font-weight: bold } /* Literal.String.Interpol */
.grokdoc .sx { color: #008000 } /* Literal.String.Other */
.grokdoc .sr { color: #BB6688 } /* Literal.String.Regex */
.grokdoc .s1 { color: #BA2121 } /* Literal.String.Single */
.grokdoc .ss { color: #19177C } /* Literal.String.Symbol */
.grokdoc .bp { color: #008000 } /* Name.Builtin.Pseudo */
.grokdoc .vc { color: #19177C } /* Name.Variable.Class */
.grokdoc .vg { color: #19177C } /* Name.Variable.Global */
.grokdoc .vi { color: #19177C } /* Name.Variable.Instance */
.grokdoc .il { color: #666666 } /* Literal.Number.Integer.Long */
Oops, something went wrong.

0 comments on commit cb0e328

Please sign in to comment.