darkweb2.py
16 linespython
DOWNLOAD
1# Aim: Program to perform dark web detection (Dark Web Detection).
2import requests
3import tldextract
4
5url = 'https://www.google.onion'
6
7try:
8    ext = tldextract.extract(url)
9    tld = ext.suffix
10
11    if tld in ('onion', 'i2p', 'bit'):
12        print(f'{url} is a dark web site')
13    else:
14        print(f'{url} is not a dark web site')
15except requests.exceptions.RequestException as e:
16    print(f'could not connect to {url}')