Skip to content

PortSwigger/extension-template-project

Repository files navigation

Extension Template Project

This project was created by PortSwigger to help you quickly start developing extensions in Java.

Contents

Before you start

Before you begin development, make sure that your project's JDK is set to version "21".

Writing your extension

To begin development, open the Extension.java file. It includes an example of setting your extension's name, which you can customize with your own logic.

The template contains the following components for building your extension:

  • The initialize method. This is the entry point for your extension. It is called when the extension is loaded and receives a montoyaApi argument, which provides access to all Montoya API features.
  • The Extension class. This implements the BurpExtension interface, so your extension is recognized and loaded by Burp.

Related resources

Vibe Coding Your Extension with AI

You can use an LLM to help you write your extension. To support this, we've included a CLAUDE.md file and supporting documentation that provide essential context for the model.

Vibe Coding with Claude Code

To use this file with Claude Code:

  1. Open a terminal and navigate to the ExtensionTemplateProject folder.
  2. Run Claude Code using the following command: claude.
  3. Prompt Claude to create some code for your extension.

Claude should automatically read the contents of the ExtensionTemplateProject folder, including the CLAUDE.md file, then create draft code for you to review. If you think it hasn't read the CLAUDE.md file, directly prompt it to do so before continuing.

Vibe Coding with Other LLMs

If you're using an LLM other than Claude Code, prompt the LLM to read the CLAUDE.md file and supporting documentation from the docs folder, or provide their contents as part of your context window.


Building your extension

When you're ready to test and use your extension, follow these steps to build a JAR file and load it into Burp.

Building the JAR file

To build the JAR file, run the following command in the root directory of this project:

  • For UNIX-based systems: ./gradlew jar
  • For Windows systems: gradlew jar

If successful, the JAR file is saved to <project_root_directory>/build/libs/<project_name>.jar. If the build fails, errors are shown in the console. By default, the project name is extension-template-project. You can change this in the settings.gradle.kts file.

Loading the JAR file into Burp

To load the JAR file into Burp:

  1. In Burp, go to Extensions > Installed.
  2. Click Add.
  3. Under Extension details, click Select file.
  4. Select the JAR file you just built, then click Open.
  5. [Optional] Under Standard output and Standard error, choose where to save output and error messages.
  6. Click Next. The extension is loaded into Burp.
  7. Review any messages displayed in the Output and Errors tabs.
  8. Click Close.

Your extension is loaded and listed in the Burp extensions table. You can test its behavior and make changes to the code as necessary.

Reloading the JAR file in Burp

If you make changes to the code, you must rebuild the JAR file and reload your extension in Burp for the changes to take effect.

To rebuild the JAR file, follow the steps for building the JAR file.

To quickly reload your extension in Burp:

  1. In Burp, go to Extensions > Installed.
  2. Hold Ctrl or , and select the Loaded checkbox next to your extension.

Sharing your extension

Once you've built your extension, we'd love to see what you've created!

Share your extension on our PortSwigger Discord #extensions channel to get feedback, showcase your work, and connect with other developers. Then take it to the next level by submitting your extension to the BApp store, making it available to the community of 80,000+ users worldwide.

For guidance on the submission process, see Submitting extensions to the BApp store.

About

Contains a ready-to-use extension template to help you start writing your extension immediately.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 7

Languages