Cleanup useless pieces of code

regex-type
Raphaël Vinot 2017-10-31 17:28:54 -07:00
parent 17071506ab
commit e0daf537d4
2 changed files with 3 additions and 9 deletions

View File

@ -76,18 +76,10 @@ class WarningList():
to_return = []
for entry in self.list:
try:
# Try if the entry is a network bloc
# Try if the entry is a network bloc or an IP
to_return.append(ip_network(entry))
continue
except ValueError:
pass
try:
# Try if the entry is an IP
to_return.append(ip_address(entry))
continue
except ValueError:
pass
# Not an IP nor a network
return to_return
def _slow_search(self, value):

View File

@ -42,3 +42,5 @@ class TestPyMISPWarningLists(unittest.TestCase):
self.assertEqual(results[0].name, 'List of RFC 6598 CIDR blocks')
results = self.warninglists.search('2001:DB8::34:1')
self.assertEqual(results[0].name, 'List of RFC 3849 CIDR blocks')
results = self.warninglists.search('1e100.net')
self.assertEqual(results[0].name, 'List of known google domains')