Evitiamo errori di ipcalc.

Leonardo [2010-05-19 17:36]
Evitiamo errori di ipcalc.
Filename
pywhoisd.db
pywhoisd.py
diff --git a/pywhoisd.db b/pywhoisd.db
index 8eb7c14..e7aad32 100644
--- a/pywhoisd.db
+++ b/pywhoisd.db
@@ -44,6 +44,7 @@ net 6.0.0.0/8 {
   ns = 6.20.10.1, 6.22.22.22;
 };

+
 domain leo.gnet {
   name = Leo Gnet;
   owner = Leonardo Robol <leo@robol.it>;
@@ -56,6 +57,12 @@ domain ineff.gnet {
   ns = 6.20.10.1;
 };

+domain gio.gnet {
+  name = Giovanni gnet;
+  owner = Giovanni Mascellani <giovanni@gio.gnet>;
+  ns = 6.22.22.22;
+};
+
 domain lf.gnet {
   name = Luca GNet;
   owner = Luca Freschi <l.freschi@yahoo.it>;
@@ -66,4 +73,4 @@ domain gnet {
   name = GNET;
   owner = Undefined;
   ns = 6.20.10.1, 6.22.22.22;
-};
\ No newline at end of file
+};
diff --git a/pywhoisd.py b/pywhoisd.py
index 244928e..5adaeaa 100755
--- a/pywhoisd.py
+++ b/pywhoisd.py
@@ -23,8 +23,11 @@ def get_net_of_ip(ip):
     """
     interesting_networks = []
     for (address, net) in ip_database.items():
-        if IP(ip) in Network(address):
-            interesting_networks.append (address)
+        try:
+            if IP(ip) in Network(address):
+                interesting_networks.append (address)
+        except:
+            continue
     return interesting_networks

 def format_output(field, value):
ViewGit