# How to use console replace command?

**URL:** <https://discourse.mitmproxy.org/t/how-to-use-console-replace-command/59>\
**Category:** help\
**Created:** [June 23, 2016, 2:49pm UTC](https://discourse.mitmproxy.org/t/how-to-use-console-replace-command/59 "2016-06-23T14:49:25Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Max](https://avatars.discourse-cdn.com/v4/letter/m/e5b9ba/32.png) [@Max](https://discourse.mitmproxy.org/u/Max)\
**Post date:** [June 23, 2016, 2:49pm UTC](https://discourse.mitmproxy.org/t/how-to-use-console-replace-command/59/1 "2016-06-23T14:49:26Z")

</div>

I’m trying to use mitmproxy as a content filter proxy, but isn`t work. How to use it? Can somebody point me to any manual? I found just [http://docs.mitmproxy.org/en/stable/features/replacements.html](http://docs.mitmproxy.org/en/stable/features/replacements.html) but when i started mitmdump -replace :~q:tester:testerONE and visit [https://en.wikipedia.org/wiki/Test](https://en.wikipedia.org/wiki/Test) nothing changed… Tnx.

---

<div class="post-metadata">

**Author:** ![mhils](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mitmproxy.org/mhils/32/7_2.png) [@mhils](https://discourse.mitmproxy.org/u/mhils)\
**Post date:** [June 23, 2016, 11:07pm UTC](https://discourse.mitmproxy.org/t/how-to-use-console-replace-command/59/2 "2016-06-23T23:07:16Z")

</div>

`~q` only replaces stuff in requests, not responses - what did you expect to happen?

---

<div class="post-metadata">

**Author:** ![Max](https://avatars.discourse-cdn.com/v4/letter/m/e5b9ba/32.png) [@Max](https://discourse.mitmproxy.org/u/Max)\
**Post date:** [June 24, 2016, 12:55am UTC](https://discourse.mitmproxy.org/t/how-to-use-console-replace-command/59/3 "2016-06-24T00:55:49Z")

</div>

So, i need to change web content, like as in privoxy, but for https. Is it possible? if yes, then how?

---

<div class="post-metadata">

**Author:** ![mhils](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mitmproxy.org/mhils/32/7_2.png) [@mhils](https://discourse.mitmproxy.org/u/mhils)\
**Post date:** [June 24, 2016, 1:34am UTC](https://discourse.mitmproxy.org/t/how-to-use-console-replace-command/59/4 "2016-06-24T01:34:59Z")

</div>

[http://docs.mitmproxy.org/en/stable/features/filters.html](http://docs.mitmproxy.org/en/stable/features/filters.html)

`~q` means that you only want to apply changes to requests. You want `~s`. 😃

---

<div class="post-metadata">

**Author:** ![Max](https://avatars.discourse-cdn.com/v4/letter/m/e5b9ba/32.png) [@Max](https://discourse.mitmproxy.org/u/Max)\
**Post date:** [June 27, 2016, 1:03pm UTC](https://discourse.mitmproxy.org/t/how-to-use-console-replace-command/59/5 "2016-06-27T13:03:51Z")

</div>

Nice!! Thanks!!

but… next question:  
is it posiible to use lists of replacements from command line? i.e. any file or files with replacements rules like as  
…  
pattern1 -\> replacement1  
pattern2 -\> replacement2  
pattern3 -\> replacement3  
pattern4 -\> replacement4  
…

---

<div class="post-metadata">

**Author:** ![mhils](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.mitmproxy.org/mhils/32/7_2.png) [@mhils](https://discourse.mitmproxy.org/u/mhils)\
**Post date:** [June 29, 2016, 7:48am UTC](https://discourse.mitmproxy.org/t/how-to-use-console-replace-command/59/6 "2016-06-29T07:48:17Z")

</div>

Sure, you can pass `--replace` multiple times.

---

<div class="post-metadata">

**Author:** ![Max](https://avatars.discourse-cdn.com/v4/letter/m/e5b9ba/32.png) [@Max](https://discourse.mitmproxy.org/u/Max)\
**Post date:** [August 15, 2016, 2:10pm UTC](https://discourse.mitmproxy.org/t/how-to-use-console-replace-command/59/7 "2016-08-15T14:10:26Z")

</div>

OK!  
but next question  
how to use python regex for multiline matches in you notation?  
i tried use something like this:  
–replace :~s:(?m\<script.\*?):killjs  
but mitm fall down
