Burp Suite User Forum

Create new post

Callbacks method to get the BurpExtender instance

August | Last updated: Dec 12, 2016 07:51PM UTC

Is there a method in IBurpExtenderCallbacks or IExtensionHelpers to get the actual BurpExtender instance? If not, would you consider adding one?

PortSwigger Agent | Last updated: Dec 13, 2016 08:40AM UTC

By "the actual BurpExtender instance", I assume you mean the instance of your own extension. This is a class that you fully control. If you need to hold a reference to the instance of it, then store it somewhere when it is constructed, or pass a reference to the instance into any other locations that need it.

Burp User | Last updated: Dec 15, 2016 12:46AM UTC

That is essentially what I did: Created a singleton instance and then added a static getInstance() method to the BurpExtender class: private static BurpExtender instance = this; public static BurpExtender getInstance() { return instance; } Is this a safe approach to use? Does Burp ever construct more than one instance of an extension?

PortSwigger Agent | Last updated: Dec 15, 2016 08:53AM UTC

Burp won't construct more than one instance of an extension within the same classloader (extensions are each loaded in separate classloaders to prevent naming collisions). So the singleton is safe enough. But it's not obligatory, since it should be possible to pass the reference to your BurpExtender instance to any other component that will ever need to access it.

Burp User | Last updated: Dec 15, 2016 05:39PM UTC

I find this singleton method easier to work with -Sometimes it is difficult to know up front exactly which classes will need access to the Extender instance, especially when dealing with UI components, inner classes, etc.

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