class GroovyActionListener(ActionListener): def __init__(self, message, bounds): self._message = message self._bounds = bounds self._helpers = burp.getHelpers() self._engine = StreamingTemplateEngine() def actionPerformed(self, event): if self._bounds[0] == self._bounds[1]: return lower = min(self._bounds) upper = max(self._bounds) content = self._message.getRequest() evalContent = self._engine.createTemplate(self._helpers.bytesToString(content[lower:upper])).make( {'burp': burp, 'context': context}).toString() self._message.setRequest(content[:lower] + self._helpers.stringToBytes(evalContent) + content[upper:])
class TemplateTab(IMessageEditorTab): def __init__(self, controller, editable): self._editable = editable self._component = burp.createTextEditor() self._component.setEditable(editable) self._template = None self._orig_content = None self._engine = StreamingTemplateEngine() self._helpers = burp.getHelpers() def getMessage(self): self._template = self._helpers.bytesToString(self._component.getText()) try: self._orig_content = self._engine.createTemplate(self._template).make( {'burp': burp, 'context': context}).toString() except java.lang.Exception, error: self._orig_content = error.toString() return self._helpers.stringToBytes(self._orig_content)
class TemplateTab(IMessageEditorTab): def __init__(self, controller, editable): self._editable = editable self._component = burp.createTextEditor() self._component.setEditable(editable) self._template = None self._orig_content = None self._engine = StreamingTemplateEngine() self._helpers = burp.getHelpers() def getMessage(self): self._template = self._helpers.bytesToString(self._component.getText()) try: self._orig_content = self._engine.createTemplate( self._template).make({ 'burp': burp, 'context': context }).toString() except java.lang.Exception, error: self._orig_content = error.toString() return self._helpers.stringToBytes(self._orig_content)
class GroovyActionListener(ActionListener): def __init__(self, message, bounds): self._message = message self._bounds = bounds self._helpers = burp.getHelpers() self._engine = StreamingTemplateEngine() def actionPerformed(self, event): if self._bounds[0] == self._bounds[1]: return lower = min(self._bounds) upper = max(self._bounds) content = self._message.getRequest() evalContent = self._engine.createTemplate( self._helpers.bytesToString(content[lower:upper])).make({ 'burp': burp, 'context': context }).toString() self._message.setRequest(content[:lower] + self._helpers.stringToBytes(evalContent) + content[upper:])