Menu
Forums
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Trending
What's new
New posts
New profile posts
Latest activity
Members
Current visitors
New profile posts
Search profile posts
Upgrades
Log in
Register
What's new
Search
Search
Search titles only
By:
All threads
Latest threads
New posts
Trending threads
New posts
Search forums
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
Software Development
Programming
[PY] GetIP
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="Sway" data-source="post: 224273" data-attributes="member: 1889"><p>This is a simple script I cooked up in <strong>Python</strong> in about 15 minutes to get the IP of a website. It is complete with <strong>exception handlers</strong> and bootleg loops (function calling here and there).</p><p> </p><p>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.</p><p> </p><p><strong>Source:</strong></p><p><a href="http://pastebin.com/uZmzGMtS" target="_blank">http://pastebin.com/uZmzGMtS</a></p><p> </p><p><strong>Snippet:</strong></p><p>[CODE]def getIP(): #this is the main part of the program</p><p> try:</p><p> host = input("Website: ")</p><p> ip = socket.gethostbyname(host)</p><p> except socket.gaierror:</p><p> print("Invalid address!")</p><p> again()</p><p> finally: </p><p> print ("IP: %s" % ip)</p><p> again() #this calls the function below[/CODE]</p><p> </p><p>It is complete with comments and is to be used for educational purposes. You need <strong>Python 3.x </strong>to run this script. If you have any questions, comments, or concerns, don't hesitate to ask!</p></blockquote><p></p>
[QUOTE="Sway, post: 224273, member: 1889"] This is a simple script I cooked up in [B]Python[/B] in about 15 minutes to get the IP of a website. It is complete with [B]exception handlers[/B] 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. [B]Source:[/B] [URL]http://pastebin.com/uZmzGMtS[/URL] [B]Snippet:[/B] [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[/CODE] It is complete with comments and is to be used for educational purposes. You need [B]Python 3.x [/B]to run this script. If you have any questions, comments, or concerns, don't hesitate to ask! [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Software Development
Programming
[PY] GetIP
Top