From d116cfc37b32be4fc39920af5893cf23d32fe8a3 Mon Sep 17 00:00:00 2001 From: Alexandre Dulaunoy Date: Wed, 20 Aug 2014 10:51:55 +0200 Subject: [PATCH] Exception handled for unknown origins --- DomainClassifier/domainclassifier.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/DomainClassifier/domainclassifier.py b/DomainClassifier/domainclassifier.py index 555cfae..cfc11cc 100644 --- a/DomainClassifier/domainclassifier.py +++ b/DomainClassifier/domainclassifier.py @@ -146,12 +146,18 @@ class Extract: for dom in self.validdomain: if dom[1] == 'A': ip = dom[2] - orig = self.__origin(ipaddr=dom[2])[1] + try: + orig = self.__origin(ipaddr=dom[2])[1] + except: + continue if(orig == cc): self.localdom.append(dom) elif dom[1] == 'CNAME': cname = str(dom[2]) ip = socket.gethostbyname(cname) - orig = self.__origin(ipaddr=ip)[1] + try: + orig = self.__origin(ipaddr=ip)[1] + except: + continue if(orig == cc): self.localdom.append(dom) return self.localdom