Burp Suite User Forum

Login to post

setHighlight: shows in http history, but not my own table. How do I make it show in my table?

gnothi | Last updated: Jul 24, 2020 12:13AM UTC

I wrote an extension, that after some checking, marks certain ((IHttpRequestResponse) messages, using message.getMessageInfo().setHighlight('red') What I don't fully grasp is: The marked messages show correctly 'red' in the Proxy -> HttpHistory tab. However, in my own table (JTable), no colors are shown. Question is: what do I need to do to have my table to show those colors as well? It's awesome to have 'messages' uniformly marked throughout burp, and it would kinda suck to do individual coloring on my own tables. So how can my table show from the colors that are given to these messages? -- Some relevant code (obviously not complete, the whole program is over 500 lines) Short summary of the below code: * I create a JTable * In that table I show an ID and an URL. The ID is just based on an autoincrement. In my database I do store the 'message.getMessageReference()'. Maybe that has something to do with it? * I included the complete tablemodel and table code --- self._urlTable = TableUrls(UrlsTableModel(self)) callbacks.customizeUiComponent(self._urlTable) def addUrlLog(self, message): messageReferenceId = message.getMessageReference() url = self._helpers.analyzeRequest(message.getMessageInfo()).getUrl() _id = len(self._db) request_response = message.getMessageInfo() self._lock.acquire() self._db[messageReferenceId] = {'id': _id, 'url': url, 'message': self._callbacks.saveBuffersToTempFiles(request_response), 'vulnerabilityscans': {}} self._lock.release() #Complete tabelmodel class UrlsTableModel(AbstractTableModel): def __init__(self, extender): self._extender = extender self._db = extender._db def getRowCount(self): try: return self._db.urlLogsCount() except: return 0 def getColumnCount(self): return 2 def getColumnName(self, columnIndex): if columnIndex == 0: return "#" if columnIndex == 1: return "URL" return "" def getValueAt(self, rowIndex, columnIndex): urlId = self._db.urlLogByIndex(rowIndex) if columnIndex == 0: return self._db.urlLog(urlId)['id'] if columnIndex == 1: return self._db.urlLog(urlId)['url'] return "" # # extend JTable to handle cell selection # class TableUrls(JTable): def __init__(self, model): self.setModel(model) def changeSelection(self, row, col, toggle, extend): # show the log entry for the selected row urlId = self.getModel()._db.urlLogByIndex(row) self.getModel()._db.setCurrentSelectedUrlLog(urlId) self.getModel()._extender._vulnerabilityScanTable.redraw() JTable.changeSelection(self, row, col, toggle, extend)

Hannah, PortSwigger Agent | Last updated: Jul 24, 2020 01:16PM UTC

Have you had a look at how other extensions have implemented this behavior? For example, Flow and Logger++ You can find the source code for all BApp Store extensions available on our GitHub: https://github.com/portswigger

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