mitmproxy/doc-src/mitmdump.html

69 lines
1.5 KiB
HTML
Raw Normal View History

2011-08-04 22:23:32 +00:00
__mitmdump__ is the command-line companion to mitmproxy. It provides
tcpdump-like functionality to let you view, record, and programmatically
2012-04-04 04:05:18 +00:00
transform HTTP traffic. See the _--help_ flag output for complete
2011-08-04 22:23:32 +00:00
documentation.
2013-03-16 21:50:47 +00:00
# Examples
## Saving traffic
2011-08-04 22:23:32 +00:00
2011-08-05 01:26:39 +00:00
<pre class="terminal">
2011-08-06 01:19:46 +00:00
> mitmdump -w outfile
2011-08-05 01:26:39 +00:00
</pre>
2011-08-04 22:23:32 +00:00
Start up mitmdump in proxy mode, and write all traffic to __outfile__.
2013-03-16 21:50:47 +00:00
## Filtering saved traffic
<pre class="terminal">
> mitmdump -nr infile -w outfile "~m post"
</pre>
Start mitmdump without binding to the proxy port (_-n_), read all flows from
infile, apply the specified filter expression (only match POSTs), and write to
outfile.
## Client replay
2011-08-04 22:23:32 +00:00
2011-08-05 01:26:39 +00:00
<pre class="terminal">
2011-08-06 01:19:46 +00:00
> mitmdump -nc outfile
2011-08-05 01:26:39 +00:00
</pre>
2011-08-04 22:23:32 +00:00
Start mitmdump without binding to the proxy port (_-n_), then replay all
requests from outfile (_-c filename_). Flags combine in the obvious way, so
you can replay requests from one file, and write the resulting flows to
another:
2011-08-05 01:26:39 +00:00
<pre class="terminal">
2011-08-06 01:19:46 +00:00
> mitmdump -nc srcfile -w dstfile
2011-08-05 01:26:39 +00:00
</pre>
2011-08-04 22:23:32 +00:00
See the [Client-side Replay](@!urlTo("clientreplay.html")!@) section for more information.
2013-03-16 21:50:47 +00:00
## Running a script
2011-08-04 22:23:32 +00:00
2011-08-05 01:26:39 +00:00
<pre class="terminal">
2011-08-06 01:19:46 +00:00
> mitmdump -s examples/add_header.py
2011-08-05 01:26:39 +00:00
</pre>
2011-08-04 22:23:32 +00:00
This runs the __add_header.py__ example script, which simply adds a new header
to all responses.
2013-03-16 21:50:47 +00:00
## Scripted data transformation
2011-08-04 22:23:32 +00:00
2011-08-05 01:26:39 +00:00
<pre class="terminal">
2011-08-06 01:19:46 +00:00
> mitmdump -ns examples/add_header.py -r srcfile -w dstfile
2011-08-05 01:26:39 +00:00
</pre>
2011-08-04 22:23:32 +00:00
This command loads flows from __srcfile__, transforms it according to the
specified script, then writes it back to __dstfile__.