Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I am trying to automate a periodic downloading script I have for a website. I want to use wget to grab the file, but I need to use my cookies from Firefox 3 to bypass the login. Wget allows you to specify a cookies.txt file when you invoke wget, but Firefox 3 does not use cookies.txt but rather cookies.sqlite. Does anyone know if a firefox extension is in the works to create a work around. Does anyone have any other suggestions?
Jim, I had the same problem. I found a solution from icewind in this blog post. It uses a python script to extract the data from cookies.sqlite.
The post is written in German, but a version of the script (heavily) commented in English is also provided. The link to it is labelled "vollständig dokumentierte Version des Scriptes" and appears just after the python code.
Jim, I had the same problem. I found a solution from icewind in this blog post. It uses a python script to extract the data from cookies.sqlite.
The post is written in German, but a version of the script (heavily) commented in English is also provided. The link to it is labelled "vollständig dokumentierte Version des Scriptes" and appears just after the python code.
- Alice
Thanks, the python script worked. It took me a little bit to figure out that i needed to pass in an argument to search for, but its working well for my purposes.
Distribution: Mac OS X, Solaris, Ubuntu, Debian, Redhat
Posts: 2
Rep:
Even easier than using Python and the script...
If you have sqlite3 on your system (Mac OS X does by default and I'm sure most Linux distros do by default too) then you can just type this in the appropriate folder:
If you have sqlite3 on your system (Mac OS X does by default and I'm sure most Linux distros do by default too) then you can just type this in the appropriate folder:
(That's a tab-space in the quotes after -separator. If you need to type a tab-space on the command line, type a ctrl-v first.)
You can also use sqlite3 to edit and selectively delete cookies if you know a little bit of SQL.
That didn't work for me, but the python script did. On my system, the order of the columns in the sqlite database is wrong; maybe mozilla changed it.
The schema for me (running 3.0.7) is:
Code:
CREATE TABLE moz_cookies (id INTEGER PRIMARY KEY, name TEXT, value TEXT, host TEXT, path TEXT,expiry INTEGER, lastAccessed INTEGER, isSecure INTEGER, isHttpOnly INTEGER);
This schema also has isSecure and isHttpOnly as integers instead of "TRUE"/"FALSE". I don't know how to convert those on output in sqlite. For my app, I just hard-coded them, and this worked:
Code:
sqlite3 -separator ' ' $HOME/.mozilla/firefox/$PROFILE.default/cookies.sqlite 'select host, "TRUE", path, "FALSE", expiry, name, value from moz_cookies' > cookies.txt
you may try this script: (passing $HOME/.mozilla/firefox/$PROFILE.default/cookies.sqlite as the 1st parameter)
Quote:
#!/bin/bash
#
sqlite3 $1 <<EOF
.mode tabs
.header off
select host as domain,
case substr(host,1,1)='.' when 0 then 'FALSE' else 'TRUE' end as flag,
path,
case isSecure when 0 then 'FALSE' else 'TRUE' end as secure,
expiry as expiration, name, value from moz_cookies;
echo ".mode tabs
select host, case when host glob '.*' then 'TRUE' else 'FALSE' end, path,
case when isSecure then 'TRUE' else 'FALSE' end, expiry, name, value
from moz_cookies;" | sqlite3 ~/.mozilla/firefox/*.default/cookies.sqlite
echo ".mode tabs
select host, case when host glob '.*' then 'TRUE' else 'FALSE' end, path,
case when isSecure then 'TRUE' else 'FALSE' end, expiry, name, value
from moz_cookies;" | sqlite3 ~/.mozilla/firefox/*.default/cookies.sqlite
I get this Err:
Code:
Error: near line 2: file is encrypted or is not a database
you need to locate the cookies.sqlite properly first and replace "~/.mozilla/firefox/*.default/cookies.sqlite" by the actual path to the file
I did, but that error again:
Code:
cool@TRA:~$ echo ".mode tabs
> select host, case when host glob '.*' then 'TRUE' else 'FALSE' end, path,
> case when isSecure then 'TRUE' else 'FALSE' end, expiry, name, value
> from moz_cookies;" | sqlite3 /home/cool/.mozilla/firefox/cyote601.default/cookies.sqlite
Error: near line 2: file is encrypted or is not a database
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.