Burp Suite User Forum

Create new post

Creating new WebSocket via Montoya API?

Elliot | Last updated: Mar 10, 2023 12:59PM UTC

Hello, I am excited to see the Montoya API now adds support for WebSockets and I am trying to create new WebSocket connections. However I can't see to see a way to do this, I can only send messages inside an established WebSocket. This is quite important as WebSocket connections may get closed and to start sending messages again we need to create a new WebSocket using the `webSocketCreation.upgradeRequest()` - in a similar way to when using the repeater you can "reconnect" an existing WebSocket. Is it possible to do this using the new API or is this limited to WebSockets opened through the proxy? I have tried using the following - burp.api.montoya.websocket.WebSockets.createWebSocket(burp.api.montoya.http.message.requests.HttpRequest), but I can't see any implementations of this interface so at runtime I just get a `java.lang.NoSuchMethodError: 'burp.api.montoya.websocket.extension.ExtensionWebSocketCreation burp.api.montoya.websocket.WebSockets.createWebSocket` error. Here is an example where I have tried to take an incoming websocket creation and duplicate it (just for illustrative purposes) ```public void handleWebSocketCreation(ProxyWebSocketCreation webSocketCreation) { webSocketCreation.proxyWebSocket().registerProxyMessageHandler(new MyProxyWebSocketMessageHandler(this.api)); ExtensionWebSocketCreation s = this.api.websockets().createWebSocket(webSocketCreation.upgradeRequest()); } ``` Any help on creating websockets from an extension would be apprciated. Thanks!

Hannah, PortSwigger Agent | Last updated: Mar 14, 2023 04:04PM UTC

Hi Could you tell me the version of Burp that you are using? Are you using Burp Suite Professional or Community edition?

You must be an existing, logged-in customer to reply to a thread. Please email us for additional support.