Python : Create Whois client or function example
Tags : python whois
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
Tags : python whois
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
+2.1k Android Studio : Image button and button example
+7.4k Golang : How to generate QR codes?
+3.2k Golang : Resumable upload to Google Drive(RESTful) example
+3.3k Golang : Go as a script or running go with shebang/hashbang style
+5.2k Golang : delete and modify XML file content
+3k Golang : Simple file scaning and remove virus example
+3.6k Golang : How to force compile or remove object files first before rebuild?
+1.6k Golang : Detect face in uploaded photo like GPlus
+3.2k Javascript : How to check a browser's Do Not Track status?
+1.4k Which content-type(MIME type) to use for JSON data
+18.4k Golang : Encrypt and decrypt data with AES crypto
+3.9k Golang : Activate web camera and broadcast out base64 encoded images