-
Notifications
You must be signed in to change notification settings - Fork 0
/
dnschecker.py
70 lines (55 loc) · 1.32 KB
/
dnschecker.py
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
import socket
import wget
import os
###Colours
OKGREEN = '\033[92m'
OKBLUE = '\033[94m'
WARNING = '\033[93m'
RED = '\033[91m'
ENDC = '\033[0m'
if os.path.exists('tld.txt'):
pass
else:
print("Downloading tld list..")
wget.download('https://raw.githubusercontent.com/incognico/list-of-top-level-domains/master/tlds.csv', 'tld.txt')
infile = open('tld.txt', encoding='UTF-8')
tlist = []
flist = []
i = 0
x = 0
#add percentage counter using x here..
while i < 285:
data = infile.readline()
ugh = data.split(',')
tlist.append(ugh)
var = tlist[i][0]
var = '.' + var
flist.append(var)
#print(flist)
i += 1
x += 1
infile.close()
#actual checking
url = input('well? ')
print('please wait..')
i = 0
error = '***'
failure = []
succes = []
while i < 285:
percentage = round(i / 285 * 100, 2)
print(WARNING + "at" + ' ' + str(percentage) + "%" + ENDC, end='\r')
host = url + flist[i]
try:
result = socket.gethostbyname(host)
print(RED + host + " has ip: " + result + ENDC)
failure.append(host)
except:
print(OKGREEN + host + ' is free.' + ENDC)
succes.append(host)
i += 1
x += 1
for site in failure:
print("{} {} is taken. {}".format(RED, site, ENDC))
for site in succes:
print("{} {} is free. {}".format(OKGREEN, site, ENDC))