diff options
Diffstat (limited to 'bin/cookies_from_chromium')
-rwxr-xr-x | bin/cookies_from_chromium | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/bin/cookies_from_chromium b/bin/cookies_from_chromium new file mode 100755 index 0000000..b59e494 --- /dev/null +++ b/bin/cookies_from_chromium @@ -0,0 +1,32 @@ +#!/bin/sh -eu + +_aoc_config="${HOME}/.adventofcode.json" + +for _c in "${HOME}/.config/chrom"*/*'/Cookies' +do + echo "${_c}" + printf '%s\n%s%s\n' '.headers on' \ + 'SELECT name, value, hex(encrypted_value) FROM cookies ' \ + 'WHERE host_key=".adventofcode.com";' | sqlite3 "${_c}" +done + +echo 'This is a reminder of how cookies are encrypted.' \ + 'Manual export is required.' >&2 +echo 'Ctrl-Shift-i > Application > Cookies' >&2 + +read -p 'Session cookie: ' _session_cookie + +read -p "Create ${_aoc_config} (y/N)? " _input + +case "${_input}" in + 'y' | 'Y') + echo 'Ok. Creating the file.' + printf '{ "session-cookie": "%s" }' "${_session_cookie}" \ + > "${_aoc_config}" + ;; + *) + echo 'Ok. Skipping it.' + ;; +esac + +unset _c _input _session_cookie |