Convert cookies.sqlite from firefox for use in wget cookies.txt
I have come up with this command:
sqlite3 -separator $'\t' cookies.sqlite 'select CASE "isHttpOnly" WHEN "0" then "" else "." END || basedomain, CASE "isHttpOnly" 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
Wget tends to make cookies.txt files where the base domain begins with a period where only that path can be served with that cookie. This correlates with the field isHttpOnly being set and the second field set to true. The SQL statement above from my experiments outputs a site's cookies precisely the same by reading Mozilla's cookie database as it does directly from wget, with database from Firefox 30.0.
|