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
+6k Golang : Get Hokkien(福建话)/Min-nan(閩南語) Pronounciations
+6.7k Get Facebook friends working in same company
+9.1k Android Studio : Indicate progression with ProgressBar example
+55k Golang : Unmarshal JSON from http response
+6.4k Unix/Linux : How to get own IP address ?
+13.3k Golang : Get constant name from value
+5k Golang : Customize scanner.Scanner to treat dash as part of identifier
+13.9k Golang : Reverse IP address for reverse DNS lookup example
+17.2k Golang : Check if IP address is version 4 or 6
+20.4k Android Studio : AlertDialog and EditText to get user string input example
+6.9k Golang : Find the shortest line of text example
+33.5k Golang : How to check if slice or array is empty?