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
+16k Golang : Parse date string and convert to dd-mm-yyyy format
+10.9k Golang : Get month name from date example
+9.3k Golang : Select region of interest with mouse click and crop from image
+4.1k Golang : Display packages names during compilation
+11.4k Golang : How to calculate the distance between two coordinates using Haversine formula
+12.4k Golang : Reverse IP address for reverse DNS lookup example
+33.8k Golang : How to split or chunking a file to smaller pieces?
+6.8k Golang : Gomobile init produce "iphoneos" cannot be located error
+7.1k Golang : Check if integer is power of four example
+24.9k Golang : Convert file content into array of bytes
+8.2k Golang : Find correlation coefficient example
+8.5k Golang : interface - when and where to use examples