Flask Session Cookie Manager : Flask Session Cookie Decoder/Encoder

Flask Session Cookie Decoder/Encoder.

Dependencies

Installation

  • BlackArch Linux

# pacman -S flask-session-cookie-manager{3,2}

Git

  • ArchLinux

Both python3 etn python2:

$ git clone https://github.com/noraj/flask-session-cookie-manager.git && cd flask-session-cookie-manager
# makepkg -sic

Other Distros

Find your way with your package manager, use pip in a virtual environment or use pyenv.

Eg.

$ git clone https://github.com/noraj/flask-session-cookie-manager.git && cd flask-session-cookie-manager
$ python -m venv venv
$ source venv/bin/activate
$ python setup.py install

Usage

Use flask_session_cookie_manager3.py with Python 3 and flask_session_cookie_manager2.py with Python 2.

Usage: flask_session_cookie_manager{2,3}.py [-h] {encode,decode} …

Flask Session Cookie Decoder/Encoder

Positional Arguments:
{encode,decode} sub-command help
encode encode
decode decode

Optional Arguments:
-h, –help show this help message and exit

  • Encode

Usage: flask_session_cookie_manager{2,3}.py encode [-h] -s -t

Optional Arguments:
-h, –help show this help message and exit
-s , –secret-key
Secret key
-t , –cookie-structure
Session cookie structure

  • Decode

Usage: flask_session_cookie_manager.py decode [-h] [-s ] -c

Optional Arguments:
-h, –help show this help message and exit
-s , –secret-key
Secret key
-c , –cookie-value
Session cookie value

Examples

  • Encode

$ python{2,3} flask_session_cookie_manager{2,3}.py encode -s ‘.{y]tR&sp&77RdO~u3@XAh#TalD@Oh~yOF_51H(QV};K|ghT^d’ -t ‘{“number”:”326410031505″,”username”:”admin”}’ eyJudW1iZXIiOnsiIGIiOiJNekkyTkRFd01ETXhOVEExIn0sInVzZXJuYW1lIjp7IiBiIjoiWVdSdGFXND0ifX0.DE2iRA.ig5KSlnmsDH4uhDpmsFRPupB5Vw

Note: the session cookie structure must be a valid python dictionary

Decode

  • With secret key:

$ python{2,3} flask_session_cookie_manager{2,3}.py decode -c ‘eyJudW1iZXIiOnsiIGIiOiJNekkyTkRFd01ETXhOVEExIn0sInVzZXJuYW1lIjp7IiBiIjoiWVdSdGFXND0ifX0.DE2iRA.ig5KSlnmsDH4uhDpmsFRPupB5Vw’ -s ‘.{y]tR&sp&77RdO~u3@XAh#TalD@Oh~yOF_51H(QV};K|ghT^d’ {u’username’: ‘admin’, u’number’: ‘326410031505’}

  • Without secret key (less pretty output):

$ python{2,3} flask_session_cookie_manager{2,3}.py decode -c ‘eyJudW1iZXIiOnsiIGIiOiJNekkyTkRFd01ETXhOVEExIn0sInVzZXJuYW1lIjp7IiBiIjoiWVdSdGFXND0ifX0.DE2iRA.ig5KSlnmsDH4uhDpmsFRPupB5Vw’ {“number”:{” b”:”MzI2NDEwMDMxNTA1″},”username”:{” b”:”YWRtaW4=”}}

R K

Recent Posts

Shadow-rs : Harnessing Rust’s Power For Kernel-Level Security Research

shadow-rs is a Windows kernel rootkit written in Rust, demonstrating advanced techniques for kernel manipulation…

1 week ago

ExecutePeFromPngViaLNK – Advanced Execution Of Embedded PE Files via PNG And LNK

Extract and execute a PE embedded within a PNG file using an LNK file. The…

2 weeks ago

Red Team Certification – A Comprehensive Guide To Advancing In Cybersecurity Operations

Embark on the journey of becoming a certified Red Team professional with our definitive guide.…

3 weeks ago

CVE-2024-5836 / CVE-2024-6778 : Chromium Sandbox Escape via Extension Exploits

This repository contains proof of concept exploits for CVE-2024-5836 and CVE-2024-6778, which are vulnerabilities within…

3 weeks ago

Rust BOFs – Unlocking New Potentials In Cobalt Strike

This took me like 4 days (+2 days for an update), but I got it…

3 weeks ago

MaLDAPtive – Pioneering LDAP SearchFilter Parsing And Security Framework

MaLDAPtive is a framework for LDAP SearchFilter parsing, obfuscation, deobfuscation and detection. Its foundation is…

3 weeks ago