LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 10-10-2011, 01:36 PM   #1
Xeratul
Senior Member
 
Registered: Jun 2006
Location: UNIX
Distribution: FreeBSD
Posts: 2,657

Rep: Reputation: 255Reputation: 255Reputation: 255
wget with the user firefox cookies?


Hello World,

I would like to use wget (with user agent mozilla) using the user firefox cookies which are stored into .mozilla.

Would it please be possible ?

thank you very much for your expertise
 
Old 10-10-2011, 01:46 PM   #2
Ian John Locke II
Member
 
Registered: Mar 2008
Location: /dev/null
Distribution: Slackware, Android, Slackware64
Posts: 130

Rep: Reputation: 17
This should be helpful https://www.gnu.org/software/wget/ma...P-Options.html

Using curl may be easier than wget though. http://curl.haxx.se/docs/httpscripting.html

To be honest, while I know you can manipulate user-agent strings in both, I'm uncertain of whether you can use firefox cookies stored in .mozilla/.

Depending on what you're trying to do, you may be better off scripting something in Python, PHP, Ruby or Perl (I'm sure there are other languages with ways of storing Cookies). I'm particularly familiar with Python and the mechanize module (non-standard).
 
Old 10-11-2011, 09:41 AM   #3
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Arch + Xfce
Posts: 6,852

Rep: Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037
Firefox cookies are now stored in an sqlite database file. There's an extension or two that can export them, or you can use sqlite3. These are the notes I made for myself when I was working on the same thing:

Code:
Extracting cookies from the firefox sqlite database:
Firefox locks the database when running, so be sure to shut down first,
or else create a copy of the database and use that instead.

To get all cookies in the database, printed as-is, use this:

	sqlite3 -separator $'\t' cookies.sqlite 'select * from moz_cookies'

The order of fields output from the above is:

	id name value host path expiry isSecure isHttpOnly lastAccessed

But cookies.txt needs to be in this format:

	domain flag path secure expiration name value

Translated to database values (field number in parens):

	host(4) "0" path(5) isSecure(7) expiry(6) name(2) value(3)

	(The flag field isn't stored in the database, so set it to 0)

So to get all cookies in the proper order, use:

	sqlite3 -separator $'\t' cookies.sqlite 'select host,"0",path,isSecure,expiry,name,value from moz_cookies'

Or just filter the raw format command through awk:

	awk -v OFS='\t' '{print $4,"0",$5,$7,$6,$2, $3}'
Once you have a cookies.txt, you can use it in wget with the --load-cookies option.
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Using the cookies.sqlite from Firefox 3 in wget jimbo1708 Linux - Software 18 06-28-2014 11:32 AM
[SOLVED] Firefox and Cookies ronlau9 Linux - General 4 09-27-2010 05:15 PM
Wget and Session Cookies mortrek Linux - Software 0 10-20-2006 04:44 PM
Konqueror / FireFox Cookies Vampir3 Linux - Software 4 12-16-2005 06:49 PM
modifying cookies in firefox pepisfree Linux - Software 2 08-25-2004 05:35 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 06:13 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration