Get local path of burp file via API
I'm looking to be able to save information to the same directory as my Burp project file through a Burp Extension.
I organize my project files in folders with respect to the applications I'm testing.
There is the getCommandLineArguments method from callbacks, however I don't run Burp through the command line. I'd be fine doing this, but I'm not sure if I can load a project file this way.
In an extension, I can use os.getpwd() in python to get the working directory of the extension. I don't generally keep my extensions in my project folders. I don't want to place an extension in every project directory.
My need is for this to be dynamic. An API call would be preferred.
I wasn't able to find an API call that met this need. Do other people write to files in their project directory?
There isn’t currently an API to do this, although it’s something we may add in future.
You can load a project from the command like, using the —project-file switch.
What some extensions do as a workaround is use addToSiteMap to add a page to the site map. This isn’t a real page, rather something like http://extension-info/ This lets extensions save data inside the project file. For example, Response Clusterer was recently updated to have this functionality.
I ran the jar like this:
java -jar C:\path_to_jar\burpsuite.jar --project-file=C:\different_path_to_project\my_project.burp
In the registerExtenderCallbacks method I have the following python code to look at the arguments:
print "Arguments are"
for i in callbacks.getCommandLineArguments():
print "Len of args is %d" % len(callbacks.getCommandLineArguments())
In the output I get:
Len of args is 0
I suppose a temporary solution would be to add a settings configuration and manually add the path each time. Then I could run my functionality based on this setting.
Ok, getCommandLineArguments() returns the arguments after the Burp arguments have been parsed, so it won’t help here.
I think that temporary solution is the best for now. We are going to do a refactor of the Extender API in future. We’ll let you know when we’ve added this feature.