Burp Suite User Forum

Create new post

[python] registered callback 'performAction' never called

mark | Last updated: Jun 02, 2015 05:00PM UTC

I want to use a python extension to calculate a custom header I need to read a header, url and body (in case of POST) and calc a SHA1. my code so far: https://paste.cybertinus.nl/p/u33AS8kCnT I double checked al idents the 1 tab above the line "def performAction(self, currentRequest, macroItems):" is in place in my version, not in the pastebin. ======= from burp import IBurpExtender from burp import ISessionHandlingAction from burp import IParameter import hashlib import sys class BurpExtender(IBurpExtender, ISessionHandlingAction): # # implement IBurpExtender # def registerExtenderCallbacks(self, callbacks): self._callbacks = callbacks self._helpers = callbacks.getHelpers() callbacks.setExtensionName("Custom Header") print "registered" callbacks.registerSessionHandlingAction(self) return def performAction(self, currentRequest, macroItems): print "CALLLL" sys.stdout.flush() requestInfo = self._helpers.analyzeRequest(currentRequest) headers = requestInfo.getHeaders() print headers msgBody = currentRequest.getRequest()[requestInfo.getBodyOffset():] m = hashlib.sha1() m.update(self._helpers.bytesToString(msgBody)) # Add Custom Hash Header Here headers.add('Hash: %s' % m.hexdigest()) # Build new Http Message with the new Hash Header message = self._helpers.buildHttpMessage(headers, msgBody) # Print Header into UI print self._helpers.bytesToString(message) # Update Request with New Header #currentRequest.setRequest(message) return ======= it loads fine however that seems all it does. It never prints "CALLLL". Did I miss something ??? my scanner is running full speed while loading this extension. So there should be loads of calls getting though. thanks

Burp User | Last updated: Jun 02, 2015 07:15PM UTC

Well.. I needed to add a 'Session Handling Rule' in order to make the callback work. Wish I stumbled upon that a bit earlier :)

You must be an existing, logged-in customer to reply to a thread. Please email us for additional support.