Tuesday, July 21, 2009

Getting the cookies in Mozilla Firefox browser with SQLite.

Well, to start with, Mozilla Firefox browser doesn't store the cookies in some folders like IE6 does(even previous versions of firefox) rather it uses SQLite and keeps them in local databases.
If you like to see the cookies you should have the SQLite program to access SQLite databases. Get one from here. The zip file, upon extracting, will yield sqlite3.exe.
Now you have to know where the Mozilla Firefox installs itself by default. If you are using Windows XP/Vista, type %APPDATA%\Mozilla\Firefox\Profiles in the Run command and press enter. It should take you to your Mozilla Firefox installation home. You will see a folder named aoxoXXXX.default. Go into that and copy sqlite3.exe there. Now from the command prompt start the sqlite3.exe but before that confirm that the cookies.sqlite file is present in the directory.

$ sqlite3 cookies.sqlite

To find out what tables are there in the db file use:

sqlite> select * from sqlite_master;
table|moz_cookies|moz_cookies|2|CREATE TABLE moz_cookies (id INTEGER PRIMARY KEY
, name TEXT, value TEXT, host TEXT, path TEXT,expiry INTEGER, lastAccessed INTEG
ER, isSecure INTEGER, isHttpOnly INTEGER)


This shows there is a table named moz_cookies. To get all the cookies, type in:

sqlite> select * from moz_cookies;

This will fetch all the cookies from your browser.
Happy Hacking.
Stay Hungry. Stay Foolish.

No comments: