Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.1k views
in Technique[技术] by (71.8m points)

plugins - nested split pane in java for burp extension

I am trying to divide the window of a newly created Burp tab into different sections;

|-------|--|
|       |  |
|-------|  |
|-------|--|

But I only see the left part. How is that possible and what should I do differently?

public class BurpExtender extends AbstractTableModel implements IBurpExtender, ITab, IHttpListener, IMessageEditorController
{
private IBurpExtenderCallbacks callbacks;
private IExtensionHelpers helpers;
private JSplitPane splitPane;

private JSplitPane splitPane2;
private IMessageEditor requestViewer;
private IMessageEditor responseViewer;
private final List<LogEntry> log = new ArrayList<LogEntry>();
private IHttpRequestResponse currentlyDisplayedItem;

//
// implement IBurpExtender
//

@Override
public void registerExtenderCallbacks(final IBurpExtenderCallbacks callbacks)
{
    // keep a reference to our callbacks object
    this.callbacks = callbacks;

    // obtain an extension helpers object
    helpers = callbacks.getHelpers();

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

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

            splitPane2 = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
            splitPane2.setDividerLocation(0.5);
            JPanel panel = new JPanel();
            panel.setLayout(new BorderLayout());



            // main split pane
            splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);

            // table of log entries
            Table logTable = new Table(BurpExtender.this);
            JScrollPane scrollPane = new JScrollPane(logTable);
            splitPane.setLeftComponent(scrollPane);

            // tabs with request/response viewers
            JTabbedPane tabs = new JTabbedPane();
            requestViewer = callbacks.createMessageEditor(BurpExtender.this, false);
            responseViewer = callbacks.createMessageEditor(BurpExtender.this, false);
            tabs.addTab("Request", requestViewer.getComponent());
            tabs.addTab("Response", responseViewer.getComponent());
            splitPane.setRightComponent(tabs);


            splitPane2.setLeftComponent(splitPane);
            splitPane2.setRightComponent(panel);

            // customize our UI components
            callbacks.customizeUiComponent(splitPane);
            callbacks.customizeUiComponent(panel);
            callbacks.customizeUiComponent(splitPane2);

            callbacks.customizeUiComponent(logTable);
            callbacks.customizeUiComponent(scrollPane);
            callbacks.customizeUiComponent(tabs);

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

            // register ourselves as an HTTP listener
            callbacks.registerHttpListener(BurpExtender.this);
        }
    });
}

My ultimate goal is to create an export button in the right part (by using a JPanel first I assume). The language I use is Java. Currenlty, I am using IHttpListener but maybe I will implement IScannerCheck for populating the TableModel with results from a passive scan.

Edit (after more than 8 hours of trying to get it work based on examples on the internet):

public Component getUiComponent()
{
    return splitPane;
}

I changed splitPane to splitPane2, now it appears to be working. If anyone has suggestions why this is needed or other suggestions (like implementing a button or faulty assumptions/code from my side), I would like to hear.

question from:https://stackoverflow.com/questions/65843587/nested-split-pane-in-java-for-burp-extension

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...