I'm developing a Burp Suite extension.
I have a class BurpExtender, it has public static field.
public class BurpExtender implements IBurpExtender, IContextMenuFactory{
private IBurpExtenderCallbacks callbacks;
public static PrintWriter stdout;
public static IExtensionHelpers helpers;
...
@Override
public void registerExtenderCallbacks(IBurpExtenderCallbacks callbacks) {
this.callbacks = callbacks;
this.helpers = callbacks.getHelpers();
PrintWriter stdout = new PrintWriter(callbacks.getStdout(), true);
callbacks.setExtensionName("REQUESTSENDER");
callbacks.registerContextMenuFactory(BurpExtender.this);
stdout.println("Registered");
}
public List<JMenuItem> createMenuItems(final IContextMenuInvocation invocation) {
List<JMenuItem> menuItemList = new ArrayList<JMenuItem>();
JMenuItem item = new JMenuItem(new MyAction());
menuItemList.add(item);
return menuItemList;
}
and in this file i have another class MyAction:
private class MyAction extends AbstractAction{
public MyAction(){
super("Name");
}
public void actionPerformed(ActionEvent e) {
//Here i want to use BurpExtender.helpers, but i cant figure out, how to.
//BurpExtender.stdout doesnt work here. Dunno why, NullPoinerException.
}
}
I had another solution, when i tryed to do smth like JMenuItem item = new JMenuItem(new AbstractAction("123") {...} result it the same