aboutsummaryrefslogtreecommitdiffstats
path: root/docs/src/content
diff options
context:
space:
mode:
Diffstat (limited to 'docs/src/content')
-rw-r--r--docs/src/content/addons-events.md16
-rw-r--r--docs/src/content/addons-scripting.md33
-rw-r--r--docs/src/content/concepts-certificates.md2
-rw-r--r--docs/src/content/concepts-commands.md10
-rw-r--r--docs/src/content/concepts-filters.md5
-rw-r--r--docs/src/content/concepts-protocols.md4
-rw-r--r--docs/src/content/tools-mitmdump.md10
-rw-r--r--docs/src/content/tute-clientreplay.md7
8 files changed, 58 insertions, 29 deletions
diff --git a/docs/src/content/addons-events.md b/docs/src/content/addons-events.md
index 489ea342..ddf0a99f 100644
--- a/docs/src/content/addons-events.md
+++ b/docs/src/content/addons-events.md
@@ -21,4 +21,18 @@ header with a count of the number of responses seen:
Below is an addon class that implements stubs for all events. We've added
annotations to illustrate the argument types for the various events.
-{{< example src="examples/addons/events.py" lang="py" >}} \ No newline at end of file
+### Generic Events
+
+{{< example src="examples/addons/events.py" lang="py" >}}
+
+### HTTP Events
+
+{{< example src="examples/addons/events-http-specific.py" lang="py" >}}
+
+### WebSocket Events
+
+{{< example src="examples/addons/events-websocket-specific.py" lang="py" >}}
+
+### TCP Events
+
+{{< example src="examples/addons/events-tcp-specific.py" lang="py" >}}
diff --git a/docs/src/content/addons-scripting.md b/docs/src/content/addons-scripting.md
index 6a18eaf4..c90a9037 100644
--- a/docs/src/content/addons-scripting.md
+++ b/docs/src/content/addons-scripting.md
@@ -5,7 +5,7 @@ menu:
weight: 5
---
-# Scripting
+# Scripting HTTP/1.1 and HTTP/2.0
Sometimes, we would like to write a quick script without going through the
trouble of creating a class. The addons mechanism has a shorthand that allows a
@@ -13,7 +13,6 @@ module as a whole to be treated as an addon object. This lets us place event
handler functions in the module scope. For instance, here is a complete script
that adds a header to every request.
-
{{< example src="examples/addons/scripting-headers.py" lang="py" >}}
@@ -22,11 +21,31 @@ an arbitrary response instead:
{{< example src="examples/simple/send_reply_from_proxy.py" lang="py" >}}
+All events around the HTTP protocol [can be found here]({{< relref "addons-events#http-events">}}).
-You can look at the [http][] module, or the [Request][], and
-[Response][] classes for other attributes that you can use when
+For HTTP-related objects, please look at the [http][] module, or the
+[Request][], and [Response][] classes for other attributes that you can use when
scripting.
-[http]: https://github.com/mitmproxy/mitmproxy/blob/master/mitmproxy/http.py
-[Request]: https://github.com/mitmproxy/mitmproxy/blob/master/mitmproxy/net/http/request.py
-[Response]: https://github.com/mitmproxy/mitmproxy/blob/master/mitmproxy/net/http/response.py
+# Scripting WebSocket
+
+The WebSocket protocol initially looks like a regular HTTP request, before the client and server agree to upgrade the connection to WebSocket. All scripting events for initial HTTP handshake, and also the dedicated WebSocket events [can be found here]({{< relref "addons-events#websocket-events">}}).
+
+{{< example src="examples/simple/websocket_messages.py" lang="py" >}}
+
+For WebSocket-related objects please look at the [websocket][] module to find
+all attributes that you can use when scripting.
+
+[websocket]: https://github.com/mitmproxy/mitmproxy/blob/master/mitmproxy/websocket.py
+
+
+# Scripting TCP
+
+All events around the TCP protocol [can be found here]({{< relref "addons-events#tcp-events">}}).
+
+{{< example src="examples/complex/tcp_message.py" lang="py" >}}
+
+For WebSocket-related objects please look at the [tcp][] module to find
+all attributes that you can use when scripting.
+
+[tcp]: https://github.com/mitmproxy/mitmproxy/blob/master/mitmproxy/tcp.py
diff --git a/docs/src/content/concepts-certificates.md b/docs/src/content/concepts-certificates.md
index 4e2ae47a..4e9aa652 100644
--- a/docs/src/content/concepts-certificates.md
+++ b/docs/src/content/concepts-certificates.md
@@ -48,7 +48,7 @@ documentation for some common platforms. The mitmproxy CA cert is located in
- [Windows (automated)](https://technet.microsoft.com/en-us/library/cc732443.aspx)
{{< highlight bash >}}
-certutil.exe -importpfx Root mitmproxy-ca-cert.p12
+certutil -addstore root mitmproxy-ca-cert.cer
{{< / highlight >}}
- [Mac OS X](https://support.apple.com/kb/PH20129)
diff --git a/docs/src/content/concepts-commands.md b/docs/src/content/concepts-commands.md
index 72f17252..46d76209 100644
--- a/docs/src/content/concepts-commands.md
+++ b/docs/src/content/concepts-commands.md
@@ -60,13 +60,3 @@ just replay flows for a specific domain:
{{< highlight none >}}
:replay.client "~d google.com"
{{< /highlight >}}
-
-
-
-
-
-
-
-
-
-
diff --git a/docs/src/content/concepts-filters.md b/docs/src/content/concepts-filters.md
index f0b9a4b2..b9c89456 100644
--- a/docs/src/content/concepts-filters.md
+++ b/docs/src/content/concepts-filters.md
@@ -49,3 +49,8 @@ Requests whose body contains the string "test":
Anything but requests with a text/html content type:
!(~q & ~t "text/html")
+
+Replace entire GET string in a request (quotes required to make it work):
+
+ ":~q ~m GET:.*:/replacement.html"
+
diff --git a/docs/src/content/concepts-protocols.md b/docs/src/content/concepts-protocols.md
index c79274bf..dc9d84fb 100644
--- a/docs/src/content/concepts-protocols.md
+++ b/docs/src/content/concepts-protocols.md
@@ -73,6 +73,8 @@ If an endpoint sends a PING to mitmproxy, a PONG will be sent back immediately
PING (without a payload) is sent to the other endpoint. Unsolicited PONG's are
not forwarded. All PING's and PONG's are logged (with payload if present).
+Please note that message interception, modification or replay are not possible yet.
+
## Raw TCP / TCP Proxy / Fallback
In case mitmproxy does not handle a specific protocol, you can exempt
@@ -83,7 +85,7 @@ but differs in two important aspects:
* The raw TCP messages are printed to the event log.
* SSL connections will be intercepted.
-Please note that message interception or modification are not possible yet. If
+Please note that message interception, modification or replay are not possible yet. If
you are not interested in the raw TCP messages, you should use the ignore
domains feature.
diff --git a/docs/src/content/tools-mitmdump.md b/docs/src/content/tools-mitmdump.md
index fb6a6c0c..624246d4 100644
--- a/docs/src/content/tools-mitmdump.md
+++ b/docs/src/content/tools-mitmdump.md
@@ -35,16 +35,16 @@ and write to outfile.
### Client replay
{{< highlight bash >}}
-mitmdump -nc outfile
+mitmdump -nC outfile
{{< / highlight >}}
Start mitmdump without binding to the proxy port (`-n`), then replay all
-requests from outfile (`-c filename`). Flags combine in the obvious way,
+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:
{{< highlight bash >}}
-mitmdump -nc srcfile -w dstfile
+mitmdump -nC srcfile -w dstfile
{{< / highlight >}}
See the [client-side replay]({{< relref "overview-features#client-side-replay"
@@ -53,7 +53,7 @@ See the [client-side replay]({{< relref "overview-features#client-side-replay"
### Running a script
{{< highlight bash >}}
-mitmdump -s examples/add_header.py
+mitmdump -s examples/simple/add_header.py
{{< / highlight >}}
This runs the **add_header.py** example script, which simply adds a new
@@ -62,7 +62,7 @@ header to all responses.
### Scripted data transformation
{{< highlight bash >}}
-mitmdump -ns examples/add_header.py -r srcfile -w dstfile
+mitmdump -ns examples/simple/add_header.py -r srcfile -w dstfile
{{< / highlight >}}
This command loads flows from **srcfile**, transforms it according to
diff --git a/docs/src/content/tute-clientreplay.md b/docs/src/content/tute-clientreplay.md
index 1bf69031..048fd0a5 100644
--- a/docs/src/content/tute-clientreplay.md
+++ b/docs/src/content/tute-clientreplay.md
@@ -31,9 +31,8 @@ mitmdump -w wireless-login
## 2. Point your browser at the mitmdump instance.
-I use a tiny Firefox addon called [Toggle
-Proxy](https://addons.mozilla.org/en-us/firefox/addon/toggle-proxy-51740/) to
-switch quickly to and from mitmproxy. I'm assuming you've already [configured
+There is a Firefox addon called [FoxyProxy](https://addons.mozilla.org/fi/firefox/addon/foxyproxy-standard/) that
+lets you switch quickly to and from mitmproxy. I'm assuming you've already [configured
your browser with mitmproxy's SSL certificate authority]({{< relref
"concepts-certificates" >}}).
@@ -43,7 +42,7 @@ And that's it\! You now have a serialised version of the login process
in the file wireless-login, and you can replay it at any time like this:
{{< highlight bash >}}
-mitmdump -c wireless-login
+mitmdump -C wireless-login
{{< / highlight >}}
## Embellishments