From bc275c32e882aed314ddd15133e9389fb9fd8094 Mon Sep 17 00:00:00 2001 From: celso Date: Wed, 26 Jul 2023 17:15:16 -0300 Subject: [PATCH] initial commit --- .gitignore | 1 + getcookies.sh | 15 +++++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 .gitignore create mode 100755 getcookies.sh diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..3fd7c21 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +cookies.txt diff --git a/getcookies.sh b/getcookies.sh new file mode 100755 index 0000000..7b0c8cc --- /dev/null +++ b/getcookies.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +FILENAME="${1:-empty}" +[ "${FILENAME}" = "empty" ] && { + # this is where the profile folder is in my installation, change to suit your own + PREFIX="$(ls -td /home/"${USER}"/.moonchild\ productions/pale\ moon/* | head -n1)" + FILENAME="${PREFIX}/cookies.sqlite" +} + +# file is under lock while browser is running, so we copy it +TMPFILE="/tmp/cookies.sqlite" +cp "${FILENAME}" "${TMPFILE}" +sqlite3 -separator $'\t' "${TMPFILE}" ".mode tabs" ".header off" "select host, case substr(host,1,1)='.' when 0 then 'FALSE' else 'TRUE' end, path, case isSecure when 0 then 'FALSE' else 'TRUE' end, expiry, name, value from moz_cookies;" > cookies.txt +sed -i ':a;N;$!ba;s/^/# Netscape HTTP Cookie File\n/' cookies.txt +rm "${TMPFILE}"