Perform initial lookup with TLD whois server then, if the quick flag is false, search that result for the region-specifc whois server and do a lookup there for contact details
(self, query, hostname, flags)
| 91 | return nhost |
| 92 | |
| 93 | def whois(self, query, hostname, flags): |
| 94 | """Perform initial lookup with TLD whois server |
| 95 | then, if the quick flag is false, search that result |
| 96 | for the region-specifc whois server and do a lookup |
| 97 | there for contact details |
| 98 | """ |
| 99 | #pdb.set_trace() |
| 100 | s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) |
| 101 | s.connect((hostname, 43)) |
| 102 | if (hostname == NICClient.GERMNICHOST): |
| 103 | s.send("-T dn,ace -C US-ASCII " + query + "\r\n") |
| 104 | else: |
| 105 | s.send(query + "\r\n") |
| 106 | response = '' |
| 107 | while True: |
| 108 | d = s.recv(4096) |
| 109 | response += d |
| 110 | if not d: |
| 111 | break |
| 112 | s.close() |
| 113 | #pdb.set_trace() |
| 114 | nhost = None |
| 115 | if (flags & NICClient.WHOIS_RECURSE and nhost == None): |
| 116 | nhost = self.findwhois_server(response, hostname) |
| 117 | if (nhost != None): |
| 118 | response += self.whois(query, nhost, 0) |
| 119 | return response |
| 120 | |
| 121 | def choose_server(self, domain): |
| 122 | """Choose initial lookup NIC host""" |
no test coverage detected