PortSwigger / burp-extensions-montoya-api

Burp Extensions Api
Other
125 stars 3 forks source link

Burp Logger Tab Does Not Support Extension Context Menu #78

Closed cchcerne closed 10 months ago

cchcerne commented 10 months ago

Hello,

I am writing a Burp extension that copies requests / responses to the clipboard. When selecting request / responses from Burp Proxy, the extension works great. However, in Burp Logger, the context menu does not even appear.

Here is some Kotlin code with my ContextMenuItemsProvider:

        api.userInterface().registerContextMenuItemsProvider(object : ContextMenuItemsProvider {
            override fun provideMenuItems(event: ContextMenuEvent?): List<Component?> {
                val selectedReqResp = event?.selectedRequestResponses()
                val msgEditorReqResp = event?.messageEditorRequestResponse()

                val actualReqResp = if (msgEditorReqResp?.isPresent == true) {
                    listOf(msgEditorReqResp.get().requestResponse())
                } else {
                    selectedReqResp ?: listOf()
                }

                if (actualReqResp.isEmpty())
                    return emptyList()

                val reqRespJMenuItem = JMenuItem("Copy Request / Response Pair")
                reqRespJMenuItem.addActionListener {
                    /* Get system clipboard */
                    val htmlSelection = RequestResponseClipboardData(actualReqResp)
                    val clipboard: Clipboard = Toolkit.getDefaultToolkit().systemClipboard
                    clipboard.setContents(htmlSelection, null)

                }

                return listOf(reqRespJMenuItem)
            }
        })

Here's a screenshot of the extension working normally, in the proxy tab: Screenshot 2023-08-22 at 9 48 54 AM

But in the logger tab, no context menu actions exist for any extension: Screenshot 2023-08-22 at 9 50 18 AM

cchcerne commented 10 months ago

I am on Burp version 2023.9.2-22746. I am not sure if this feature worked in the past.

Hannah-PortSwigger commented 10 months ago

Thanks for letting us know - we'll raise a feature request to enable this behavior.