Skip to content

Instantly share code, notes, and snippets.

@MatthewWilkes
Created November 4, 2013 15:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MatthewWilkes/7303862 to your computer and use it in GitHub Desktop.
Save MatthewWilkes/7303862 to your computer and use it in GitHub Desktop.
Generate a plone.session cookie for an arbitrary user, given access to the server
import binascii
session = app.site.acl_users.session
while True:
username = raw_input("User ID: ")
if not username:
break
if app.site.acl_users.getUserById(username) is None:
print "User not found"
continue
ticket = session.source.createIdentifier(username)
cookie = binascii.b2a_base64(ticket).rstrip()
print "document.cookie = '%s=%s'" % (session.cookie_name, cookie)
@jessnorwood
Copy link

I love you for this.

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