Skip to content

Instantly share code, notes, and snippets.

@da2x
Created December 6, 2017 19:40
Show Gist options
  • Save da2x/6e2ef4a30f476f8aec4aca7bbadbc772 to your computer and use it in GitHub Desktop.
Save da2x/6e2ef4a30f476f8aec4aca7bbadbc772 to your computer and use it in GitHub Desktop.
Detects websites with brave-leder-verifications in their DNS records. Note that such a ledger is no guarantee that the website is infact a verified Brave publisher.
# Download and unzip Alexa Top 1 Million websites
# http://s3.amazonaws.com/alexa-static/top-1m.csv.zip
# Run this script.
from os.path import isfile
from urllib.request import urlopen
import concurrent.futures
import socket
import dns.resolver
import time
socket.setdefaulttimeout(20)
def download_robot(domain):
try:
if any(['brave-ledger-verification=' in str(_) for _ in dns.resolver.query(domain, 'TXT').rrset]):
print("DETECTED: {0}".format(domain), flush=True)
else:
pass
except:
pas
executor = concurrent.futures.ThreadPoolExecutor(max_workers=18)
with open('top-1m.csv') as file:
for num, line in enumerate(file, 1):
domain = line.split(',')[1].rstrip()
ok = executor.submit(download_robot, domain)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment