Sway
Ruby and Python are married.
- Dec 19, 2010
- 194
- 76
This is a simple script I cooked up in Python in about 15 minutes to get the IP of a website. It is complete with exception handlers and bootleg loops (function calling here and there).
The purpose of this script is to retrieve the IP address of a website or hostname. It'll ask you if you wish to do it again, which then you will be able to enter the common responses to a question like that (yes, yeah, no, yup, ok, etc) and it will perform according to your response.
Source:
Snippet:
It is complete with comments and is to be used for educational purposes. You need Python 3.x to run this script. If you have any questions, comments, or concerns, don't hesitate to ask!
The purpose of this script is to retrieve the IP address of a website or hostname. It'll ask you if you wish to do it again, which then you will be able to enter the common responses to a question like that (yes, yeah, no, yup, ok, etc) and it will perform according to your response.
Source:
You must be registered for see links
Snippet:
Code:
def getIP(): #this is the main part of the program
try:
host = input("Website: ")
ip = socket.gethostbyname(host)
except socket.gaierror:
print("Invalid address!")
again()
finally:
print ("IP: %s" % ip)
again() #this calls the function below
It is complete with comments and is to be used for educational purposes. You need Python 3.x to run this script. If you have any questions, comments, or concerns, don't hesitate to ask!