From 1773627631cc873b6a09098dda1cac14c6ed03fa Mon Sep 17 00:00:00 2001 From: cos Date: Thu, 1 Dec 2022 16:14:20 +0000 Subject: Initial commit of init_year, poke support scripts --- bin/cookies_from_chromium | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100755 bin/cookies_from_chromium (limited to 'bin/cookies_from_chromium') 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 -- cgit v1.2.3