Last active
April 30, 2019 01:37
-
-
Save mritunjay-k/c8e237efcd6d821c2f9d4d1911ab9d47 to your computer and use it in GitHub Desktop.
Check if a domain in up or not..!!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import socket | |
try: | |
domain = input("Enter the name of the domain: ") | |
ip = socket.gethostbyname(domain) | |
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
if sock.connect_ex((ip,80)) and sock.connect_ex((ip,443)): | |
print("Its down!!") | |
else: | |
print("Its up!!") | |
except: | |
print("Enter a valid domain name") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment