darkweb.py
21 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    response = requests.get(url, timeout=5)
9    if response.status_code == 200:
10        print(f'{url} is accessible on regular web')
11        ext = tldextract.extract(url)
12        tld = ext.suffix
13
14        if tld in ('onion', 'i2p', 'bit'):
15            print(f'{url} is a dark web site')
16        else:
17            print(f'{url} is not a dark web site')
18    else:
19        print(f'{url} is not accessible on regular web')
20except requests.exceptions.RequestException as e:
21    print(f'could not connect to {url}')