The Burp Suite User Forum was discontinued on the 1st November 2024.

Burp Suite User Forum

For support requests, go to the Support Center. To discuss with other Burp users, head to our Discord page.

SUPPORT CENTER DISCORD

Extension resource loading

Mehrdad | Last updated: Sep 10, 2017 04:35AM UTC

I've embedded some static files inside the extension, in the folder named `assets`. Trying to access them fails, using following code: InputStream in = DataUtils.class.getClassLoader().getResourceAsStream("/assets/" + filename); Maybe it fails because "/" refers to root of `burp.jar`, not my `ext.jar`. How can I access the assets?

Burp User | Last updated: Sep 12, 2017 04:16AM UTC

This code works for me, assuming assets are not loaded in classpath: public static String readAsset(String filename) throws IOException { URL url = new URL("jar:file:/"+BurpExtender.getInstance().getCallbacks().getExtensionFilename()+"!/assets/"+ filename); InputStream in = url.openStream(); StringWriter writer = new StringWriter(); IOUtils.copy(in, writer, StandardCharsets.UTF_8); return writer.toString(); }

PortSwigger Agent | Last updated: Sep 13, 2017 10:54AM UTC