Last active
December 27, 2022 04:09
-
-
Save GrapeApple0/c24f0a00aaaa28584ac6ae4211d47dad to your computer and use it in GitHub Desktop.
.ap Whois
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| .ap Whois example | |
| run: sudo python3 whois.ap.py | |
| command: whois -h $host example.ap |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "domain":"example.ap", | |
| "status":"Activa", | |
| "register":"ApolenNic", | |
| "registry":"ApolenNic (http://nic.ap/)", | |
| "address":"2-6 MeinStlet Dublik Apolen", | |
| "email":"webmaster@nic.ap" | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import socket | |
| import json | |
| HOST = "whois.nic.ap" | |
| PORT = 43 | |
| with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as server: | |
| server.bind((HOST, PORT)) | |
| server.listen() | |
| print("ApolenNic Whois ver 0.1 beta") | |
| while True: | |
| client, addr = server.accept() | |
| with client: | |
| domain = client.recv(1024).strip().decode() | |
| if domain.endswith(".ap"): | |
| jsonf = open(domain + '.json', 'r') | |
| rec = json.load(jsonf) | |
| statusres = rec["status"] | |
| nameres = rec["register"] | |
| addressres = rec["address"] | |
| registryres = rec["registry"] | |
| emailres = rec["email"] | |
| if (nameres == "Not found."): | |
| res = bytes("ApolenNic Whois ver 0.1 beta\n" + domain + " is not found.","utf-8") | |
| client.sendall(res) | |
| else: | |
| res = bytes( | |
| "ApolenNic Whois ver 0.1\nDomain: " + | |
| domain + | |
| "\nStaus: " + | |
| statusres + | |
| "\nRegistry: " + | |
| registryres + | |
| "\nRegistrant: " + | |
| nameres + | |
| "\nRegistrant Address: " + | |
| addressres + | |
| "\nRegistrant Email: " + | |
| emailres + | |
| "\n\n*STROVECIKA*\nKvejra uza idetjikal canu.\nPestravkani djkar hrevka.","utf-8") | |
| client.sendall(res) | |
| print("Whois request to " + domain) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment