Support Center

Burp Community

See what our users are saying about Burp Suite:

How do I?

New Post View All

Feature Requests

New Post View All

Burp Extensions

New Post View All

Bug Reports

New Post View All
Documentation

Burp Suite Documentation

Take a look at our Documentation section for full details about every Burp Suite tool, function and configuration option.

Full Documentation Contents Burp Projects
Suite Functions Burp Tools
Options Using Burp Suite
Extensibility

Burp Extender

Burp Extender lets you extend the functionality of Burp Suite in numerous ways.

Extensions can be written in Java, Python or Ruby.

API documentation Writing your first Burp Suite extension
Sample extensions View community discussions about Extensibility
Name is required.
Email address is required.
Invalid email address
Answer is required.
Exceeding max length of 5KB

Highlighting a tab in JTabbedPane of an extension

Jerome Kleinen Sep 01, 2017 04:37PM UTC

Hi,

I am working on an extension that has its own JTabbedPane. I am trying to highlight a tab in my extension's JTabbedPane but for some reason the call to setBackgroundAt() simply does nothing. Oddly enough I am able to walk up the chain of components to Burp's JTabbedPane and highlight the main tab of my extension just fine using the same method.

Within Burp Suite this situation arises for example in the Proxy tab with Intercept enabled. When a request is intercepted the "Intercept" tab is highlighted, even though the Proxy tab consists of its own JTabbedPane.

I am guessing Burp uses a customized JTabbedPane. Would you be able to give any hints how this is done?

Thanks,

Jerome


Paul Johnston Sep 04, 2017 08:14AM UTC Support Center agent

Hi Jerome,

Thanks for your message.

Burp does use a subclass of JTabbedPane internally. However, if you’ve created one yourself, Burp does not replace that when you call customizeUiComponent – that just restyles the components.

So I’m not sure why setBackgroundAt() isn’t working for you. I’ve coded a couple of extensions that highlight the main tab, but not an inner tab. By the way, the color is 0xE58900 and Burp highlights for 3000ms.

Are you able to share the source code of your extension? Ideally the full code so we can compile and reproduce the issue.


Jerome Kleinen Sep 04, 2017 03:09PM UTC
Hi Paul,

Thanks for taking the time to have a look at this. I can't post the complete code for the plugin that I am working on but I can provide this minimal PoC that shows how to reproduce the issue.

Here I create a simple JTabbedPane called menuTabs and I am trying to color the first tab using setBackgroundAt but this does nothing whatsoever. However, when I walk up the component chain to Burp's main JTabbedPane I use the exact same call to highlight a tab.

package burp;

import java.awt.Color;
import java.awt.Component;
import java.io.PrintWriter;

import javax.swing.JPanel;
import javax.swing.JTabbedPane;
import javax.swing.SwingUtilities;


public class BurpExtender implements IBurpExtender, ITab
{

private IBurpExtenderCallbacks callbacks;
private IExtensionHelpers helpers;
private PrintWriter stdout;

// gui
private JTabbedPane menuTabs;

@Override
public void registerExtenderCallbacks(final IBurpExtenderCallbacks callbacks)
{

// keep a reference to our callbacks object
this.callbacks = callbacks;
helpers = callbacks.getHelpers();

stdout = new PrintWriter(callbacks.getStdout(), true);

// set our extension name
callbacks.setExtensionName("PoC");

// create our UI
SwingUtilities.invokeLater(new Runnable()
{
@Override
public void run()
{

menuTabs = new JTabbedPane();
menuTabs.setName("Tabs");

JPanel jpanel = new JPanel();

menuTabs.addTab("Tab 1", null, jpanel, null);
menuTabs.setBackgroundAt(0, Color.green);

// customize UI component to Burp style
callbacks.customizeUiComponent(menuTabs);

// add the custom tab to Burp's UI
callbacks.addSuiteTab(BurpExtender.this);

}
});

}

// implement ITab

@Override
public String getTabCaption() {
return "PoC";
}

@Override
public Component getUiComponent() {
return menuTabs;
}

}


Paul Johnston Sep 05, 2017 08:18AM UTC Support Center agent

Hi Jerome,

Thanks for sending the code. I can definitely reproduce the issue. It has resisted my initial attempts to fix it. I’m going to have to look at some other issues today, but I will come back to this when I get time.

Did you get this working in a standalone app?


Jerome Sep 07, 2017 07:28AM UTC
Hi Paul,

I've never coded a standalone app in Java, only Burp plugins :)

I will try to look into it today. When I was googling this issue I found several threads of people facing the same issue. One of the suggestions was to create a custom JTabbedPane and to overwrite the paint method in order to get this done.

Perhaps my question is not specific to Burp Suite plugin development. You mentioned Burp uses a subclass of JTabbedPane internally. Perhaps this subclass was created specifically to support tab highlighting?

Jerome

Paul Johnston Sep 07, 2017 09:51AM UTC Support Center agent

Hi Jerome,

I think I figured out one way to do this. Burp’s internal JTabbedPane has lots of functionality for drag/drop, editable tab names, etc. Instead of using a JLabel, the tab component is a JTextField, which lets you change the text color. I cannot seem to set the text color on a JLabel; this may be a bug in Swing, or may be my limited knowledge. But we can do this:

    JTextField tf = new JTextField("test");
    menuTabs.setTabComponentAt(0, tf);
    tf.setDisabledTextColor(new Color(0xE58900));
    tf.disable();

There are a few visible artifacts from this, which I expect you can fix. You also need to register a MouseLisenter:

    tf.addMouseListener(BurpExtender.this);
public void mouseClicked(MouseEvent e) { menuTabs.setSelectedIndex(0); } public void mousePressed(MouseEvent e) { } public void mouseReleased(MouseEvent e) { } public void mouseEntered(MouseEvent e) { } public void mouseExited(MouseEvent e) { }

I have a feeling this is more complex than it needs to be, but it does at least work.


Jerome Kleinen Sep 07, 2017 11:33AM UTC
Hi Paul,

Thanks a lot. I will implement it as such :)

Jerome

Post Your public answer

Your name
Your email address
Answer