def lookup(self, ip=None, hostname=None): if hostname: match = Level3.applre.match(hostname) if match: city_code = match.group(1) returninfo = base.returninfo.copy() returninfo['company'] = 'Verizon' returninfo['info'] = 'carrier' country = base.get_country_by_iso('us') returninfo['country'] = country['name'] returninfo['accuracy'] = 'country' returninfo['lat'] = country['lat'] returninfo['lng'] = country['lng'] try: jsondb = json.load( open('./database/carriers/verizon.json')) c = jsondb[city_code.upper()] returninfo['city'] = c['city'] returninfo['accuracy'] = 'city' returninfo['lat'] = c['lat'] returninfo['lng'] = c['lng'] returninfo['country'] = c['country'] except: pass return returninfo raise exceptions.NotApplicable()
def lookup(self, ip=None, hostname=None): if hostname: match = Level3.applre.match(hostname) if match: city_code = match.group(1) returninfo = base.returninfo.copy() returninfo['company'] = 'Verizon' returninfo['info'] = 'carrier' country = base.get_country_by_iso('us') returninfo['country'] = country['name'] returninfo['accuracy'] = 'country' returninfo['lat'] = country['lat'] returninfo['lng'] = country['lng'] try: jsondb = json.load(open('./database/carriers/verizon.json')) c = jsondb[city_code.upper()] returninfo['city'] = c['city'] returninfo['accuracy'] = 'city' returninfo['lat'] = c['lat'] returninfo['lng'] = c['lng'] returninfo['country'] = c['country'] except: pass return returninfo raise exceptions.NotApplicable()
def lookup(self, ip=None, hostname=None): if hostname: match = DTag.applre.match(hostname) if match: city_code, country_code = match.group(1,2) returninfo = base.returninfo.copy() country = base.get_country_by_iso(country_code) returninfo['country'] = country['name'] returninfo['accuracy'] = 'country' returninfo['lat'] = country['lat'] returninfo['lng'] = country['lng'] returninfo['company'] = 'Deutsche Telekom AG' returninfo['info'] = 'carrier' # try city if country_code.upper() in base.get_available_opengeodbs(): try: city = base.get_city_by_plate(country_code, city_code) returninfo['city'] = city['name'] returninfo['accuracy'] = 'city' returninfo['lat'] = city['lat'] returninfo['lng'] = city['lng'] except: pass return returninfo raise exceptions.NotApplicable()
def lookup(self, ip=None, hostname=None): if hostname: match = DTag.applre.match(hostname) if match: city_code, country_code = match.group(1, 2) returninfo = base.returninfo.copy() country = base.get_country_by_iso(country_code) returninfo['country'] = country['name'] returninfo['accuracy'] = 'country' returninfo['lat'] = country['lat'] returninfo['lng'] = country['lng'] returninfo['company'] = 'Deutsche Telekom AG' returninfo['info'] = 'carrier' # try city if country_code.upper() in base.get_available_opengeodbs(): try: city = base.get_city_by_plate(country_code, city_code) returninfo['city'] = city['name'] returninfo['accuracy'] = 'city' returninfo['lat'] = city['lat'] returninfo['lng'] = city['lng'] except: pass return returninfo raise exceptions.NotApplicable()
def lookup(self, ip=None, hostname=None): if hostname: match = ContentCore.applre.match(hostname) if match: city_code = match.group(1) returninfo = base.returninfo.copy() returninfo['company'] = 'IP Exchange GmbH' returninfo['info'] = 'carrier' try: jsondb = json.load( open('./database/carriers/ipexchange.json')) c = jsondb[city_code.upper()] returninfo['country'] = c['country'] returninfo['city'] = c['city'] returninfo['accuracy'] = 'city' returninfo['lat'] = c['lat'] returninfo['lng'] = c['lng'] except: pass return returninfo else: match = ContentCore.applre_ext.match(hostname) if match: city_code, country_code = match.group(1, 2) returninfo = base.returninfo.copy() country = base.get_country_by_iso(country_code) returninfo['country'] = country['name'] returninfo['accuracy'] = 'country' returninfo['lat'] = country['lat'] returninfo['lng'] = country['lng'] returninfo['company'] = 'IP Exchange GmbH' returninfo['info'] = 'carrier' try: jsondb = json.load( open('./database/carriers/ipexchange.json')) key = "%s-%s" % (country_code.upper(), city_code.upper()) c = jsondb[key] returninfo['city'] = c['city'] returninfo['accuracy'] = 'city' returninfo['lat'] = c['lat'] returninfo['lng'] = c['lng'] except: pass return returninfo raise exceptions.NotApplicable()
def lookup(self, ip=None, hostname=None): if hostname: match = ContentCore.applre.match(hostname) if match: city_code = match.group(1) returninfo = base.returninfo.copy() returninfo['company'] = 'IP Exchange GmbH' returninfo['info'] = 'carrier' try: jsondb = json.load(open('./database/carriers/ipexchange.json')) c = jsondb[city_code.upper()] returninfo['country'] = c['country'] returninfo['city'] = c['city'] returninfo['accuracy'] = 'city' returninfo['lat'] = c['lat'] returninfo['lng'] = c['lng'] except: pass return returninfo else: match = ContentCore.applre_ext.match(hostname) if match: city_code, country_code = match.group(1,2) returninfo = base.returninfo.copy() country = base.get_country_by_iso(country_code) returninfo['country'] = country['name'] returninfo['accuracy'] = 'country' returninfo['lat'] = country['lat'] returninfo['lng'] = country['lng'] returninfo['company'] = 'IP Exchange GmbH' returninfo['info'] = 'carrier' try: jsondb = json.load(open('./database/carriers/ipexchange.json')) key = "%s-%s" % (country_code.upper(), city_code.upper()) c = jsondb[key] returninfo['city'] = c['city'] returninfo['accuracy'] = 'city' returninfo['lat'] = c['lat'] returninfo['lng'] = c['lng'] except: pass return returninfo raise exceptions.NotApplicable()
def lookup(self, ip=None, hostname=None): if hostname: match = AboveNet.applre.match(hostname) if match: iata_code, country_code = match.group(1, 2) returninfo = base.returninfo.copy() country = base.get_country_by_iso(country_code) returninfo['country'] = country['name'] returninfo['accuracy'] = 'country' returninfo['lat'] = country['lat'] returninfo['lng'] = country['lng'] returninfo['company'] = 'AboveNet Inc' returninfo['info'] = 'carrier' try: c = base.get_city_by_iata(iata_code) returninfo['city'] = c['name'] returninfo['accuracy'] = 'city' returninfo['lat'] = c['lat'] returninfo['lng'] = c['lng'] except: pass return returninfo raise exceptions.NotApplicable()
def lookup(self, ip=None, hostname=None): if hostname: match = AboveNet.applre.match(hostname) if match: iata_code, country_code = match.group(1,2) returninfo = base.returninfo.copy() country = base.get_country_by_iso(country_code) returninfo['country'] = country['name'] returninfo['accuracy'] = 'country' returninfo['lat'] = country['lat'] returninfo['lng'] = country['lng'] returninfo['company'] = 'AboveNet Inc' returninfo['info'] = 'carrier' try: c = base.get_city_by_iata(iata_code) returninfo['city'] = c['name'] returninfo['accuracy'] = 'city' returninfo['lat'] = c['lat'] returninfo['lng'] = c['lng'] except: pass return returninfo raise exceptions.NotApplicable()
def lookup(self, ip=None, hostname=None): if hostname: match = NTT.applre.match(hostname) if match: city_code, country_code = match.group(1,2) returninfo = base.returninfo.copy() country = base.get_country_by_iso(country_code) returninfo['country'] = country['name'] returninfo['accuracy'] = 'country' returninfo['lat'] = country['lat'] returninfo['lng'] = country['lng'] returninfo['company'] = 'Nippon Telegraph and Telephone' returninfo['info'] = 'carrier' try: jsondb = json.load(open('./database/carriers/ntt.json')) c = jsondb[city_code.upper()] returninfo['city'] = c['city'] returninfo['accuracy'] = 'city' returninfo['lat'] = c['lat'] returninfo['lng'] = c['lng'] except: pass return returninfo raise exceptions.NotApplicable()
def lookup(self, ip=None, hostname=None): if hostname: match = Eurorings.applre.match(hostname) if match: city_code, country_code = match.group(1,2) returninfo = base.returninfo.copy() country = base.get_country_by_iso(country_code) returninfo['country'] = country['name'] returninfo['accuracy'] = 'country' returninfo['lat'] = country['lat'] returninfo['lng'] = country['lng'] returninfo['company'] = 'KPN Internet' returninfo['info'] = 'carrier' try: jsondb = json.load(open('./database/carriers/eurorings.json')) c = jsondb[city_code.lower()] returninfo['city'] = c['city'] returninfo['accuracy'] = 'city' returninfo['lat'] = c['lat'] returninfo['lng'] = c['lng'] except: pass return returninfo raise exceptions.NotApplicable()
def lookup(self, ip=None, hostname=None): if hostname: match = NTT.applre.match(hostname) if match: city_code, country_code = match.group(1, 2) returninfo = base.returninfo.copy() country = base.get_country_by_iso(country_code) returninfo["country"] = country["name"] returninfo["accuracy"] = "country" returninfo["lat"] = country["lat"] returninfo["lng"] = country["lng"] returninfo["company"] = "Nippon Telegraph and Telephone" returninfo["info"] = "carrier" try: jsondb = json.load(open("./database/carriers/ntt.json")) c = jsondb[city_code.upper()] returninfo["city"] = c["city"] returninfo["accuracy"] = "city" returninfo["lat"] = c["lat"] returninfo["lng"] = c["lng"] except: pass return returninfo raise exceptions.NotApplicable()