Sophie

Sophie

distrib > Mageia > 4 > x86_64 > by-pkgid > afa0e7c59554a6ec33ced1a95f14102d > files > 172

mitmproxy-0.9.2-4.mga4.noarch.rpm

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta  content="text/html; charset=utf-8" http-equiv="Content-Type"/>


<link  href="01-bootstrap.min.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>mitmproxy 0.9 - Filter expressions</title></head><body><div class="navbar">
  <div class="navbar-inner">
    <div class="container-fluid">
      <a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </a>
      <a class="brand" href="index.html">mitmproxy 0.9 docs</a>
      </div><!--/.nav-collapse -->
    </div>
  </div>
</div>

<div class="container-fluid">
  <div class="row-fluid">
    <div class="span3">
      <div class="well sidebar-nav">
        <ul class="nav nav-list">
            <li><a href="index.html">Introduction</a></li>
            <li><a href="install.html">Installation</a></li>
            <li><a href="mitmproxy.html">mitmproxy</a></li>
            <li><a href="mitmdump.html">mitmdump</a></li>
            <li><a href="faq.html">FAQ</a></li>

            <li class="nav-header">Features</li>
                    <li><a href="anticache.html">Anticache</a></li>
                    <li><a href="clientreplay.html">Client-side replay</a></li>
                    <li class="active"><a href="filters.html">Filter expressions</a></li>
                    <li><a href="proxyauth.html">Proxy Authentication</a></li>
                    <li><a href="replacements.html">Replacements</a></li>
                    <li><a href="serverreplay.html">Server-side replay</a></li>
                    <li><a href="setheaders.html">Set Headers</a></li>
                    <li><a href="sticky.html">Sticky cookies and auth</a></li>
                    <li><a href="reverseproxy.html">Reverse proxy mode</a></li>
                    <li><a href="upstreamcerts.html">Upstream Certs</a></li>

            <li class="nav-header">SSL interception</li>
                    <li><a href="ssl.html">Overview</a></li>
                    <li><a href="certinstall/firefox.html">Firefox</a></li>
                    <li><a href="certinstall/osx.html">OSX</a></li>
                    <li><a href="certinstall/windows7.html">Windows 7</a></li>
                    <li><a href="certinstall/ios.html">IOS</a></li>
                    <li><a href="certinstall/android.html">Android</a></li>

            <li class="nav-header">Transparent Proxying</li>
                    <li><a href="transparent.html">Overview</a></li>
                    <li><a href="transparent/linux.html">Linux</a></li>
                    <li><a href="transparent/osx.html">OSX</a></li>

             <li class="nav-header">Tutorials</li>
                    <li><a href="tutorials/30second.html">Client playback: a 30 second example</a></li>
                    <li><a href="tutorials/gamecenter.html">Setting highscores on Apple's GameCenter</a></li>

            <li class="nav-header">Scripting mitmproxy</li>
                    <li><a href="scripting/inlinescripts.html">Inline Scripts</a></li>
                    <li><a href="scripting/libmproxy.html">libmproxy</a></li>
        </ul>
      </div>
    </div>

    <div class="span9">
        <div class="page-header">
        <h1>Filter expressions</h1>
        </div>
        <p>Many commands in <strong>mitmproxy</strong> and <strong>mitmdump</strong> take a filter expression.
Filter expressions consist of the following operators:</p>

<table class="table">
    <tbody>
        <tr>
            <td class="filt_cmd">~a</td>
            <td class="filt_help">Match asset in response: CSS, Javascript, Flash, images.</td>
        </tr>
        <tr>
            <td class="filt_cmd">~b regex</td>
            <td class="filt_help">Body</td>
        </tr>
        <tr>
            <td class="filt_cmd">~bq regex</td>
            <td class="filt_help">Request body</td>
        </tr>
        <tr>
            <td class="filt_cmd">~bs regex</td>
            <td class="filt_help">Response body</td>
        </tr>
        <tr>
            <td class="filt_cmd">~c int</td>
            <td class="filt_help">HTTP response code</td>
        </tr>
        <tr>
            <td class="filt_cmd">~d regex</td>
            <td class="filt_help">Domain</td>
        </tr>
        <tr>
            <td class="filt_cmd">~e</td>
            <td class="filt_help">Match error</td>
        </tr>
        <tr>
            <td class="filt_cmd">~h regex</td>
            <td class="filt_help">Header</td>
        </tr>
        <tr>
            <td class="filt_cmd">~hq regex</td>
            <td class="filt_help">Request header</td>
        </tr>
        <tr>
            <td class="filt_cmd">~hs regex</td>
            <td class="filt_help">Response header</td>
        </tr>
        <tr>
            <td class="filt_cmd">~m regex</td>
            <td class="filt_help">Method</td>
        </tr>
        <tr>
            <td class="filt_cmd">~q</td>
            <td class="filt_help">Match request with no response</td>
        </tr>
        <tr>
            <td class="filt_cmd">~s</td>
            <td class="filt_help">Match response</td>
        </tr>
        <tr>
            <td class="filt_cmd">~t regex</td>
            <td class="filt_help">Content-type header</td>
        </tr>
        <tr>
            <td class="filt_cmd">~tq regex</td>
            <td class="filt_help">Request Content-Type header</td>
        </tr>
        <tr>
            <td class="filt_cmd">~ts regex</td>
            <td class="filt_help">Response Content-Type header</td>
        </tr>
        <tr>
            <td class="filt_cmd">~u regex</td>
            <td class="filt_help">URL</td>
        </tr>
        <tr>
            <td class="filt_cmd">!</td>
            <td class="filt_help">unary not</td>
        </tr>
        <tr>
            <td class="filt_cmd">&amp;</td>
            <td class="filt_help">and</td>
        </tr>
        <tr>
            <td class="filt_cmd">|</td>
            <td class="filt_help">or</td>
        </tr>
        <tr>
            <td class="filt_cmd">(...)</td>
            <td class="filt_help">grouping</td>
        </tr>
    </tbody>
</table>

<ul>
<li>Regexes are Python-style</li>
<li>Regexes can be specified as quoted strings</li>
<li>Header matching (~h, ~hq, ~hs) is against a string of the form "name: value".</li>
<li>Strings with no operators are matched against the request URL.</li>
<li>The default binary operator is &amp;.</li>
</ul>

<h1>Examples</h1>

<p>URL containing "google.com":</p>

<pre><code>google\.com
</code></pre>

<p>Requests whose body contains the string "test":</p>

<pre><code>~q ~b test
</code></pre>

<p>Anything but requests with a text/html content type:</p>

<pre><code>!(~q &amp; ~t \"text/html\")
</code></pre>

    </div>

  </div><!--/row-->

  <hr>

  <footer>
    <p>© mitmproxy project, 2013</p>
  </footer>

</div><!--/.fluid-container-->
</body></html>