This article mainly introduces the simple DNS query function implemented by Python, and analyzes the implementation technique of the DNS information query based on the socket module in the form of instance, and the friend can refer to the following
The examples in this article describe the simple DNS query functionality that Python implements. Share to everyone for your reference, as follows:
#!/usr/bin/pythonimport sys,socketdef Print_array (*arr): array = arr for item in array: print item[4][0] print ' This script was for the host Resolveprint ' now this begin...if you want to leave,please input ' break ' and ' while 1: t RY: host = raw_input ("Please input the host:") except Keyboardinterrupt: print "\ n", continue Except: print "\ n", continue if host = = "Break" or host = = "": Break result = Socket.getaddrinfo (Host,none,0,socket. SOCK_STREAM) Print_array (*result)
"Recommended"
1. Share Python to implement SMTP send message graphics instances
2. Use Python to implement Youku video batch download function instance
3. Sharing the example of and/or in Python tutorial
4. Python: logical judgment and Operator instance