summaryrefslogtreecommitdiff
path: root/whoiscore.py
diff options
context:
space:
mode:
authorRaúl Benencia <rbenencia@linti.unlp.edu.ar>2012-08-01 18:05:04 -0300
committerRaúl Benencia <rbenencia@linti.unlp.edu.ar>2012-08-01 18:05:04 -0300
commit01aa58c5d7947e37bc3f0a927c2ed809873122a3 (patch)
tree31eb413ef072c5bc56da31b5820bb2be960d3726 /whoiscore.py
parent9eaa4fb13a8f761e4be0abec042501d600b4de10 (diff)
New scheme. Starting port to python 3. It's now or never!
Diffstat (limited to 'whoiscore.py')
-rw-r--r--whoiscore.py56
1 files changed, 0 insertions, 56 deletions
diff --git a/whoiscore.py b/whoiscore.py
deleted file mode 100644
index 6053508..0000000
--- a/whoiscore.py
+++ /dev/null
@@ -1,56 +0,0 @@
-from ipcalc import IP, Network
-
-class WhoisDaemon():
- def __init__(data):
- self.data = data
-
- def query(q):
- if is_ip(q):
- self.search_ip(q)
- else:
- if is_domain(q):
- self.search_domain(q)
- else:
- return self.print_help()
-
- def search_ip(self, ip):
- result = {}
-
- # Iterate over all IP block elements
- for network in self.data.get_networks():
- for block in network.ip_blocks:
- if ip in Network(block):
- result['name'] = network.name
- for key in network.data:
- result[key] = network.data[key]
-
- return result
-
- result['error'] = "Red no encontrada"
- return result
-
- def search_domain:
- pass
-
-class ThreadedTCPRequestHandler(SocketServer.BaseRequestHandler):
-
- def handle(self):
- data = self.request.recv(100)
- cur_thread = threading.current_thread()
- response = self.get_header() + "\n" + self.get_answer(data) + "\n" + self.get_footer()
- self.request.sendall(response)
-
-class WhoisServer(TCPServer):
- def __init__(self, config):
- host = config.get('Servers', 'classic_host')
- port = config.get('Servers', 'classic_port')
-
- TCPServer.__init__(self, (host, port), ThreadedTCPRequestHandler):
-
- def start(self):
-
-
-class WhoisWebServer(TCPServer):
- def __init__(self, config):
- self.host = config.get('Servers', 'web_host')
- self.port = config.get('Servers', 'web_host')
nihil fit ex nihilo