diff options
author | Thomas Kriechbaumer <thomas@kriechbaumer.name> | 2018-10-09 18:24:18 +0200 |
---|---|---|
committer | Thomas Kriechbaumer <thomas@kriechbaumer.name> | 2018-10-09 18:34:57 +0200 |
commit | 13e1f8b4218ce885d91486cddbc9c2e9b970826f (patch) | |
tree | d3413238c3919f590e218a055b12f3e08232a889 /examples | |
parent | a8b809dcbc43520dbe1648e008227bce160d943f (diff) | |
download | mitmproxy-13e1f8b4218ce885d91486cddbc9c2e9b970826f.tar.gz mitmproxy-13e1f8b4218ce885d91486cddbc9c2e9b970826f.tar.bz2 mitmproxy-13e1f8b4218ce885d91486cddbc9c2e9b970826f.zip |
add websocket example
Diffstat (limited to 'examples')
-rw-r--r-- | examples/simple/websocket_messages.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/examples/simple/websocket_messages.py b/examples/simple/websocket_messages.py new file mode 100644 index 00000000..719e7b10 --- /dev/null +++ b/examples/simple/websocket_messages.py @@ -0,0 +1,13 @@ +import re +from mitmproxy import ctx + + +def websocket_message(flow): + # get the latest message + message = flow.messages[-1] + + # simply print the content of the message + ctx.log.info(message.content) + + # manipulate the message content + message.content = re.sub(r'^Hello', 'HAPPY', message.content) |