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
+18.4k Golang : Get path name to current directory or folder
+9.6k Golang : Extract or copy items from map based on value
+16.2k Golang : How to check if input from os.Args is integer?
+12.5k Golang : How to display image file or expose CSS, JS files from localhost?
+6.3k Golang : Grab news article text and use NLP to get each paragraph's sentences
+18.7k Golang : Generate thumbnails from images
+17.2k Golang : XML to JSON example
+9.4k Golang : Temperatures conversion example
+9.2k Golang : How to use Gorilla webtoolkit context package properly
+24.1k Golang : Use regular expression to validate domain name
+16k Golang : Get digits from integer before and after given position example
+10.4k Golang : Embed secret text string into binary(executable) file