1👍
A quick google search yields this blog post.
This is the (abridged, nonverifying) python code he has to do the decoding of sessiondata:
def decode(session_data, secret_key, class_name='SessionStore'):
encoded_data = base64.b64decode(session_data)
utoken, pickled = encoded_data.split(b':', 1)
return pickle.loads(pickled)
In other words, your expectations are wrong. The un-base64-ed data contains a checksum hash (79ff6...445ee
) followed by a :
followed by serialized (via pickle) python data (�}q(U_auth..._user_idq� u.
).
If you really want to understand how to decode python picked data, see PEP 307.
0👍
If you are using django 1.5.3+ you can use json serializer so that you don’t have to try to decode python pickles in lua 😉 Json serializer is default in django 1.6+.
Source:stackexchange.com