usr bin env python import threading import os import sys def worker do

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env python
import threading
import os
import sys
def worker(domain):
data = os.popen('whois %s' % domain,'r').read()
if -1 < data.find('No match for') or\
-1 < data.find('No entries found'):
busy = False
else:
busy = True
if not busy:
print domain
#print '%s %s' % (domain,busy and '.' or '*')
names = sys.argv[1:len(sys.argv)]
tld_list = ['com','org','ru']
domain_list = []
for name in names:
if -1 < name.find('.'):
domain_list.append(name)
else:
for tld in tld_list:
domain_list.append('%s.%s' % (name,tld))
threads = []
for domain in domain_list:
thread = threading.Thread(target=worker,args=[domain])
thread.start()
threads.append(thread)
for t in threads:
t.join()