Skip to content

Instantly share code, notes, and snippets.

@nbibler
Last active June 27, 2016 18:44
Show Gist options
  • Save nbibler/cd8791e942097b211a34 to your computer and use it in GitHub Desktop.
Save nbibler/cd8791e942097b211a34 to your computer and use it in GitHub Desktop.
Decrypt Rails 4 session cookies
@nbibler
Copy link
Author

nbibler commented Jun 27, 2016

Run with:

export SECRET="COOKIE-SECRET-KEY"

ruby cookie.rb decrypt "ENCRYPTED-AND-ENCODED-COOKIE-TEXT-FROM-BROWSER--123123123123" --secret $SECRET
echo "ENCRYPTED-AND-ENCODED-COOKIE-TEXT-FROM-BROWSER--123123123123" | ruby cookie.rb decrypt --secret $SECRET

ruby cookie.rb encrypt "{\"a\":1}" --secret $SECRET
echo "{\"a\":1}" | ruby cookie.rb encrypt --secret $SECRET

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