Burp Suite User Forum

Create new post

Montoya API v1.0.0 - java.lang.Exception: Extension class is not a recognized type

Adrian | Last updated: Jan 25, 2023 05:36PM UTC

I would really appreciate if you could write some more documentation for the new API. I can't understand why this won't work. I get the following error message: java.lang.Exception: Extension class is not a recognized type at burp.mk2.o(Unknown Source) at burp.mk2.h(Unknown Source) at burp.pf_.T(Unknown Source) at burp.m7e.l(Unknown Source) at burp.nv3.lambda$panelLoaded$0(Unknown Source) at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:539) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) at java.base/java.lang.Thread.run(Thread.java:833) Here is the source code for the extension. I've tried to make it super simple. package burp.api.montoya; import burp.api.montoya.http.Http; import burp.api.montoya.http.handler.HttpHandler; import burp.api.montoya.http.handler.HttpRequestToBeSent; import burp.api.montoya.http.handler.HttpResponseReceived; import burp.api.montoya.http.handler.RequestToBeSentAction; import burp.api.montoya.http.handler.ResponseReceivedAction; public class TestExtension implements BurpExtension { private MontoyaApi api; private Http http; @Override public void initialize(MontoyaApi api) { this.api = api; api.extension().setName("Test Extension"); http = api.http(); http.registerHttpHandler(hh(api)); } public HttpHandler hh(MontoyaApi api) { return new HttpHandler() { @Override public RequestToBeSentAction handleHttpRequestToBeSent(HttpRequestToBeSent hrtbs) { if (api.scope().isInScope(hrtbs.url())) { String body = hrtbs.body().toString(); System.out.println(body); } return RequestToBeSentAction.continueWith(hrtbs); } @Override public ResponseReceivedAction handleHttpResponseReceived(HttpResponseReceived hrr) { return ResponseReceivedAction.continueWith(hrr); } }; } }

Adrian | Last updated: Jan 25, 2023 06:08PM UTC

Even your own examples don't work, giving the same error. I used these files: https://github.com/PortSwigger/burp-extensions-montoya-api-examples/tree/main/httphandler/src/main/java/example/httphandler Everything compiles fine, but when I load the extension, I get those errors.

Hannah, PortSwigger Agent | Last updated: Jan 26, 2023 09:25AM UTC

Hi Are you using our latest Early Adopter release of Burp (2023.1.1)? The Montoya API v1.0.0 is compatible with versions of Burp v2023.1 onwards.

Adrian | Last updated: Jan 26, 2023 04:25PM UTC

I guess that was it, I'm still on the standard release. Might I suggest you mention that in your official documentation: https://portswigger.net/burp/documentation/desktop/extensions/creating That says to use "LATEST" which is v1.0.0.

Adrian | Last updated: Jan 26, 2023 04:39PM UTC

Actually I just changed to the 0.10.1 API and I'm encountering the same error.

Hannah, PortSwigger Agent | Last updated: Jan 27, 2023 10:03AM UTC

Could you drop us an email at support@portswigger.net with your code so we can investigate this further, please? Alternatively, if you're already hosting this on GitHub, just drop us a link.

Adrian | Last updated: Jan 29, 2023 01:08AM UTC

It looks like something weird was going on with Maven. Recreated everything from scratch and it's working now. No idea what was going on before. Thanks for following up. I would still suggest mentioning on the create extensions page that 1.0 only works with EA releases right now. The "Montoya API GitHub repository" link on that page also goes to a 404, just FYI.

Hannah, PortSwigger Agent | Last updated: Jan 30, 2023 10:47AM UTC

Glad to hear it's working for you now! Thanks for letting us know about the dead link! We'll get this fixed. The links in the sidebar should be up-to-date with the latest repository links.

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