How portswigger/burp-extensions-montoya-api works
Project type and purpose
• This is a Java library (Montoya API) that provides a plugin-style SDK for writing Burp Suite extensions.
• It exposes a modular, event-driven API (MontoyaApi) that client extensions implement to hook into Burp’s core functionality (HTTP proxy, scanner, intruder, collaborator, UI, etc.).
File-structure highlights
• src/main/java/burp/api/montoya – the public API surface, including MontoyaApi, BurpExtension interface, and sub-packages (http, proxy, scanner, intruder, collaborator, ui, websocket, persistence, utilities, etc.).
• build.gradle, settings.gradle, gradle wrapper – standard Gradle build for producing a JAR and Javadoc.
• docs/javadoc – generated reference docs showing every API package tree.
• src/test – minimal tests on HTTP message parsing.
Key README insights
• You implement BurpExtension.initialize(MontoyaApi) to register callbacks, request handlers, menu items, scanner checks, etc.
• The library is published on Maven Central and consumed via Maven/Gradle.
Main components
a. Burp Suite Host
• The running Burp application that loads Montoya API JARs and client extension JARs.
b. Montoya API Module (this project)
• The façade layer (MontoyaApi) that exposes sub-modules:
• HTTP module (handler, message, sessions)
• Proxy module (HTTP & WebSocket interception)
• Intruder module (payload generation & insertion points)
• Scanner module (crawl & audit checks)
• Collaborator module (out-of-band interactions)
• UI module (context menus, editors, settings panels, hotkeys)
• Utilities & persistence modules
c. Client Extension(s)
• User-written plugins implementing BurpExtension, invoking MontoyaApi modules.
d. External Services
• Maven Central (artifact resolution)
• Optional AI/chat service if using ai/chat sub-module
Relationships and interactions
• Burp Suite Host loads Montoya API → MontoyaApi instantiates internal module factories → client extension receives MontoyaApi in initialize() → extension registers event handlers, scanner checks, UI components → MontoyaApi routes events back into the extension → extension invokes MontoyaApi to modify requests/responses or trigger scans.
• Burp Suite → Montoya API → Extension
• Extension → Montoya API → Burp Suite core engine (proxy, scanner, intruder)
• Montoya API ↔ External Collaborator server for OOB interactions
Architectural patterns and principles
• Plugin architecture: clear separation between host (Burp) and plugins (Montoya + user extensions).
• Facade pattern: MontoyaApi simplifies complex subsystems into cohesive modules.
• Event-driven: modules call back into extension via listener interfaces.
• Modular packaging: each concern lives in its own package, enabling selective use.