Created
July 4, 2018 15:16
-
-
Save linuxluigi/189956f7da7fcf0ba03ee8bd957d80f2 to your computer and use it in GitHub Desktop.
Python CLI doimain ip request
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
import sys | |
import socket | |
if len(sys.argv) > 1: | |
hostname = str(sys.argv[1]) | |
print("requested Domain: %s" % hostname) # show domain name | |
try: | |
ip = socket.gethostbyname(hostname) | |
print("IP: %s" % ip) | |
except: | |
print("No valid dns name") | |
else: | |
print("No Param") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment