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
+7.2k Golang : A simple forex opportunities scanner
+6.3k Linux/Unix : Commands that you need to be careful about
+17.6k Golang : Find smallest number in array
+14.2k Golang : Check if a file exist or not
+10.3k Golang : Check a web page existence with HEAD request example
+10.3k Golang : How to tokenize source code with text/scanner package?
+8.3k Golang : Routes multiplexer routing example with regular expression control
+9.8k Golang : Sort and reverse sort a slice of floats
+9.5k Golang : Timeout example
+29.6k Golang : Login(Authenticate) with Facebook example
+7.7k Android Studio : AlertDialog to get user attention example
+9.6k Golang : Accessing content anonymously with Tor