Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Check saved Firefox passwords against the list of domains that use Cloudflare
import glob
import json
import sys
import os
from urllib.parse import urlparse
# download from
cloudflare_tlds = frozenset(map(lambda x:x.strip(),
profiles = os.path.join(os.environ['HOME'], '.mozilla/firefox/*/logins.json')
for profile in glob.glob(profiles):
print("Checking", profile)
data = json.load(open(profile))
check_tlds = set()
for login in data['logins']:
url = login['hostname']
host_port = urlparse(url).netloc
host = host_port.split(':')[0]
f = host.split('.')
for i in range(len(f)):
domain = '.'.join(host.split('.')[-i-1:])
if domain in cloudflare_tlds:
for tld in check_tlds:
print(" ", tld)

This comment has been minimized.

Copy link

looselytyped commented Feb 24, 2017

Thank you for this. Just a couple of notes for anyone passing by

  • This uses python3 - if you have Homebrew you can
    • Install python3 with brew install python3
    • Usage is python3

This script assumes you downloaded sorted_unique_cf.txt from the master branch. In case you just cloned you will need to

Finally, on OSX logins.json is under ~/Library/Application Support/Firefox/Profiles/<some-identifier>.default - I changed Line #12 to profiles = os.path.join(os.environ['HOME'], 'Library/Application Support/Firefox/Profiles/*/logins.json')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.