Skip to content

Instantly share code, notes, and snippets.

@linuxluigi
Created July 4, 2018 15:16
Show Gist options
  • Save linuxluigi/189956f7da7fcf0ba03ee8bd957d80f2 to your computer and use it in GitHub Desktop.
Save linuxluigi/189956f7da7fcf0ba03ee8bd957d80f2 to your computer and use it in GitHub Desktop.
Python CLI doimain ip request
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