-
-
Save amotmot/447f659e0b962cd7682cd394e510ea1a to your computer and use it in GitHub Desktop.
Check your browsing history for sites using Cloudflare
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tldextract |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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