Ahmad Naser Turnkey Ecosystem Ahmad Naser
February 7, 2024

How to compile python online and test for who.is socket

Published in the Ahmad Naser ecosystem. Estimated reading time: 1 minute.

In case you are using whmcs, you might need to check for who.is using socket

in case you want to check for .ai

"extensions": ".ai"

you need to modify

resources/domains/dist.whois.json inside your whmcs installation

 

Navigate to https://pythononlinecompiler.com/

import socket

def query_whois(domain):
    server = 'whois.nic.ai'
    port = 43

    # Establish a TCP connection
    sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    sock.connect((server, port))

    # Send the domain query
    sock.sendall((domain + "\r\n").encode())

    # Receive and print the response
    response = sock.recv(4096).decode()
    print(response)

    # Close the socket connection
    sock.close()

# Example usage
query_whois("dasexample.ai")

Press on compile

so after this the dist.whois.json need to be modified to this

{
     "extensions": ".ai",
     "uri": "socket://whois.nic.ai",
     "available": "No Object Found"
 }

 

Leave a Reply

Your email address will not be published. Required fields are marked *