mirror of
https://github.com/Grasscutters/mitmproxy.git
synced 2024-11-30 03:14:22 +00:00
14 lines
313 B
Python
14 lines
313 B
Python
|
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)
|