Burp Suite Enterprise Edition is now available in our secure Cloud  –  Learn more

ProfessionalCommunity Edition

Filtering the WebSockets history with Bambdas

  • Last updated: March 1, 2024

  • Read time: 2 Minutes

You can write Java-based Bambdas to create custom filters for your WebSockets history.

Two objects of the Montoya API are available to help you write your Bambdas:

  • ProxyWebSocketMessage

  • Utilities

To create a Bambda to filter your WebSockets history:

  1. In the Proxy > WebSockets history tab, click the filter bar to open the WebSockets history filter window.

    The filter bar only appears when there is one or more messages in your WebSockets history.

  2. In the WebSockets history filter window, click the Bambda mode tab.

  3. Write your Bambda using Java.

  4. Click Apply.

Burp compiles your Bambda and applies it to every item already logged in your WebSockets history, and to any future WebSockets traffic generated in this project.

Warning

Using slow running or resource-intensive Bambdas can slow down Burp. Write your Bambda carefully to minimize performance implications.

Example Bambda

In the example below, we'll create a Bambda that filters the WebSockets history to show only items that meet the following criteria:

  • The message must be sent from the server.

  • The message payload length must be greater than 300 characters.

return message.payload().length() > 300 && message.direction() == Direction.SERVER_TO_CLIENT;

Converting filter settings to Bambdas

If you have already used Settings mode to configure a WebSockets history filter, you can convert these settings to a Bambda.

Note

Converting your filter settings overwrites any existing Bambda in your WebSockets history.

To convert your filter settings to a Bambda:

  1. In the Proxy > WebSockets history tab, click the filter bar to open the WebSockets history filter window.

  2. Make changes to the filter settings (if necessary).

  3. At the bottom of the WebSockets history filter window, click Convert to Bambda.

Your filter is now converted into a Bambda, enabling you to customize it further using Java.

Related pages

For more information on how to load Bambdas, save your Bambda, or troubleshoot errors with your Bambda, see our Bambdas documentation.

Was this article helpful?