I am writing a script that gives back the IP from a website. I have written it successfully, but now I am trying to add some kind of verification to the IP itself ,in order to see if it is down. It is giving me this error:
c:\Users\PC\Desktop>getip.py
File "C:\Users\PC\Desktop\getip.py", line 21
conn.connect((ip, port))
^
IndentationError: expected an indented block
Here is the script :
# AUTHOR : G19
# Version : 1.0.0v
import time, socket, os, sys, string
print ("#####################################################")
print ("# SCRIPT : GETIP.PY #")
print ("# AUTHOR : G19 #")
print ("# VERSION: 1.0.0b #")
print ("#####################################################")
print ("")
host = raw_input('WEBSITE LINK : ')
ip = socket.gethostbyname(host)
conn = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
port = 80
def getip():
try:
conn.connect((ip, port))
conn.send("Sending packet confirmation")
except:
print ("")
print ("#####################################################")
print ("# STATUS : DOWN #")
print ("# IP: " + ip + " #")
print ("#####################################################")
print ("")
print ("")
print ("#####################################################")
print ("# STATUS : UP #")
print ("# IP: " + ip + " #")
print ("#####################################################")
print ("")
return
getip()