Q: How to read key3.db and logins.json in plain-text? How do I get key3.db and/or logins.json to print in plain-text using commandline?
$ cat /home/*/.mozilla/firefox/*.default/key3.db

$ cat /home/*/.mozilla/firefox/*.default/logins.json


A: What I did on Linux:


*

*Grab nss source package for your distro.

*Unpack, patch and configure.

*Go to nss/cmd/pwdecrypt subdirectory

*Build pwdecrypt tool.


I used the following command line to build the tool (CentOS 7.7):
gcc -o pwdecrypt \ 
  -I/usr/include/nspr4 -I/usr/include/nss3 -I../lib \ 
  -lnss3 -lplc4 -lnspr4 -lnssutil3 -lsmime3 \ 
  pwdecrypt.c ../lib/secutil.c ../lib/basicutil.c ../lib/secpwd.c ../lib/pppolicy.c 

This may require certain development packages installed (nss-devel in my case).
Once you have the tool go to firefox profile directory and execute:
jq -r -S '.logins[] | .hostname, .encryptedUsername, .encryptedPassword' logins.json | \ 
  pwdecrypt -d .

or (if key4.db is used instead of key3.db):
jq -r -S '.logins[] | .hostname, .encryptedUsername, .encryptedPassword' logins.json | \ 
  pwdecrypt -d sql:.

You may find Reveal saved Mozilla Firefox passwords article helpful.

A: To list the Firefox or Thunderbird logins with passwords, you can use this firepwd Python script.
To install it on a Debian/Ubuntu system:
wget https://github.com/lclevy/firepwd/archive/master.zip
unzip master.zip && rm master.zip 

apt install python3-pip # add sudo if needed

cd firepwd-master
pip3 install -r requirements.txt

To run it :
python3 firepwd.py -d /path/to/your-profile/

Note that the trailing slash for the path is required.
This will also print the salts from key3.db. To skip them and only show the logins and passwords, you can add  | sed '1,/^decrypting login/d'. So for example, if your Firefox profile directory is called x.default in the default folder of your home:
python3 firepwd.py -d ~/.mozilla/firefox/x.default/ | sed '1,/^decrypting login/d'

There is also another Pyhon script, which I have not tried, suggested by this answer on security.stackexchange.com : https://github.com/unode/firefox_decrypt.
Since it's just a Python script, it can certainly also be easily installed on Windows or Mac systems.

A: Assuming you don't need to do this very often and are happy to do the first step manually, you could use Password Exporter, which I used to use before I switched to KeePass.
