Burp Suite User Forum

Create new post

setJMenuBar does not work

shader | Last updated: Oct 02, 2022 08:23AM UTC

system: macOS catalina 10.15.4 JDK: 1.8 burpsuite: version 2022.8.5 I build a plugin to show a JFrame with menubar content like this JMenu jMenu1 = new JMenu("File"); JMenu jMenu2 = new JMenu("Edit"); JMenuItem jMenuItem11 = new JMenuItem("New"); JMenuItem jMenuItem12 = new JMenuItem("Open"); JMenuItem jMenuItem21 = new JMenuItem("Undo"); JMenuItem jMenuItem22 = new JMenu("Copy"); JMenuItem jMenuItem221 = new JMenuItem("Copy to"); JMenuItem jMenuItem222 = new JMenuItem("Copy from"); jMenuItem22.add(jMenuItem221); jMenuItem22.add(jMenuItem222); jMenu1.add(jMenuItem11); jMenu1.add(jMenuItem12); jMenu2.add(jMenuItem21); jMenu2.add(jMenuItem22); JMenuBar jMenuBar = new JMenuBar(); jMenuBar.setLayout(new GridLayout(0,1)); jMenuBar.add(jMenu1); jMenuBar.add(jMenu2); JFrame jFrame = new JFrame("Plugin"); jFrame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); jFrame.addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { jFrame.setVisible(false); jFrame.dispose(); } }); jFrame.setJMenuBar(jMenuBar); jFrame.setLayout(new GridLayout()); jFrame.pack(); jFrame.setLocationRelativeTo(null); jFrame.setVisible(true); but after I loaded the plugin, but burpsuite only shows a JFrame without any content like menubar or menuitem I tested the code in standalone app, it worked I think it is burp's bug?

Hannah, PortSwigger Agent | Last updated: Oct 03, 2022 09:18AM UTC

Hi Have you initially provided Burp with your panel? You may want to use IBurpExtenderCallbacks.addSuiteTab() to add a panel to the Burp UI and then place your content in there. If any existing BApp Store extensions use a layout similar to how you want to present your extension, you could check out how they've done it. All BApp Store extensions have their code publicly available on GitHub here: https://github.com/PortSwigger

shader | Last updated: Oct 03, 2022 01:34PM UTC

I was using this burp extension: https://github.com/synacktiv/HopLa and encountered the bug In this extension , it constructs a JFrame to show a payload list like code above and binds it to CTRL+Q (It do use), and you can call out the JFrame just by press CTRL+Q. However, I can not see the JFrame's content (there should be a menuBar in it) I went deep into its code and found that it uses JFrame.add(menuBar) to add menuBar which is rare in common use. I thought here is the bug comes from I tried to fix the bug and I switch it to JFrame.setMenuBar(menuBar) After that I found the problem in this post I have known how to use IBurpExtenderCallbacks.addSuiteTab() but it is not the problem I would like to call out a JFrame by press CTRL+Q because I think it is convienent And I've tried JFrame.setMenuBar(menuBar) in standalone java swing app, it does work So I am wondering why it does not work in Burp and request a fix or new feature

Hannah, PortSwigger Agent | Last updated: Oct 04, 2022 12:45PM UTC

Hi Are you using Dark mode or Light mode in Burp? I just tested this extension, and it seems that the theme is not taken into consideration when rendering this popup. This means that the dark text on a dark background does not show. However, in light mode, you should be able to see the dark text on a light background.

shader | Last updated: Oct 05, 2022 05:53AM UTC

No, I am using Light mode. The problem is that the CTRL+Q panel is blank (but its submenu still can be seen). Could you help fix it on a macOS catalina system ?

Hannah, PortSwigger Agent | Last updated: Oct 05, 2022 09:03AM UTC

It looks like this has previously been reported to the extension author here: https://github.com/synacktiv/HopLa/issues/2 Do you have a virtual machine with a different OS that you can test this out on? This issue does not seem to be present on macOS Monterey.

shader | Last updated: Oct 06, 2022 02:47PM UTC

Thanks, I will try to update to Monterey later

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