add websocket example

This commit is contained in:
Thomas Kriechbaumer 2018-10-09 18:24:18 +02:00
parent a8b809dcbc
commit 13e1f8b421
1 changed files with 13 additions and 0 deletions

View File

@ -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)