ProfessionalCommunity Edition

Filtering the HTTP history with Bambdas

  • Last updated: December 14, 2023

  • Read time: 3 Minutes

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

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

  • ProxyHttpRequestResponse

  • Utilities

To create a Bambda to filter your HTTP history:

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

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

  2. In the Configure 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 HTTP history, and to any future HTTP traffic generated in this project.

Example Bambda

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

  • The request must have a response.

  • The response must have a 3XX status code.

  • The response must have a cookie set with the name session.

In this example, our Bambda is:

if (!requestResponse.hasResponse()) { return false; } var response = requestResponse.response(); return response.isStatusCodeClass(StatusCodeClass.CLASS_3XX_REDIRECTION) && response.hasCookie("session");

Converting HTTP history filter settings to Bambdas

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

Note

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

To convert your filter settings to a Bambda:

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

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

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

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

Saving Bambdas

You can save your Bambda as a JSON file. This makes it easy for you to migrate your filter configuration to other projects.

To save a Bambda:

  1. In the Bambda mode tab of the Configure filter window, click settings .

  2. Click Save settings.

Your Bambda is now downloaded as a JSON file.

Loading Bambdas

You can load a saved Bambda into other projects.

To load a Bambda:

  1. In the Bambda mode tab of the Configure filter window, click settings .

  2. Click Load settings, then select your Bambda JSON file via the system dialogue.

  3. Click Apply.

Your Bambda is now loaded in Burp.

Note

Bambdas are only compatible with the tool that they were exported from. For example, a Bambda created for filtering the HTTP history cannot be loaded in a different Burp tool.

Troubleshooting Bambdas

There are two types of error you may encounter when working with Bambdas: compilation and runtime.

Compilation errors

Burp highlights compilation errors in real time by underlining them in red in the Bambda mode editor. You must resolve any compilation errors before Burp can apply your Bambda.

To display details of the error, hover over the red underline. If you click Apply while your Bambda contains compilation errors, the error details are shown in the Compilation errors tab.

Runtime errors

Runtime errors can occur after a Bambda has been applied. If Burp detects any runtime errors, a banner appears above the filter bar on the Proxy > HTTP history. Click Edit Bambda to view the error details, and make changes to the code.

Was this article helpful?