Linux - Software This 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.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
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.
 |
GNU/Linux Basic Guide
This 255-page guide will provide you with the keys to understand the philosophy of free software, teach you how to use and handle it, and give you the tools required to move easily in the world of GNU/Linux. Many users and administrators will be taking their first steps with this GNU/Linux Basic guide and it will show you how to approach and solve the problems you encounter.
Click Here to receive this Complete Guide absolutely free. |
|
 |
|
07-02-2008, 10:22 PM
|
#1
|
|
Member
Registered: Jan 2007
Location: Pennsylvania
Distribution: Ubuntu 8.10 Server/9.04 Desktop, openSUSE 11.1
Posts: 154
Rep:
|
Using the cookies.sqlite from Firefox 3 in wget
Hey everyone,
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?
Thanks,
- Jim
|
|
|
|
07-03-2008, 03:18 AM
|
#2
|
|
Member
Registered: Jun 2008
Posts: 288
Rep:
|
I would suggest taking this up in a FF3 or wget-specific group since this is such a specific question.
Mike
|
|
|
|
07-03-2008, 05:02 PM
|
#3
|
|
Member
Registered: Jan 2007
Location: Pennsylvania
Distribution: Ubuntu 8.10 Server/9.04 Desktop, openSUSE 11.1
Posts: 154
Original Poster
Rep:
|
Quote:
Originally Posted by storkus
I would suggest taking this up in a FF3 or wget-specific group since this is such a specific question.
Mike
|
Do you know of any such communities.? I am use to using LQ as my main resource. With the release of FF3 so recently, I hope their is a solution.
- Jim
|
|
|
|
07-04-2008, 03:17 AM
|
#4
|
|
LQ Newbie
Registered: Jul 2008
Location: New Zealand
Distribution: Ubuntu
Posts: 2
Rep:
|
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
|
|
|
|
07-05-2008, 11:26 AM
|
#5
|
|
Member
Registered: Jan 2007
Location: Pennsylvania
Distribution: Ubuntu 8.10 Server/9.04 Desktop, openSUSE 11.1
Posts: 154
Original Poster
Rep:
|
Quote:
Originally Posted by ogn.alice
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.
- Jim
|
|
|
|
08-01-2008, 02:33 PM
|
#6
|
|
LQ Newbie
Registered: Aug 2004
Location: Ontario, Canada
Distribution: Gentoo, sometimes Debian, and though it's not Linux, OpenBSD.
Posts: 23
Rep:
|
For future reference, there's now an extension in development for this (experimental as of this posting) available at https://addons.mozilla.org/en-US/firefox/addon/8154
|
|
|
|
03-12-2009, 05:22 PM
|
#7
|
|
LQ Newbie
Registered: Mar 2009
Location: London
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:
sqlite3 -separator ' ' cookies.sqlite 'select * from moz_cookies' > cookies.txt
(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.
|
|
|
|
03-24-2009, 11:13 PM
|
#8
|
|
LQ Newbie
Registered: Mar 2009
Posts: 1
Rep:
|
Quote:
Originally Posted by Ladadadada
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:
sqlite3 -separator ' ' cookies.sqlite 'select * from moz_cookies' > cookies.txt
(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
(Again, that separator is a tab character.)
|
|
|
|
05-25-2009, 02:26 AM
|
#9
|
|
LQ Newbie
Registered: May 2009
Posts: 2
Rep:
|
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;
EOF
|
Last edited by koyeung; 05-25-2009 at 02:29 AM.
|
|
|
|
08-11-2009, 09:04 PM
|
#10
|
|
Member
Registered: Oct 2003
Distribution: debian
Posts: 35
Rep:
|
I tried the python script, but get this message:
Traceback (most recent call last):
File "./exp_ff_cky.py", line 21, in ?
import sqlite3 as db
ImportError: No module named sqlite3
sqlite3 is installed on my computer...
???
|
|
|
|
08-12-2009, 12:16 AM
|
#11
|
|
Senior Member
Registered: Jan 2005
Location: Roodepoort, South Africa
Distribution: Slackware 10.1/10.2/12, Ubuntu 12.04, Crunchbang Statler
Posts: 3,780
|
You probably have to install a python module (or whatever it is called) to support sqlite3 in python.
http://www.sqlite.org/cvstrac/wiki?p=SqliteWrappers ; search for python
|
|
|
|
03-14-2011, 03:19 AM
|
#12
|
|
LQ Newbie
Registered: Mar 2011
Posts: 1
Rep:
|
Use this statement
Code:
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
Last edited by ikarib; 03-14-2011 at 03:23 AM.
|
|
|
|
10-23-2012, 05:29 AM
|
#13
|
|
LQ Newbie
Registered: Oct 2012
Posts: 4
Rep: 
|
Quote:
Originally Posted by ikarib
Use this statement
Code:
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
?
|
|
|
|
10-24-2012, 06:42 AM
|
#14
|
|
LQ Newbie
Registered: May 2009
Posts: 2
Rep:
|
you need to locate the cookies.sqlite properly first and replace "~/.mozilla/firefox/*.default/cookies.sqlite" by the actual path to the file
|
|
|
|
10-25-2012, 12:35 AM
|
#15
|
|
LQ Newbie
Registered: Oct 2012
Posts: 4
Rep: 
|
Quote:
|
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
Last edited by cooltra; 10-25-2012 at 12:58 AM.
|
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -5. The time now is 07:26 AM.
|
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|