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
+11.5k Golang : Simple file scaning and remove virus example
+14.4k Golang : Convert(cast) int to float example
+12.6k Swift : Convert (cast) Int or int32 value to CGFloat
+16.7k Golang : Set up source IP address before making HTTP request
+5.1k PHP : See installed compiled-in-modules
+5.3k Golang : Qt update UI elements with core.QCoreApplication_ProcessEvents
+12.1k Golang : Flush and close file created by os.Create and bufio.NewWriter example
+5.3k Golang : Get S3 or CloudFront object or file information
+26.7k Golang : Find files by extension
+7.1k Ubuntu : connect() to unix:/var/run/php5-fpm.sock failed (13: Permission denied) while connecting to upstream
+9.6k Golang : Format strings to SEO friendly URL example
+6.1k Golang & Javascript : How to save cropped image to file on server