Change directory structure
This commit is contained in:
parent
11fbe99fcd
commit
51a108d7d5
0
src/tlds/ch
Normal file
0
src/tlds/ch
Normal file
0
src/tlds/com
Normal file
0
src/tlds/com
Normal file
0
src/tlds/im
Normal file
0
src/tlds/im
Normal file
0
src/tlds/in
Normal file
0
src/tlds/in
Normal file
0
src/tlds/jp
Normal file
0
src/tlds/jp
Normal file
1
src/tlds/kr
Normal file
1
src/tlds/kr
Normal file
@ -0,0 +1 @@
|
||||
server = "kr.whois-servers.net"
|
||||
0
src/tlds/net
Normal file
0
src/tlds/net
Normal file
0
src/tlds/org
Normal file
0
src/tlds/org
Normal file
0
src/tlds/so
Normal file
0
src/tlds/so
Normal file
0
src/tlds/st
Normal file
0
src/tlds/st
Normal file
20
src/whois.py
20
src/whois.py
@ -9,18 +9,26 @@ class Whois(object):
|
||||
self.domain = domain
|
||||
self.tld = self.domain.split(".")[-1]
|
||||
|
||||
self.whoisServers = {}
|
||||
f = open(os.path.join(os.path.dirname(os.path.realpath(__file__)), "whois-servers.conf"), "r")
|
||||
exec("self.whoisServers = %s"%(f.read()))
|
||||
self.currPath = os.path.dirname(os.path.realpath(__file__))
|
||||
self.tldPath = os.path.join(self.currPath, "tlds")
|
||||
self.tldList = os.listdir(self.tldPath)
|
||||
|
||||
def chooseServer(self):
|
||||
if self.whoisServers.has_key(self.tld):
|
||||
return self.whoisServers[self.tld]
|
||||
if self.tld in self.tldList:
|
||||
settings = {}
|
||||
execfile(os.path.join(self.tldPath, self.tld), {}, settings)
|
||||
if "server" in settings:
|
||||
return settings["server"]
|
||||
else:
|
||||
return self.tld + ".whois-servers.net"
|
||||
|
||||
else:
|
||||
return self.tld + ".whois-servers.net"
|
||||
return self.tld + ".whois-servers.net"
|
||||
|
||||
|
||||
def run(self, redirect=True):
|
||||
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
self.whoisServer = self.chooseServer()
|
||||
try:
|
||||
s.connect((self.whoisServer, 43))
|
||||
except:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user