-
Notifications
You must be signed in to change notification settings - Fork 1
/
checkdns.py
30 lines (25 loc) · 902 Bytes
/
checkdns.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
# coding=utf8
# 31.220.16.242
# 216.58.222.46
import socket
import time
import webbrowser
def checkdns():
print time.ctime()
retorno = True
try:
ip = socket.gethostbyname('google.com') #Domain name to be tested for DNS propagation
print ("Checked Host's IP is: " + ip)
if ip == "***.***.***.***": #Target's server IP Address. Known as "new server".
retorno = False
url = 'http://www.google.com/' #URL to open if DNS propagation is done, at least in your ISP
webbrowser.open_new_tab(url)
else:
print "DNS not propagated yet. Waiting 15 minutes."
except socket.gaierror:
print "No hostname defined for the domain name. Waiting 15 minutes."
return retorno
condicao = True
while condicao:
condicao = checkdns()
time.sleep( 900 )