Burp Suite User Forum

Getting current Repeater tab from context menu

Chris | Last updated: Feb 26, 2020 11:13AM UTC

Hi. I've created a basic extension to be able to highlight selected Repeater tabs (for when you have a lot of them open). With a bit of a cludge I am able to work out the current Tab from a top-level context menu item: ... menu.add(swing.JMenuItem("Highlight tab", actionPerformed=lambda x: self._menu_clicked(x, Color.red))) ... def _menu_clicked(self, event, colour): x = event.getSource().getParent().getInvoker() tab_level = 0 while x.getParent(): idx = None try: idx = x.getSelectedIndex() tab_level += 1 if tab_level == 2: x.setBackgroundAt(idx, colour) return except: pass x = x.getParent() However, this doesn't work from a sub-menu - I'd like to have the colours. The parent of the event source for a top-level menu is a Burp class, but not for a sub-menu. So I guess I have 2 questions. 1: Is there a better way of finding the Repeater tabbed pane to get the selected index? 2: If the only way of finding it is to work back up the hierarchy, is this possible from a context sub-menu? Thanks.

Chris | Last updated: Feb 26, 2020 01:29PM UTC

Done some more testing. This works, but still seems inelegant. Is there a better way to identify a tabbed pane? The class name seems obfuscated, so instanceof() probably won't work? def _find_repeater(self, container): if container.getComponents() and self._repeater is None: for c in container.getComponents(): try: if c.getTitleAt(0) == "Dashboard": for x in range(c.getTabCount()): if c.getTitleAt(x) == "Repeater": print("Got Repeater tab") self._repeater = c.getComponentAt(x) return except: pass self._find_repeater(c)

Hannah, PortSwigger Agent | Last updated: Feb 26, 2020 01:39PM UTC

In IBurpExtenderCallbacks, there is a function called getToolName() that returns the descriptive name for the Burp tool, identified by the tool flag provided. You can use this to determine the tool being used. Extender documentation: https://portswigger.net/burp/extender/api/index.html

Chris | Last updated: Feb 27, 2020 02:30PM UTC

Hi Hannah. I'm aware of that, I'm using it to only show the context menu in Repeater. I need to get the actual Repeater Swing object, to modify the tab using setBackgroundAt(). I can get this by walking the Swing hierarchy, but I was hoping there was a better way. Thanks

Hannah, PortSwigger Agent | Last updated: Feb 27, 2020 03:13PM UTC

There isn't as far as I'm aware. If there is another extension that has similar functionality to what you are looking for you could have a look at how they've implemented it. All BApp Store Extensions are available publicly on GitHub (https://github.com/PortSwigger), and there are many more that users have written but haven't been published on the BApp Store. If I recall correctly, I believe the "Quicker context" extension utilizes different swing components for the context menu.

Chris | Last updated: Mar 11, 2020 10:04AM UTC

Thanks Hannah. I'll take a look at that one and a few others :)

You need to Log in to post a reply. Or register here, for free.