UXP-getcookies.txt/getcookies.sh

16 lines
734 B
Bash
Raw Permalink Normal View History

2023-07-26 17:15:16 -03:00
#!/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}"