Python : Create Whois client or function example
Adding this Python tutorial as a supplement for my previous tutorial on how to implement Golang whois client.
Whois a network utility to find out "who is" the owner behind a domain name. Some owners will display all the private information such as personal home address, mobile/cell phone numbers and while some will choose to protect their privacy.
Here is an example on how to implement whois query in Python :
import sys
import socket
def whois(domainName, server):
# dial to whois server port 43
conn = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
conn.connect((server, 43))
# send query over conn
conn.send((domainName + "\r\n").encode())
result = b""
while True:
buf = conn.recv(1024)
result += buf
if not buf:
break
conn.close()
return result
result = whois("socketloop.com", "com.whois-servers.net")
print(result.decode())
Hope this helps!
References :
See also : Golang : Whois examples
By Adam Ng
IF you gain some knowledge or the information here solved your programming problem. Please consider donating to the less fortunate or some charities that you like. Apart from donation, planting trees, volunteering or reducing your carbon footprint will be great too.
Advertisement
Tutorials
+7.3k Golang : Null and nil value
+20.9k Golang : Saving private and public key to files
+9.4k Golang : Create and shuffle deck of cards example
+8k Javascript : Put image into Chrome browser's console
+8.7k Linux/Unix : fatal: the Postfix mail system is already running
+82.8k Golang : How to return HTTP status code?
+9k Golang : HTTP Routing with Goji example
+20.1k Golang : How to get time from unix nano example
+4.8k Mac OSX : Get disk partitions' size, type and name
+5.6k Golang : Display advertisement images or strings on random order
+9.6k Golang : Qt Yes No and Quit message box example
+13.3k Golang : Convert(cast) int to int64