How do I get
logins.json to print in plain-text using commandline?
$ cat /home/*/.mozilla/firefox/*.default/key3.db $ cat /home/*/.mozilla/firefox/*.default/logins.json
Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up.Sign up to join this community
What I did on Linux:
nsssource package for your distro.
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.
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 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'
Since it's just a Python script, it can certainly also be easily installed on Windows or Mac systems.
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.