【问题标题】:Mitmproxy, push own WebSocket messagemitmproxy,推送自己的WebSocket消息
【发布时间】:2017-11-09 15:25:11
【问题描述】:

我使用 Mitmproxy 检查 HTTPS WebSocket 流量。目前我可以阅读/编辑 WS 消息:

class Intercept:
    def websocket_message(self, flow):
        print(flow.messages[-1])

def start():
    return Intercept()

.. 作为 Mitmproxy 的附加脚本。

如何将自己的消息推送/注入到客户端?不是编辑现有的,而是添加一条新消息。

【问题讨论】:

    标签: python websocket mitmproxy


    【解决方案1】:

    您可以使用inject.websocket

    from mitmproxy import ctx
    
    class Intercept:
        def websocket_message(self, flow):
            print(flow.messages[-1])
            to_client = True
            ctx.master.commands.call("inject.websocket", flow, to_client, b"Hello World!", True)
    
    def start():
        return Intercept()
    

    文档中有more examples

    【讨论】:

      猜你喜欢
      • 2014-08-15
      • 2014-08-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-10-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多