Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Python Burp Extension code snippet to use the Cookie Jar for JWTs (medium post).
def performAction(self, current_request, macro_items):
# grab some stuff from the current request
req_text = self.helpers.bytesToString(current_request.getRequest())
# grab jwt from cookie jar
jwt = self.getCookieValue(self.cookieDomain, self.cookieName)
# does a value exist yet?
if jwt != None:
# replace the old token with the stored value
header_replace = "%s: %s" % (self.cookieName, jwt)
req_text = re.sub(r"\r\n" + self.cookieName + ": .*\r\n", "\r\n" + header_replace + "\r\n" , req_text)
# set the current request

This comment has been minimized.

Copy link

@mc4e mc4e commented Jul 15, 2020

There is an Error when add this extension to Burp, it seems like it missing Burp specific imports

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment