<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"><head><meta content="text/html; charset=utf-8" http-equiv="Content-Type"/> <link href="01-reset-fonts-grids-base.css" type="text/css" rel="StyleSheet"/> <link href="02-docstyle.css" type="text/css" rel="StyleSheet"/> <link href="syntax.css" type="text/css" rel="StyleSheet"/> <title>Interception</title></head><body><div id="doc"> <div style="" id="hd" class="doc"> <div id="nav"> <a href="intro.html">prev</a> | <a href="index.html">index</a> | <a href="clientreplay.html">next</a> </div> <h1><a href="index.html">mitmproxy docs</a></h1> </div> <div id="bd"> <div id="yui-main"> <div style="" class="yui-b"> <h1>Interception</h1> <p><strong>mitmproxy</strong>'s interception functionality lets you pause an HTTP request or response, inspect and modify it, and then accept it to send it on to the server or client. Because this is an interactive function, it's only present in <strong>mitmproxy</strong>, not in <strong>mitmdump</strong>. </p> <h3>1: Set an interception pattern</h3> <p><img src="screenshots/intercept-filt.png"/></p> <p>We press <strong>i</strong> to set an interception pattern. In this case, the <strong>~q</strong> filter pattern tells <strong>mitmproxy</strong> to intercept all requests. For complete filter syntax, see the <a href="filters.html">Filter expressions</a> section of this document, or the built-in help function in <strong>mitmproxy</strong>.</p> <h3>2: Intercepted connections are indicated with a red exclamation mark:</h3> <p><img src="screenshots/intercept-mid.png"/></p> <h3>3: You can now view and modify the request:</h3> <p><img src="screenshots/intercept-options.png"/></p> <p>In this case, we viewed the request by selecting it, pressed <strong>e</strong> for "edit" and <strong>m</strong> for "method" to change the HTTP request method.</p> <h3>4: Accept the intercept to continue</h3> <p><img src="screenshots/intercept-result.png"/></p> <p>Finally, we press <strong>a</strong> to accept the modified request, which is then sent on to the server. In this case, we changed the request from an HTTP GET to to OPTIONS, and Google's server has responded with a 405 "Method not allowed". </p> </div> </div> </div> <div style="" id="ft" class="doc"> <p>© mitmproxy project, 2011</p> </div> </div> </body></html>