INNER CODE UNIT · Python

get_tlds

A3sal0n/CyberThreatHunting · tools/dga-hunt.py:114

def get_tlds():
    tlds = []
    url = 'http://data.iana.org/TLD/tlds-alpha-by-domain.txt'
    try:
        r = requests.get(url)
    except requests.exceptions.ConnectionError:
        print('Connection error!\nCheck your network connection and try again')
        sys.exit(2)
    lines = r.text.split('\n')
    lines.pop(0)
    for line in lines:
        tld = line.strip()
        if tld:
            tlds.append(tld.lower())
    return set(tlds)


def get_top_domains(dbname):

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…