Docs, examples.

This commit is contained in:
Aldo Cortesi 2013-03-11 11:49:36 +13:00
parent 5ceef16486
commit c34d1e3de6
11 changed files with 82 additions and 42 deletions

View File

@ -1,19 +1,23 @@
How to install the __mitmproxy__ certificate authority in Firefox: How to install the __mitmproxy__ certificate authority in Firefox:
### 1. If needed, copy the ~/.mitmproxy/mitmproxy-ca-cert.pem file to the target. <ol>
<li> If needed, copy the ~/.mitmproxy/mitmproxy-ca-cert.pem file to the target. </li>
### 2: Open preferences, click on "Advanced", then select"Encryption": <li>Open preferences, click on "Advanced", then select"Encryption":
<img src="@!urlTo('firefox3.jpg')!@"/>
</li>
<img src="@!urlTo('firefox3.jpg')!@"/> <li> Click "View Certificates", "Import", and select the certificate file:
<img src="@!urlTo('firefox3-import.jpg')!@"/>
</li>
### 3: Click "View Certificates", "Import", and select the certificate file: <li>Tick "Trust this CS to identify web sites", and click "Ok":
<img src="@!urlTo('firefox3-trust.jpg')!@"/>
</li>
<img src="@!urlTo('firefox3-import.jpg')!@"/> <li> You should now see the mitmproxy certificate listed in the Authorities
tab.</li>
### 4: Tick "Trust this CS to identify web sites", and click "Ok": </ol>
<img src="@!urlTo('firefox3-trust.jpg')!@"/>
You should now see the mitmproxy certificate listed in the Authorities tab.

View File

@ -1,18 +1,21 @@
How to install the __mitmproxy__ certificate authority on IOS devices: How to install the __mitmproxy__ certificate authority on IOS devices:
### 1: Set up the Mail app on the device to receive email. <ol>
<li>Set up the Mail app on the device to receive email.</li>
### 2: Mail the mitmproxy-ca-cert.pem file to the device, and tap on the attachment. <li>Mail the mitmproxy-ca-cert.pem file to the device, and tap on the attachment.</li>
### 3: You will be prompted to install a profile. Click "Install": <li>You will be prompted to install a profile. Click "Install":
<img src="@!urlTo('ios-profile.png')!@"/> <img src="@!urlTo('ios-profile.png')!@"/></li>
### 4: Accept the warning by clicking "Install" again: <li>Accept the warning by clicking "Install" again:
<img src="@!urlTo('ios-warning.png')!@"/> <img src="@!urlTo('ios-warning.png')!@"/></li>
### 5: The certificate should now be trusted: <li>The certificate should now be trusted:
<img src="@!urlTo('ios-installed.png')!@"/> <img src="@!urlTo('ios-installed.png')!@"/></li>
</ol>

View File

@ -1,13 +1,16 @@
How to install the __mitmproxy__ certificate authority in OSX: How to install the __mitmproxy__ certificate authority in OSX:
### 1: Open Finder, and double-click on the mitmproxy-ca-cert.pem file. <ol>
<li>Open Finder, and double-click on the mitmproxy-ca-cert.pem file.</li>
### 2: You will be prompted to add the certificate. Click "Always Trust": <li>You will be prompted to add the certificate. Click "Always Trust":
<img src="@!urlTo('osx-addcert-alwaystrust.png')!@"/> <img src="@!urlTo('osx-addcert-alwaystrust.png')!@"/>
</li>
You may be prompted for your password. You should now see the mitmproxy cert <li> You may be prompted for your password. You should now see the
listed under "Certificates". mitmproxy cert listed under "Certificates".</li>
</ol>

View File

@ -1,19 +1,32 @@
How to install the __mitmproxy__ certificate authority in Windows 7: How to install the __mitmproxy__ certificate authority in Windows 7:
### 1: Copy the ~/.mitmproxy/mitmproxy-ca-cert.p12 file to the target system. <ol>
### 2: Double-click the certificate file. You should see a certificate import wizard: <li> Copy the ~/.mitmproxy/mitmproxy-ca-cert.p12 file to the target system. </li>
<img src="@!urlTo('win7-wizard.png')!@"/> <li>
Double-click the certificate file. You should see a certificate import wizard:
### 3: Click "Next" until you're prompted for the certificate store: <img src="@!urlTo('win7-wizard.png')!@"/>
</li>
<img src="@!urlTo('win7-certstore.png')!@"/> <li>
Click "Next" until you're prompted for the certificate store:
### 4: Select "Place all certificates in the following store", and select "Trusted Root Certification Authorities": <img src="@!urlTo('win7-certstore.png')!@"/>
<img src="@!urlTo('win7-certstore-trustedroot.png')!@"/> </li>
### 5: Click "Next" and "Finish".
<li>
<p>Select "Place all certificates in the following store", and select "Trusted Root Certification Authorities":</p>
<img src="@!urlTo('win7-certstore-trustedroot.png')!@"/>
</li>
<li> Click "Next" and "Finish". </li>
</ol>

View File

@ -1,8 +1,9 @@
Asks the user for authentication before they are permitted to use the proxy. Asks the user for authentication before they are permitted to use the proxy.
Authentication headers are stripped from the flows, so they are not passed to Authentication headers are stripped from the flows, so they are not passed to
upstream servers. For now, only HTTP Basic authentication is supported. upstream servers. For now, only HTTP Basic authentication is supported. The
proxy auth options are ignored if the proxy is in transparent or reverse proxy
mode.
<table class="table"> <table class="table">
<tbody> <tbody>

View File

@ -22,8 +22,7 @@ with the secured resources.
<th width="20%">command-line</th> <th width="20%">command-line</th>
<td> <td>
<ul> <ul>
<li>-t (sticky cookies on all requests)</li> <li>-t FILTER</li>
<li>-T FILTER (sticky cookies on requests matching filter</li>
</ul> </ul>
</td> </td>
</tr> </tr>
@ -48,8 +47,7 @@ replay of HTTP Digest authentication.
<th width="20%">command-line</th> <th width="20%">command-line</th>
<td> <td>
<ul> <ul>
<li>-u (sticky auth on all requests)</li> <li>-u FILTER</li>
<li>-U FILTER (sticky auth on requests matching filter</li>
</ul> </ul>
</td> </td>
</tr> </tr>

View File

@ -27,11 +27,12 @@ def mpath(p):
ns.index_contents = file(mpath("README.mkd")).read() ns.index_contents = file(mpath("README.mkd")).read()
def example(s): def example(s):
d = file(mpath(s)).read() d = file(mpath(s)).read().rstrip()
extemp = """<div class="example">%s<div class="example_legend">(%s)</div></div>""" extemp = """<div class="example">%s<div class="example_legend">(%s)</div></div>"""
return extemp%(countershape.template.Syntax("py")(d), s) return extemp%(countershape.template.Syntax("py")(d), s)
ns.example = example ns.example = example
filt_help = [] filt_help = []
for i in filt.filt_unary: for i in filt.filt_unary:
filt_help.append( filt_help.append(

View File

@ -1,7 +1,9 @@
__mitmproxy__ is a console tool that allows interactive examination and __mitmproxy__ is a console tool that allows interactive examination and
modification of HTTP traffic. Use the _?_ shortcut key to view, modification of HTTP traffic. It differs from mitmdump in that all flows are
context-sensitive documentation from any __mitmproxy__ screen. kept in memory, which means that it's intended for taking and manipulating
small-ish samples. Use the _?_ shortcut key to view, context-sensitive
documentation from any __mitmproxy__ screen.
## Flow list ## Flow list

View File

@ -13,6 +13,15 @@ lets the script interact with the global mitmproxy state. The __response__
event also gets an instance of Flow, which we can use to manipulate the event also gets an instance of Flow, which we can use to manipulate the
response itself. response itself.
We can now run this script as follows:
<pre class="terminal">
> mitmdump -s add_header.py
</pre>
The new header will be added to all responses passing through the proxy.
## Events ## Events
@ -60,7 +69,7 @@ Called once on script shutdown, after any other events.
The main classes you will deal with in writing mitmproxy scripts are: The main classes you will deal with in writing mitmproxy scripts are:
<table class="kvtable"> <table class="table">
<tr> <tr>
<th>libmproxy.flow.ClientConnection</th> <th>libmproxy.flow.ClientConnection</th>
<td>Describes a client connection.</td> <td>Describes a client connection.</td>

View File

@ -3,7 +3,7 @@ The first time __mitmproxy__ or __mitmdump__ is started, the following set of
certificate files for a dummy Certificate Authority are created in the config certificate files for a dummy Certificate Authority are created in the config
directory (~/.mitmproxy by default): directory (~/.mitmproxy by default):
<table> <table class="table">
<tr> <tr>
<td>mitmproxy-ca.pem</td> <td>mitmproxy-ca.pem</td>
<td>The private key and certificate in PEM format.</td> <td>The private key and certificate in PEM format.</td>
@ -17,6 +17,11 @@ directory (~/.mitmproxy by default):
<td>mitmproxy-ca-cert.p12</td> <td>mitmproxy-ca-cert.p12</td>
<td>The certificate in PKCS12 format. For use on Windows.</td> <td>The certificate in PKCS12 format. For use on Windows.</td>
</tr> </tr>
<tr>
<td>mitmproxy-ca-cert.cer</td>
<td>Same file as .pem, but with an extension expected by some Android
devices.</td>
</tr>
</table> </table>
This CA is used for on-the-fly generation of dummy certificates for SSL This CA is used for on-the-fly generation of dummy certificates for SSL

View File

@ -3,6 +3,7 @@ dup_and_replay.py Duplicates each request, changes it, and then replays th
flowbasic Basic use of mitmproxy as a library. flowbasic Basic use of mitmproxy as a library.
modify_form.py Modify all form submissions to add a parameter. modify_form.py Modify all form submissions to add a parameter.
modify_querystring.py Modify all query strings to add a parameters. modify_querystring.py Modify all query strings to add a parameters.
proxapp How to embed a WSGI app in a mitmproxy server
stub.py Script stub with a method definition for every event. stub.py Script stub with a method definition for every event.
stickycookies An example of writing a custom proxy with libmproxy. stickycookies An example of writing a custom proxy with libmproxy.
upsidedownternet.py Rewrites traffic to turn PNGs upside down. upsidedownternet.py Rewrites traffic to turn PNGs upside down.