Skip to content

Instantly share code, notes, and snippets.

@amotmot
Forked from zweizeichen/chrome.py
Created February 27, 2017 20:48
Show Gist options
  • Save amotmot/447f659e0b962cd7682cd394e510ea1a to your computer and use it in GitHub Desktop.
Save amotmot/447f659e0b962cd7682cd394e510ea1a to your computer and use it in GitHub Desktop.
Check your browsing history for sites using Cloudflare
import sqlite3
import tldextract
history_domains = set()
cf_domains = None
print("Loading domains from Chrome browsing history...")
# Copy history from ~/Library/Application Support/Google/Chrome/Default/History
conn = sqlite3.connect('History')
c = conn.cursor()
for url in c.execute("SELECT url FROM urls"):
history_domains.add(tldextract.extract(url[0]).registered_domain)
print("Added %d domains." % len(history_domains))
print("Loading Cloudflare domains...")
# Get domains here: https://github.com/pirate/sites-using-cloudflare
cf_domains = set(domain.strip() for domain in open('sorted_unique_cf.txt'))
print("Added %d domains." % len(cf_domains))
print("Processing intersection...")
intersection = history_domains.intersection(cf_domains)
print("------------------------------")
for domain in sorted(intersection):
print(domain)
print("------------------------------\nOK: %d domains found." % len(intersection))
import sqlite3
import tldextract
history_domains = set()
cf_domains = None
print("Loading domains from Firefox browsing history...")
# Copy history from ~/Library/Application Support/Firefox/Profiles/*YOUR PROFILE*/places.sqlite
conn = sqlite3.connect('places.sqlite')
c = conn.cursor()
for url in c.execute("SELECT url FROM moz_places"):
history_domains.add(tldextract.extract(url[0]).registered_domain)
print("Added %d domains." % len(history_domains))
print("Loading Cloudflare domains...")
# Get domains here: https://github.com/pirate/sites-using-cloudflare
cf_domains = set(domain.strip() for domain in open('sorted_unique_cf.txt'))
print("Added %d domains." % len(cf_domains))
print("Processing intersection...")
intersection = history_domains.intersection(cf_domains)
print("------------------------------")
for domain in sorted(intersection):
print(domain)
print("------------------------------\nOK: %d domains found." % len(intersection))
import sqlite3
import tldextract
history_domains = set()
cf_domains = None
print("Loading domains from Safari browsing history...")
# Copy history from ~/Library/Safari/History.db
conn = sqlite3.connect('History.db')
c = conn.cursor()
for url in c.execute("SELECT url FROM history_items"):
history_domains.add(tldextract.extract(url[0]).registered_domain)
print("Added %d domains." % len(history_domains))
print("Loading Cloudflare domains...")
# Get domains here: https://github.com/pirate/sites-using-cloudflare
cf_domains = set(domain.strip() for domain in open('sorted_unique_cf.txt'))
print("Added %d domains." % len(cf_domains))
print("Processing intersection...")
intersection = history_domains.intersection(cf_domains)
print("------------------------------")
for domain in sorted(intersection):
print(domain)
print("------------------------------\nOK: %d domains found." % len(intersection))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment