diff --git a/AuthMatrix.py b/AuthMatrix.py index 61131f6..9d24bf8 100644 --- a/AuthMatrix.py +++ b/AuthMatrix.py @@ -563,25 +563,28 @@ def createMenuItems(self, invocation): + class AddRequestActionListener(ActionListener): + def __init__(self, extender): + self.extender = extender - def addRequestsToTab(e): - for messageInfo in messages: - requestInfo = self._helpers.analyzeRequest(messageInfo) - name = str(requestInfo.getMethod()).ljust(8) + requestInfo.getUrl().getPath() - # Grab regex from response - regex = "^HTTP/1\\.1 200 OK" - response = messageInfo.getResponse() - if response: - responseInfo=self._helpers.analyzeResponse(response) - if len(responseInfo.getHeaders()): - responseCodeHeader = responseInfo.getHeaders()[0] - regex = "^"+re.escape(responseCodeHeader) - # Must create a new RequestResponseStored object since modifying the original messageInfo - # from its source (such as Repeater) changes this saved object. MessageInfo is a reference, not a copy - messageIndex = self._db.createNewMessage(RequestResponseStored(self,requestResponse=messageInfo), name, regex) - self._messageTable.redrawTable() - self._chainTable.redrawTable() - self.highlightTab() + def actionPerformed(self, e): + for messageInfo in messages: + requestInfo = self.extender._helpers.analyzeRequest(messageInfo) + name = str(requestInfo.getMethod()).ljust(8) + requestInfo.getUrl().getPath() + # Grab regex from response + regex = "^HTTP/1\\.1 200 OK" + response = messageInfo.getResponse() + if response: + responseInfo=self.extender._helpers.analyzeResponse(response) + if len(responseInfo.getHeaders()): + responseCodeHeader = responseInfo.getHeaders()[0] + regex = "^"+re.escape(responseCodeHeader) + # Must create a new RequestResponseStored object since modifying the original messageInfo + # from its source (such as Repeater) changes this saved object. MessageInfo is a reference, not a copy + messageIndex = self.extender._db.createNewMessage(RequestResponseStored(self.extender,requestResponse=messageInfo), name, regex) + self.extender._messageTable.redrawTable() + self.extender._chainTable.redrawTable() + self.extender.highlightTab() class UserCookiesActionListener(ActionListener): @@ -623,7 +626,8 @@ def actionPerformed(self, e): if valid: menuItem = JMenuItem("Send request(s) to AuthMatrix"); - menuItem.addActionListener(addRequestsToTab) + menuItem.addActionListener(AddRequestActionListener(self)) + ret.append(menuItem) if len(messages)==1: