下面的代码是 python3 中的多线程域检查器脚本,它使用类似强力字符串生成器的东西附加到列表中,并且该列表具有字符的所有可能组合(取决于指定的长度)也许你需要添加一些字符。我成功地将它用于中文、俄文、荷兰文网站。
from multiprocessing.pool import ThreadPool
from urllib.request import urlopen
import pandas as pd
from itertools import product
chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890' # add all chars in your language
urls = []# list
for length in range(0, 9999): # Change this length
to_attempt = product(chars, repeat=length)
for attempt in to_attempt:
a=("https://"+''.join(attempt)+".de")
urls.append(a)
import sys
sys.stdout = open('de.csv','wt')
def fetch_url(url):
try:
response = urlopen(url)
return url, response.read(), None
except Exception as e:
return url, None, e
start = timer()
results = ThreadPool(4000).imap_unordered(fetch_url, urls)
for url, html, error in results:
if error is None:
print(url)