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
+5k Facebook : How to force facebook to scrape latest URL link data?
+11.1k Golang : 2 dimensional array example
+9.6k Golang : How to transmit update file to client by HTTP request example
+19.7k Golang : How to read float value from standard input ?
+5.1k Golang : Dealing with backquote
+7.9k Golang : Handle sub domain with Gin
+44.6k Golang : Encode image to base64 example
+9.8k Golang : Web routing/multiplex example
+9.7k Golang : Command line file upload program to server example
+6.6k Golang : Convert(cast) io.Reader type to string
+6.4k Golang : Getting Echo framework StartAutoTLS to work
+16.6k Golang : Put UTF8 text on OpenCV video capture image frame